Interface OOBBTypeAttachment

The OOBBTypeAttachment interface defines an OOBB result of a call to FeatureManagerInterface.retrieveOOBB.

This interface defines the resulting OOBB, and references the OOBB request id returned by FeatureManagerInterface.retrieveOOBB. Valid OOBB request ids are strictly positive integers.

It is included in the attachment of the FeatureManagerInterfaceSignal.OOBBReady signal event.

/** 
* Sample to illustrate the retrieval of the OOBB of a geometry.
*/
import { FeatureManagerInterface, FeatureManagerInterfaceSignal, InfiniteEngineInterface, InfiniteEvent, OOBB, OOBBTypeAttachment } from 'generated_files/documentation/appinfiniteapi';

// created previously
let lInfiniteEngine : InfiniteEngineInterface;

// the geometric instance to retrieve OOBB from
let lGeometricInstanceId : number;

// retrieve the `feature` manager
const lFeatureManager : FeatureManagerInterface = lInfiniteEngine.getFeatureManager();
// the OOBB request id
let lRetrieveOobbRequestId : number = 0;

// the resulting OOBB
let lOobbResult : OOBB | undefined = undefined;

// the callback called when a OOBB result is ready
const onOobbRetrieved = (pEvent: InfiniteEvent) : void =>
{
const lOOBBAttachment : OOBBTypeAttachment | undefined = pEvent.attachments;
// is this event valid ?
if(lOOBBAttachment === undefined || lOOBBAttachment.oobb === undefined)
{
console.log('invalid oobb attachment');
return;
}
// is this the correct request ?
if(lOOBBAttachment.oobbRequestId !== lRetrieveOobbRequestId)
{
//
return;
}
// finally, we made it !
lOobbResult = lOOBBAttachment.oobb;
console.log('Found oobb', JSON.stringify(lOobbResult));
const lApplicationId : number = lFeatureManager.createOOBBApplicationFeature(lOobbResult);
if(lApplicationId <= 0)
{
console.log('feature creation failed');
}
};

// register our callback
lFeatureManager.addEventListener(FeatureManagerInterfaceSignal.OOBBReady, onOobbRetrieved);

// and request an oobb
lRetrieveOobbRequestId = lFeatureManager.retrieveOOBB(lGeometricInstanceId);
if(lRetrieveOobbRequestId <= 0)
{
console.log('Failed to query oobb, is the geometric instance id correct ?');
}

Features

interface OOBBTypeAttachment {
    oobb?: OOBB;
    oobbRequestId: number;
}

Properties

Properties

oobb?: OOBB

The OOBB result.

oobbRequestId: number

The oobb request id, i.e. the number returned by FeatureManagerInterface.retrieveOOBB.