Enumeration GeometricInstanceConverterInterfaceSignal

The GeometricInstanceConverterInterfaceSignal lists all the signals that may be sent by the GeometricInstanceConverterInterface.

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

/** 
* Sample to illustrate the use of a GeometricInstanceConverterInterface from a `geometric instance id`.
*/
import {
WorkingSetInterface, GeometricInstanceConverterInterface, GeometricInstanceConverterInterfaceSignal,
DataSessionInterface,
} from 'generated_files/documentation/appinfiniteapi';

// the `geometric instances` are retrieved by a picking for example

// the DataSessionInterface has been created previously and is connected
let lDataSession : DataSessionInterface;
// the `geometric instance id` to get information from
let lGeometricInstanceId : number;
// create a `geometric instance id` converter
const lGeometricConverter : GeometricInstanceConverterInterface = lDataSession.createGeometricInstanceConverter();
// the current Working set has been created previously
let lVisibilityContext : WorkingSetInterface;

// the `geometric instance` to get
const lGeometricInstanceIds: Uint32Array = new Uint32Array(1);
lGeometricInstanceIds[0] = lGeometricInstanceId;

const onPartInstanceReady = (_pEvent, _pCallbackData) : void =>
{
// triggered when we have all the `part instances` of the given geometry
const lPartInstanceIds : Uint32Array| undefined = lGeometricConverter.getPartInstanceIds();
if (lPartInstanceIds && (lPartInstanceIds.length > 0))
{
// only work if result is valid
console.log('result found');
console.log(lPartInstanceIds.join(','));
}
};

// connect the GeometricInstanceConverterReady signal to the id card retrieval
lGeometricConverter.addEventListener(GeometricInstanceConverterInterfaceSignal.GeometricInstanceConverterReady, onPartInstanceReady);

// trigger the conversion
lGeometricConverter.convert(lGeometricInstanceIds, lVisibilityContext);

Or with an id-card request :
/** 
* Sample to illustrate the use of an IdCardGetterInterface from a `geometric instance id`.
*/
import {
WorkingSetInterface, IdCardGetterInterface, GeometricInstanceConverterInterface,
IdCardGetterInterfaceSignal, GeometricInstanceConverterInterfaceSignal, DataSessionInterface,
} from 'generated_files/documentation/appinfiniteapi';
// the `part instances` are retrieved by a picking for example

// the DataSessionInterface has been created previously and is connected
let lDataSession : DataSessionInterface;
// the `geometric instance id` to get information from
let lGeometricInstanceId : number;
// create a `geometric instance id` converter
const lGeometricConverter : GeometricInstanceConverterInterface = lDataSession.createGeometricInstanceConverter();
// the current Working set has been created previously
let lVisibilityContext : WorkingSetInterface;
// what to do when the conversion from picking is ready
let onPartInstanceReady : (pEvent, _pCallbackData) => void;
// what to do when the id card retrieval is over
let onIdCardReady : (pEvent, _pCallbackData) => void;

// id card getter interface creation
const lIdCardGetterInterface : IdCardGetterInterface = lDataSession.createIdCardGetter();
// connect the IDCardReady signal to the handling of the metadata of the `part instance` and its genealogy
lIdCardGetterInterface.addEventListener(IdCardGetterInterfaceSignal.IdCardReady, onIdCardReady);

// the `geometric instance` to get
const lGeometricInstanceIds: Uint32Array = new Uint32Array(1);
lGeometricInstanceIds[0] = lGeometricInstanceId;
// connect the GeometricInstanceConverterReady signal to the id card retrieval
lGeometricConverter.addEventListener(GeometricInstanceConverterInterfaceSignal.GeometricInstanceConverterReady, onPartInstanceReady);

onPartInstanceReady = (_pEvent, _pCallbackData) : void =>
{
// triggered when we have all the `part instances` of the given geometry
const lPartInstanceIds : Uint32Array| undefined = lGeometricConverter.getPartInstanceIds();
if (lPartInstanceIds && (lPartInstanceIds.length > 0))
{
// only get the id-card of the first `part instance` (we may do other things if multiple id-cards to retrieve)
// onIdCardReady will be called shortly after
lIdCardGetterInterface.retrieveIdCard(lPartInstanceIds[0], lVisibilityContext);
}
};

// trigger the conversion
lGeometricConverter.convert(lGeometricInstanceIds, lVisibilityContext);

Please refer to IdCardGetterInterface for more information about id-card requests.
Events

Enumeration Members

GeometricInstanceConverterCancelled: "cancelled"

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

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

No attachment for events of this type.

GeometricInstanceConverterReady: "ready"

Signal sent by the GeometricInstanceConverterInterface when GeometricInstanceConverterInterface.convert is ready, i.e. GeometricInstanceConverterInterface.getPartInstanceIds 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 GeometricInstanceConverterReady signal is sent later when GeometricInstanceConverterInterface.cancel is called and the GeometricInstanceConverterInterface is fetching data.

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