Custom Progress-Indicator

Type Aliases

A3DVoid (*

A3DCallbackProgressStart

A3DVoid (*

A3DCallbackProgressSize

A3DVoid (*

A3DCallbackProgressIncrement

A3DVoid (*

A3DCallbackProgressEnd

A3DVoid (*

A3DCallbackProgressTitle

Functions

A3DStatus

A3DDllSetCallbacksProgress

Detailed Description

group a3d_progress_functions

Specifies a custom progress indicator.

This section describes the function and types that enable you to specify a custom progress indicator, such as a status bar.

Type Alias Documentation

typedef A3DVoid (*A3DCallbackProgressStart)(A3DInt32)

A callback function the library invokes as it prepares to perform a potentially time-consuming process. The argument identifies the processing phase, as follows:

Processing phase

Description

0

Undefined.

1

Parsing the file

2

Writing file

3

Reading or building the model, which follows parsing the file (processing phase 1)

Version

2.0

typedef A3DVoid (*A3DCallbackProgressSize)(A3DInt32)

A callback function the library invokes to report an approximate size of the PRC stream being processed. The size is independent of units and is bounded only by the limit of the A3DInt32 type.

Version

2.0

typedef A3DVoid (*A3DCallbackProgressIncrement)(A3DInt32)

A callback function the library intermittently invokes while processing the PRC stream. As processing proceeds, the argument increments from 0 to a maximum of Size, where Size is the argument provided in A3DCallbackProgressSize.

Version

2.0

typedef A3DVoid (*A3DCallbackProgressEnd)()

A callback function the library invokes when it finishes the process.

Version

2.0

typedef A3DVoid (*A3DCallbackProgressTitle)(A3DUTF8Char *msg)

A callback function the library invokes to provide a text string relevant to the processing phase. In the case of reading PRC data from a file, the argument provides the name of the file containing the PRC stream.

Version

2.0

Function Documentation

A3DStatus A3DDllSetCallbacksProgress(A3DCallbackProgressStart, A3DCallbackProgressSize, A3DCallbackProgressIncrement, A3DCallbackProgressEnd, A3DCallbackProgressTitle, A3DInt32*)

Sets callbacks for progress bar facility.

This function configures the library with the callback functions that implement a custom progress indicator, such as a status bar.

The last argument passed to this function sets a break. The library checks this variable at every significant step in processing the PRC. If the value is non-zero, the library stops processing the PRC data.

Version

2.0

Attention

The library stops processing the PRC data if the last argument passed to this function is non-zero.

Sample code

A3DVoid my_start(A3DInt32 iType) { _tprintf(_T("STARTING PROCESS #%d"), iType); fflush(stdout); }
static A3DInt32 stiSize = 0;
A3DVoid my_size(A3DInt32 iSize) { stiSize = iSize; }
A3DVoid my_increment(A3DInt32 i) { _tprintf(_T("PROCESS %d / %d"), i, stiSize); fflush(stdout); }
A3DVoid my_end() { stiSize = 0; }
A3DVoid my_title(A3DUTF8Char* msg)
{
#ifdef _MSC_VER
    A3DUniChar acUTF16FileName[MAX_PATH*4];
    A3DMiscUTF8ToUTF16(msg, acUTF16FileName);
    _tprintf(_T("CURRENT FILE %s\n"), acUTF16FileName);
#else
    _tprintf(_T("CURRENT FILE %s\n"), msg);
#endif
    fflush(stdout);
}

A3DInt32 iErr = A3D_SUCCESS;
A3DInt32 iMajorVersion,iMinorVersion = 0;
A3DInt32 my_break = 0;

iErr = A3DDllGetVersion(&iMajorVersion, &iMinorVersion);
iErr = A3DDllInitialize(A3D_DLL_MAJORVERSION, A3D_DLL_MAJORVERSION );
if (iErr == A3D_SUCCESS)
{
    iErr = A3DDllSetCallbacksProgress(my_start, my_size, my_increment, my_end, my_title, &my_break);
    iErr = A3DDllTerminate();
}

Return values:
  • A3D_INITIALIZE_NOT_CALLED

  • A3D_CALLBACK_INVALID_BREAK_VALUE

  • A3D_SUCCESS

Returns:

A3D_SUCCESS on success, or an error code on failure