Interface ChildrenPartInstanceInfoInterface

The ChildrenPartInstanceInfoInterface interface is used to store properties about the children of a part instance.

The ChildrenPartInstanceInfoInterface is retrieved when using a retrieveChildrenIdCard.

The interface provides information about

The following code snippet allows to get the metadata of the children part instances by the ChildrenIdCardGetterInterface. Such a code may be triggered while receiving the IdCardReady of the ChildrenIdCardGetterInterface.

/** 
* Sample to illustrate the use of an ChildrenIdCardGetterInterface with the parsing of
* PartInstanceInfoInterface to display some information about a part instance.
*/
import {
VisibilityContextInterface, ChildrenIdCardGetterInterface, ChildrenIdCardGetterInterfaceSignal,
InfiniteEvent, ChildrenPartInstanceInfoInterface, PartInstanceInfoStatusFlag, DataSessionInterface
} from 'generated/documentation/appinfiniteapi';

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

// create an ChildrenIdCardGetter
const lChildrenIdCardGetterInterface : ChildrenIdCardGetterInterface = lDataSession.createChildrenIdCardGetter();
// what to do when result is ready ?
lChildrenIdCardGetterInterface.addEventListener(ChildrenIdCardGetterInterfaceSignal.ChildrenIdCardReady, onChildrenIdCardReady);

// onChildrenIdCardReady will be called when data is available
onChildrenIdCardReady = (_pEvent: InfiniteEvent, _pCallbackData: Object | undefined) : void =>
{
if (lChildrenIdCardGetterInterface.getLastError().length !== 0) {
// do nothing in case of error
// perhaps some GUI code ?
}
const lPartInstanceInfos : Array<ChildrenPartInstanceInfoInterface> | undefined = lChildrenIdCardGetterInterface.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 lCurrentChildren : ChildrenPartInstanceInfoInterface = lPartInstanceInfos[0];

// number of items
const lNbChildren : number = lCurrentChildren.getChildren().length;
if (lNbChildren <= 0)
{
console.log('this part instance is a leaf');
return;
}
// take the last child
const lChildInstanceOffset : number = lNbChildren - 1;
// we get the `part` metadata of the last child of the `part instance`
const lPartMetadata : Object = lCurrentChildren.getChildrenIdCard().partmd[lChildInstanceOffset];
// some fancy output
console.log(JSON.stringify(lPartMetadata));

// get the flags in order to get information about the `part instance`
const lFlags : number = lCurrentChildren.getChildrenStatusFlags()[lChildInstanceOffset];
if ((lFlags & PartInstanceInfoStatusFlag.PI_Displayable) !== 0)
{
console.log('the last child of the part instance is displayable')
}
}

// trigger the retrieval
lChildrenIdCardGetterInterface.retrieveChildrenIdCard(lPartInstanceId, lVisibilityContext);

or with async calls :
/** 
* Sample to illustrate the asynchronous use of an ChildrenIdCardGetterInterface with the parsing of
* PartInstanceInfoInterface to display some information about a part instance.
*/
import {
VisibilityContextInterface, ChildrenIdCardGetterInterface, AsyncChildrenPartInstanceInfoResult,
ChildrenPartInstanceInfoInterface, PartInstanceInfoStatusFlag, AsyncResultReason, DataSessionInterface
} from 'generated/documentation/appinfiniteapi';

// the DataSessionInterface has been created previously and is connected
let lDataSession : DataSessionInterface;
// created previously
let lVisibilityContext : VisibilityContextInterface;
// the `part instance id` to get
let lPartInstanceId : number;

// create an ChildrenIdCardGetter
const lChildrenIdCardGetterInterface : ChildrenIdCardGetterInterface = lDataSession.createChildrenIdCardGetter();

const retrieveIdCard = async () : Promise<any> =>
{
// trigger the retrieval
const lResult : AsyncChildrenPartInstanceInfoResult = await lChildrenIdCardGetterInterface.asyncRetrieveChildrenIdCard(lPartInstanceId, lVisibilityContext);

if (lResult.reason !== AsyncResultReason.ARR_Success || lResult.value === undefined)
{
// do nothing in case of error
// perhaps some GUI code ?
return;
}
const lPartInstanceInfos : Array<ChildrenPartInstanceInfoInterface> = lResult.value;
// 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 lCurrentChildren : ChildrenPartInstanceInfoInterface = lPartInstanceInfos[0];

// number of items
const lNbChildren : number = lCurrentChildren.getChildren().length;
if (lNbChildren <= 0)
{
console.log('this part instance is a leaf');
return;
}
// take the last child
const lChildInstanceOffset : number = lNbChildren - 1;
// we get the `part` metadata of the last child of the `part instance`
const lPartMetadata : Object = lCurrentChildren.getChildrenIdCard().partmd[lChildInstanceOffset];
// some fancy output
console.log(JSON.stringify(lPartMetadata));

// get the flags in order to get information about the `part instance`
const lFlags : number = lCurrentChildren.getChildrenStatusFlags()[lChildInstanceOffset];
if ((lFlags & PartInstanceInfoStatusFlag.PI_Displayable) !== 0)
{
console.log('the last child of the part instance is displayable')
}
}

retrieveIdCard();

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

See

Hierarchy

  • ChildrenPartInstanceInfoInterface

Methods

  • Tells if the children of this part instance are leaves.

    DO NOT modify in place this array, this results in undefined behavior.

    Returns

    const
    The array of children leaf information.

    Returns boolean[]

  • Gets the Axis Aligned Bounding Box of the part instance this object refers to.

    DO NOT modify in place this object, this results in undefined behavior.

    Returns

    const
    The Axis Aligned BoundingBox of this part instance.

    See

    AABB

    Returns AABB

  • Gets the list of the annotation views properties of the children of this part instance.

    This gets an array of array of AnnotationViewInfoInterface.

    DO NOT modify in place this array, this results in undefined behavior.

    Returns

    const
    The list of annotation views properties of the children of this part instance.

    See

    AnnotationViewInfoInterface

    Returns AnnotationViewInfoInterface[][]

  • Gets the list of the attached documents of the children of this part instance.

    This gets an array of array of AttachedDocumentInfoInterface.

    DO NOT modify in place this array, this results in undefined behavior.

    Returns

    const
    The list of attached documents properties of the children of this part instance.

    See

    AttachedDocumentInfoInterface

    Returns AttachedDocumentInfoInterface[][]

  • Gets the part instance ids of the children of this part instance.

    DO NOT modify in place this array, this results in undefined behavior.

    Returns

    const
    The array of children part instance ids.

    Returns number[]

  • Gets the part instance class ids of the children of this part instance.

    DO NOT modify in place this array, this results in undefined behavior.

    Returns

    const
    The array of children part instance class ids.

    Returns number[]

  • Gets the status flags of the children of this part instance.

    The status flags are the OR of PartInstanceInfoStatusFlag.

    DO NOT modify in place this array, this results in undefined behavior.

    Returns

    const
    The array of children status flags of this part instance.

    See

    PartInstanceInfoStatusFlag

    Returns number[]

  • Gets the square of the diagonal of the Oriented Bounding Box of this part instance.

    Returns

    The square of the diagonal of the Oriented Bounding Box of this part instance.

    Returns number

  • Gets the maximum part instance id of the leaves that represent the node/leaf part instance for the full children list.

    DO NOT modify in place this array, this results in undefined behavior.

    The ith children part instance is therefore represented by the leaves part instances :

    getSubLeafMinimums()[i], getSubLeafMinimums()[i] + 1, getSubLeafMinimums()[i] + 2, ..., getSubLeafMaximums()[i].

    Returns

    const
    The maximum part instance leaf of all the children.

    Returns number[]

  • Gets the minimum part instance id of the leaves that represent the node/leaf part instance for the full children list.

    DO NOT modify in place this array, this results in undefined behavior.

    The ith children part instance is therefore represented by the leaves part instances :

    getSubLeafMinimums()[i], getSubLeafMinimums()[i] + 1, getSubLeafMinimums()[i] + 2, ..., getSubLeafMaximums()[i].

    Returns

    const
    The minimum part instance leaf of all the children.

    Returns number[]

  • Gets the world transformations of the children of this part instance.

    The Matrix4 follows the column multiplication convention (see Matrix4).

    DO NOT modify in place this array, this results in undefined behavior.

    Returns

    const
    The list of Matrix4 of the children of this part instance.

    See

    Matrix4

    Returns Matrix4[]

  • Tells if this part instance is a leaf, which means it has no child (in this case, arrays from getChildrenIdCard, getWorldXForms etc are empty).

    Returns

    true if the part instance this object refers to is a leaf.

    Returns boolean