Enumeration PartInstanceConverterInterfaceSignal

The PartInstanceConverterInterfaceSignal lists all the signals that may be sent by the PartInstanceConverterInterface.

These signals are emitted by the PartInstanceConverterInterface when some data is available.

/** 
* Sample to explain how to convert part instance ids to geometric instance ids using a PartInstanceConverterInterface.
*/
import {
PartInstanceConverterInterface, PartInstanceConverterInterfaceSignal,
InfiniteEngineInterface, VisualStates, DataSessionInterface,
} from 'generated_files/documentation/appinfiniteapi';

// the DataSessionInterface has been created previously and is connected
let lDataSession : DataSessionInterface;
// lInfiniteEngine has been created previously
let lInfiniteEngine : InfiniteEngineInterface;
// the `part instance id` to get information from
let lPartInstanceId : number;
// what to do when the conversion from picking is ready
let onGeometricInstanceReady : (pEvent, _pCallbackData) => void;

// the `part instance ids` to convert
const lPartInstanceIds: Uint32Array = new Uint32Array(1);
lPartInstanceIds[0] = lPartInstanceId;

// create a partInstanceConverter to convert `part instances` to `geometric instance ids`
const lPartInstanceConverter : PartInstanceConverterInterface = lDataSession.createPartInstanceConverter();
// connect the PartInstanceConverterReady signal to the set ghost procedure
lPartInstanceConverter.addEventListener(PartInstanceConverterInterfaceSignal.PartInstanceConverterReady, onGeometricInstanceReady);

onGeometricInstanceReady = (_pEvent, _pCallbackData) : void =>
{
// triggered when we have all the `geometric instances` of the given `part instance`
const lGeometricInstanceIds : Uint32Array| undefined = lPartInstanceConverter.getGeometricInstanceIds();
if (lGeometricInstanceIds && (lGeometricInstanceIds.length > 0))
{
// display the given `geometric instances` ghosted
lInfiniteEngine.updateGeometricState(lGeometricInstanceIds, VisualStates.S_Ghost, VisualStates.S_Ghost);
}
};

// trigger the conversion
lPartInstanceConverter.convert(lPartInstanceIds);

Please refer to PartInstanceConverterInterface for more information.
Events

Enumeration Members

PartInstanceConverterCancelled: "cancelled"

Signal sent by the PartInstanceConverterInterface when the PartInstanceConverterInterface has been cancelled.

Such an event is fired if the PartInstanceConverterInterface was fetching data and PartInstanceConverterInterface.cancel is called. The PartInstanceConverterReady signal will be triggered shortly after.

No attachment for events of this type.

PartInstanceConverterReady: "ready"

Signal sent by the PartInstanceConverterInterface when PartInstanceConverterInterface.convert is ready, i.e. PartInstanceConverterInterface.getGeometricInstanceIds can be called.

Such a signal does not tell if the call was successful or not but that the result is ready to be fetched.

Warning, the PartInstanceConverterReady signal is sent later when PartInstanceConverterInterface.cancel is called and the PartInstanceConverterInterface is fetching data.

The attachment is a string telling the request id of the call to PartInstanceConverterInterface.convert (PartInstanceConverterInterface.getLastRequestId).