Enumeration PartInstanceInfoStatusFlag

The PartInstanceInfoStatusFlag enumeration tells some information about the part instances inside the DMU.

The PartInstanceInfoStatusFlag gives added information to a part instance when retrieved by an IdCardGetterInterface or a ChildrenIdCardGetterInterface. It is included in the PartInstanceInfoInterface or ChildrenPartInstanceInfoInterface.

The PartInstanceInfoStatusFlag is a flag, which means several information are stored in a number as an OR of the enumeration values.

/** 
* Sample to illustrate the use of an IdCardGetterInterface with the parsing of
* PartInstanceInfoInterface to display some information about a part instance.
*/
import {
WorkingSetInterface, IdCardGetterInterface, IdCardGetterInterfaceSignal,
InfiniteEvent, PartInstanceInfoInterface, DataSessionInterface, AncestryInstanceMetadataInterface, DocumentContentInterface
} from 'generated_files/documentation/appinfiniteapi';

// the DataSessionInterface has been created previously and is connected
let lDataSession : DataSessionInterface;
// created previously
let lVisibilityContext : WorkingSetInterface;
// the `part instance id` to get
let lPartInstanceId : number;
// what to do when we have retrieved id card information ?
let onIdCardReady : (_pEvent: InfiniteEvent, _pCallbackData: Object | undefined) => void;

// create an idCardGetter
const lIdCardGetterInterface : IdCardGetterInterface = lDataSession.createIdCardGetter();
// what to do when result is ready ?
lIdCardGetterInterface.addEventListener(IdCardGetterInterfaceSignal.IdCardReady, onIdCardReady);

// onIdCardReady will be called when data is available
onIdCardReady = (_pEvent: InfiniteEvent, _pCallbackData: Object | undefined) : void =>
{
if (lIdCardGetterInterface.getLastError() !== undefined) {
// do nothing in case of error
// perhaps some GUI code ?
}
const lPartInstanceInfos : Array<PartInstanceInfoInterface> | undefined = lIdCardGetterInterface.getPartInstanceInfos();
if (!lPartInstanceInfos || lPartInstanceInfos.length !== 1)
{
// no data (isCancelled ?)
return;
}
// we required only one `part instance`, as such, only one result should be retrieved
// iterate over the instantiation chain, but take the first chain since one `part instance` retrieved
const lCurrentChain : PartInstanceInfoInterface = lPartInstanceInfos[0];

// iterate over the metadata infos
const lAllInstanceMetadata : Array<AncestryInstanceMetadataInterface> = lCurrentChain.getAncestorInstanceInfos();

// number of items
const lNbAncestors : number = lAllInstanceMetadata.length;
const lOffsetToPartInstance : number = lNbAncestors - 1;
// we get the `part` metadata of the given `part instance` (and not their parents - grand parents) => lNbAncestors-1
const lCurrentInstanceInfos : AncestryInstanceMetadataInterface = lAllInstanceMetadata[lOffsetToPartInstance];
const lPartMetadataDocuments : Array<DocumentContentInterface> = lCurrentInstanceInfos.getPartMetadataDocuments();
if (lPartMetadataDocuments.length === 0)
{
console.log('this part instance has no part metadata documents');
return;
}
// and we only care with the first document, but many documents may be attached
const lPartMetadata : Object = lPartMetadataDocuments[0].getDocumentContent();
// some fancy output
console.log(JSON.stringify(lPartMetadata));

// get the visibility info in order to get information about the `part instance`
if (lCurrentInstanceInfos.isDisplayable())
{
console.log('this part instance is displayable');
}
};

// trigger the retrieval
lIdCardGetterInterface.retrieveIdCard(lPartInstanceId, lVisibilityContext);

or with async calls :
/** 
* Sample to illustrate the asynchronous use of an IdCardGetterInterface with the parsing of
* PartInstanceInfoInterface to display some information about a part instance.
*/
import {
WorkingSetInterface, IdCardGetterInterface, AsyncPartInstanceInfoResult,
AsyncResultReason, PartInstanceInfoInterface, DataSessionInterface, AncestryInstanceMetadataInterface, DocumentContentInterface
} from 'generated_files/documentation/appinfiniteapi';

// the DataSessionInterface has been created previously and is connected
let lDataSession : DataSessionInterface;
// created previously
let lVisibilityContext : WorkingSetInterface;
// the `part instance id` to get
let lPartInstanceId : number;
// what to do when we have retrieved id card information ?

// create an idCardGetter
const lIdCardGetterInterface : IdCardGetterInterface = lDataSession.createIdCardGetter();

const fetchIdCard = async () : Promise<void> =>
{
// trigger the retrieval
const lResult : AsyncPartInstanceInfoResult = await lIdCardGetterInterface.asyncRetrieveIdCard(lPartInstanceId, lVisibilityContext);
if (lResult.reason !== AsyncResultReason.ARR_Success) {
// do nothing in case of error
// perhaps some GUI code ?
}

const lPartInstanceInfos : Array<PartInstanceInfoInterface> | undefined = lIdCardGetterInterface.getPartInstanceInfos();
console.assert(lPartInstanceInfos === lResult.value);
if (!lPartInstanceInfos || lPartInstanceInfos.length !== 1)
{
// no data (isCancelled ?)
return;
}
// we required only one `part instance`, as such, only one result should be retrieved
// iterate over the instantiation chain, but take the first chain since one `part instance` retrieved
const lCurrentChain : PartInstanceInfoInterface = lPartInstanceInfos[0];

// get all metadata hierarchy
const lAllInstanceMetadata : Array<AncestryInstanceMetadataInterface> = lCurrentChain.getAncestorInstanceInfos();

// number of items
const lNbAncestors : number = lAllInstanceMetadata.length;
const lOffsetToPartInstance : number = lNbAncestors - 1;

// we get the `part` metadata of the given `part instance` (and not their parents - grand parents) => lNbAncestors-1
const lCurrentInstanceInfos : AncestryInstanceMetadataInterface = lAllInstanceMetadata[lOffsetToPartInstance];
const lPartMetadataDocuments : Array<DocumentContentInterface> = lCurrentInstanceInfos.getPartMetadataDocuments();
if (lPartMetadataDocuments.length === 0)
{
console.log('this part instance has no part metadata documents');
return;
}
// and we only care with the first document, but many documents may be attached
const lPartMetadata : Object = lPartMetadataDocuments[0].getDocumentContent();
// some fancy output
console.log(JSON.stringify(lPartMetadata));

// get the visibility info in order to get information about the `part instance`
if (lCurrentInstanceInfos.isDisplayable())
{
console.log('the last child of the part instance is displayable');
}
};

fetchIdCard();

Please make sure the destination browser supports promises before using async calls.
Data Retrievers

Enumeration Members

PI_AccessRestricted: 64

Tells that this node is protected by at least one extra tag and might not be visible to users granted with a required set of tags.

PI_AccessRestrictedPropagated: 128

Tells that this node has sub nodes whose access is restricted, so it might not be fully displayed.

PI_ConversionGeometryMissing: 2

Tells if at least one geometry was missing when the part instance was built (only for leaves).

PI_ConversionGeometryPropagated: 4

Tells if at least one leaf of this part instance had the PI_ConversionGeometryMissing flag (only for nodes).

PI_GeometryInstanceIdAndClassIdGroupedWithTolerance: 512

Tells that this part instance has a geometry instance id and a class id that was aggregated with another part instance with a tolerance (not a strict world matrix equality leaves).

Multiple part instances may have the same geometric instance id if they have the same geometric model and at the "same" location.

PI_InDynamicLD: 8192

Tells that this instance is partially represented in dynamic LD model.

PI_InStaticLD: 4096

Tells that this instance is partially represented in static LD model.

PI_InstantiationErrorLoopDetectedOrDepthLimitReached: 16

Tells that an instantiation loop (i.e. this part instance is a child, immediate or not of itself) was detected when this part instance was built.

PI_InstantiationErrorPartMalformed: 1024

Tells that at least one sub-node was ill-formatted during the instantiation.

PI_InstantiationErrorPartMissing: 8

Tells that at least one child (immediate or not) part instance (sub-part, leaf or node) was missing when this part instance was built.

PI_InstantiationErrorPropagated: 32

Tells that this part instance contains at least one child (immediate or not) that has the PI_InstantiationErrorPartMissing or PI_InstantiationErrorLoopDetectedOrDepthLimitReached flag.