Adds a listener to an event type.
When an event of the type pType fires, the callback pListener will be called. This function
returns a unique string id that may be used in removeEventListenerById to allow simple
listener removal.
It is possible to add an object that will be included in the callback to avoid creating too many closures.
Calling twice addEventListener with the same parameters results in the second call to be ignored,
only unique pairs callback / object are allowed, in order to avoid calling multiple times the same
thing.
The id of the inserted callback (actually an UUID).
Adds a listener to an event type.
When an event of the type pType fires, the callback pListener will be called. This function
returns a unique string id that may be used in removeEventListenerById to allow simple
listener removal.
The id of the inserted callback (actually an UUID).
Asynchronously requests the computation of the measurement between the two given features.
Multiple types of measurements may be done between two features, thus, pMeasurementType
tells how the computation should be performed.
Returns a promise.
A promise. The promise is resolved with the reason (success, cancelled, disposed, bad input). In case of success, the promise contains the measurement result.
Asynchronously tells if the given geometry has features if a given types (circle, lines or both).
It is merely a wrap around asyncRetrieveFeaturesInfo.
It may take time to get the result of the promise since this promise may need to download the 3D HD data of the given geometry if it was not loaded.
Requesting pFeatureType with FeatureVisibilityMode.FVM_None will always return false.
A promise. The promise is resolved with the result of the call.
Asynchronously retrieves features information of a given geometry.
It may take time to get the result of the promise since this promise may need to download the 3D HD data of the given geometry if it was not loaded.
A promise. The promise is resolved with the result of the call.
Asynchronously requests the computation of the OOBB of the given geometric instance.
Returns a promise.
A promise. The promise is resolved with the reason (success, cancelled, disposed, bad input). In case of success, the promise contains the OOBB result.
Requests the computation of the measurement between the two given features.
Multiple types of measurements may be done between two features, thus, pMeasurementType
tells how the computation should be performed.
If successful, the call returns the id of the measurement (that is the MeasurementTypeAttachment.measurementRequestId of the FeatureManagerInterfaceSignal.MeasurementReady). Returns 0 in case of failure. Valid measurement request ids are strictly positive integers.
A non zero number in case of success, 0 is case of failure.
Creates a feature to be displayed from a previously created feature.
This call mainly allows to create application features from the features of a geometric instance id.
Returns 0 if the call failed.
Valid application feature ids are strictly positive integers.
/**
* Sample to illustrate the creation and display of a `feature` from a pick result.
*/
import {
FeatureItem, FeatureManagerInterface, InfiniteEngineInterface, InfiniteEngineInterfaceSignal,
InfiniteEvent, PickingAttachment, PickingFeatureAttachmentItem, Vector3
} from 'generated_files/documentation/appinfiniteapi';
// created previously
let lInfiniteEngine : InfiniteEngineInterface;
// retrieve the `feature` manager
const lFeatureManager : FeatureManagerInterface = lInfiniteEngine.getFeatureManager();
// We pick a rectangle if big enough, else only a point
const startPicking = (pEvent : MouseEvent): void =>
{
// pick the last point
lInfiniteEngine.pickAt(pEvent.offsetX, pEvent.offsetY, false);
};
const lView : HTMLElement | undefined = lInfiniteEngine.getView();
if(lView)
{
// on left click => pick
lView.addEventListener('click', startPicking);
}
else
{
console.log('Cannot register pick since no 3d view is available');
}
// What to do on pick ?
const onPicking = (pEvent : InfiniteEvent, _pCallbackData) : void =>
{
const lAttachment: PickingAttachment = <PickingAttachment>pEvent.attachments;
// care only about 3d geometries (no line, point, box)
const lFeaturesAttachment: PickingFeatureAttachmentItem[] | undefined = lAttachment.features;
if (lFeaturesAttachment === undefined || lFeaturesAttachment.length === 0)
{
return;
}
const lFeature : FeatureItem = lFeaturesAttachment[0].feature;
const lPickedPosition : Vector3 = lFeaturesAttachment[0].position;
console.log('3d picked position is', JSON.stringify(lPickedPosition));
const lFeaturePointApplicationId : number = lFeatureManager.createApplicationFeatureFromFeature(
lFeature
);
if(lFeaturePointApplicationId <= 0)
{
console.log('feature creation failed');
}
};
// and bind the callback on pick result
lInfiniteEngine.addEventListener(InfiniteEngineInterfaceSignal.Picked, onPicking);
The application id for such a feature, or 0 if the call failed.
Creates an arc of circle feature.
Returns 0 if the call failed.
Valid application feature ids are strictly positive integers.
An arc of circle is composed of a center, a radius (in DMU units, {DataSessionInterface.getDmuBuildUnit}), a normal of the circle, the start vector, and an angle in radian such that :
A full circle will therefore have pAngleInRadian equal to 2 * Math.PI.
Returns 0 if the call failed.
Valid application feature ids are strictly positive integers.
Optional pStartDirection: Vector3Optional pAngleInRadian: numberThe application id for such a feature, or 0 if the call failed.
Creates an OOBB feature from the given OOBB.
Returns 0 if the call failed.
Valid application feature ids are strictly positive integers.
The application id for such a feature, or 0 if the call failed.
Creates a point feature at the given location.
Returns 0 if the call failed.
Valid application feature ids are strictly positive integers.
The application id for such a feature, or 0 if the call failed.
Sets the content of the FeatureManagerInterface from a former call to toJSON.
Feature parameters may be streamed, using the following schema :
{
"$defs": {
"arc": {
"additionalProperties": false,
"properties": {
"angle": {
"exclusiveMaximum": 6.2832,
"minimum": 0,
"type": "number"
},
"center": {
"$ref": "#/$defs/vec3"
},
"id": {
"description": "A strictly positive integer",
"example": 3,
"minimum": 1,
"type": "integer"
},
"normal": {
"$ref": "#/$defs/vec3"
},
"radius": {
"minimum": 0,
"type": "number"
},
"startdirection": {
"$ref": "#/$defs/vec3"
},
"visible": {
"default": true,
"example": true,
"type": "boolean"
}
},
"required": [
"id",
"visible",
"center",
"normal",
"startdirection",
"radius",
"angle"
],
"title": "Arc of circle definition",
"type": "object"
},
"boxItem": {
"additionalProperties": false,
"properties": {
"box": {
"$ref": "#/$defs/oobb"
},
"id": {
"description": "A strictly positive integer",
"example": 3,
"minimum": 1,
"type": "integer"
},
"visible": {
"default": true,
"example": true,
"type": "boolean"
}
},
"required": [
"id",
"visible",
"box"
],
"title": "OOBB definition",
"type": "object"
},
"features": {
"additionalProperties": false,
"properties": {
"arcs": {
"items": {
"$ref": "#/$defs/arc"
},
"type": "array"
},
"boxes": {
"items": {
"$ref": "#/$defs/boxItem"
},
"type": "array"
},
"lines": {
"items": {
"$ref": "#/$defs/line"
},
"type": "array"
},
"points": {
"items": {
"$ref": "#/$defs/point"
},
"type": "array"
},
"type": {
"const": "features",
"type": "string"
},
"version": {
"description": "Define the version of the object",
"example": 1,
"type": "integer"
}
},
"required": [
"type"
],
"title": "Features definition",
"type": "object"
},
"line": {
"additionalProperties": false,
"properties": {
"id": {
"description": "A strictly positive integer",
"example": 3,
"minimum": 1,
"type": "integer"
},
"pointA": {
"$ref": "#/$defs/vec3"
},
"pointB": {
"$ref": "#/$defs/vec3"
},
"visible": {
"default": true,
"example": true,
"type": "boolean"
}
},
"required": [
"id",
"visible",
"pointA",
"pointB"
],
"title": "Line definition",
"type": "object"
},
"oobb": {
"additionalProperties": false,
"description": "Defines the values of a Object oriented Bounding Box",
"properties": {
"center": {
"$ref": "#/$defs/vec3"
},
"halfextent": {
"$ref": "#/$defs/vec3extent"
},
"xaxis": {
"$ref": "#/$defs/vec3"
},
"yaxis": {
"$ref": "#/$defs/vec3"
},
"zaxis": {
"$ref": "#/$defs/vec3"
}
},
"required": [
"center",
"halfextent",
"xaxis",
"yaxis",
"zaxis"
],
"title": "OOBB definition",
"type": "object"
},
"point": {
"additionalProperties": false,
"properties": {
"id": {
"description": "A strictly positive integer",
"example": 3,
"minimum": 1,
"type": "integer"
},
"point": {
"$ref": "#/$defs/vec3"
},
"visible": {
"default": true,
"example": true,
"type": "boolean"
}
},
"required": [
"id",
"visible",
"point"
],
"title": "Point definition",
"type": "object"
},
"vec3": {
"description": "Define the coordinates [x,y,z] of a point / vector",
"items": {
"type": "number"
},
"maxItems": 3,
"minItems": 3,
"title": "3D Vector definition",
"type": "array"
},
"vec3extent": {
"description": "Define the coordinates [x,y,z] of an extent vector",
"items": {
"minimum": 0,
"type": "number"
},
"maxItems": 3,
"minItems": 3,
"title": "3D Vector extent definition",
"type": "array"
}
},
"$ref": "#/$defs/features",
"$schema": "https://json-schema.org/draft-07/schema#"
}
true if the data is set.
Gets the type of an application feature.
The actual type of the application feature if it exists, FeatureType.FT_None else.
Gets the arc of circle parameters of an arc of circle application feature.
Returns false if the call failed.
Valid application feature ids are strictly positive integers.
This call retrieves the value set by a previous call to createCircularArcApplicationFeature.
true if pApplicationFeatureId refers to a valid arc of circle feature.
Gets the current "visibility mode" of the rendering of the features of geometric instance ids.
The visibility mode may be off (FeatureVisibilityMode.FVM_None), showing
circular features (FeatureVisibilityMode.FVM_ArcOfCircle), showing
line features (FeatureVisibilityMode.FVM_Line),
showing all types
(FeatureVisibilityMode.FVM_All).
The FeatureVisibilityMode enum is a bit field, meaning that to display line data and circular features,
use FeatureVisibilityMode.FVM_ArcOfCircle | FeatureVisibilityMode.FVM_Line.
Note: setGeometricInstancesFeaturesVisible is independent from setGeometricInstancesFeaturesTypesVisibility
which means that a geometric feature is visible if both statements are true:
true.feature.Returns the current FeatureVisibilityMode.
The default FeatureVisibilityMode is FeatureVisibilityMode.FVM_All.
The current feature visibility mode.
Gets the point locations of a line application feature.
Returns false if the call failed.
Valid application feature ids are strictly positive integers.
This call retrieves the value set by a previous call to createLineApplicationFeature.
true if pApplicationFeatureId refers to a valid line feature.
Gets the OOBB parameters of an OOBB application feature.
Returns false if the call failed.
Valid application feature ids are strictly positive integers.
This call retrieves the value set by a previous call to createOOBBApplicationFeature.
true if pApplicationFeatureId refers to a valid OOBB feature.
Gets the point location of a point application feature.
Returns false if the call failed.
Valid application feature ids are strictly positive integers.
This call retrieves the value set by a previous call to createPointApplicationFeature.
true if pApplicationFeatureId refers to a valid point feature.
Tells if the EventDispatcher has such a callback registered for the given event type.
true if such a listener is installed for the given type of event.
Tells if the features of the given geometric instance are visible.
Note: isGeometricInstanceFeaturesVisible is independent from setGeometricInstancesFeaturesTypesVisibility
which means that a geometric feature is visible if both statements are true:
true.feature.true if the given features are visible.
Removes all application features.
This call removes all features created by createApplicationFeatureFromFeature,
createPointApplicationFeature, createLineApplicationFeature, createCircularArcApplicationFeature,
createOOBBApplicationFeature.
Removes an application feature.
This call removes features created by createApplicationFeatureFromFeature,
createPointApplicationFeature, createLineApplicationFeature, createCircularArcApplicationFeature.
trueif the application feature was removed.
Removes some application features.
This call removes features created by createApplicationFeatureFromFeature,
createPointApplicationFeature, createLineApplicationFeature, createCircularArcApplicationFeature,
createOOBBApplicationFeature.
trueif at least one application feature was removed.
Removes a listener from an event type.
If no such listener is found, then the function returns false and does nothing. You must use the exact parameters that were used in addEventListener to actually remove the listener.
The listener function that gets removed.
The listener object that was used when addEventListener was called.
true if the callback was removed else false.
Removes a listener from an event type.
If no such listener is found, then the function returns false and does nothing. You must use the exact parameters that were used in addEventListener to actually remove the listener.
The listener function that gets removed.
true if the callback was removed else false.
Removes a listener by its id.
If no such listener is found, then the function returns false and does nothing. You must use the return value of addEventListener to actually remove the listener.
true if the callback was removed else false.
Asks if the given geometry has features.
Returns an feature info request id (0 in case of error).
Valid feature info request ids are strictly positive integers.
A strictly positive integer in case of success, 0 is case of failure.
Asks for the computation of the OOBB (Object oriented bounding box) of the given geometry.
Returns an OOBB request id (0 in case of error).
Valid OOBB request ids are strictly positive integers.
A strictly positive integer in case of success, 0 is case of failure.
Sets the visibility state of an application features.
Returns true if pApplicationFeatureId is a valid application feature id, but this call still returns true if the visibility status for the
given feature has not changed.
true if pApplicationFeatureId is a valid application feature id.
Sets the visibility state of a list of application features.
Returns true if at least one application feature id is valid, but this call still returns true if the visibility status for the
given features has not changed.
true if at least one application feature id is valid.
Sets the visibility state of the features of a geometric instance id.
Returns true if the call succeeded.
Note: setGeometricInstanceFeaturesVisible is independent from setGeometricInstancesFeaturesTypesVisibility
which means that a geometric feature is visible if both statements are true:
true.feature.
Note (bis): Setting features visible will not guarantee that the features will be visible at a current time. Indeed, features are
loaded (and displayed) if the 3D HD data of the given geometry is loaded. It may also happen that the given geometry has no feature,
and this call, even if successful, does not imply that anything will be drawn.true if the call succeeded.
Sets the "visibility mode" of the rendering of all the features of all geometric instance ids.
The visibility mode may be off (FeatureVisibilityMode.FVM_None), showing
circular features (FeatureVisibilityMode.FVM_ArcOfCircle), showing
line features (FeatureVisibilityMode.FVM_Line),
showing all types
(FeatureVisibilityMode.FVM_All).
The default FeatureVisibilityMode is FeatureVisibilityMode.FVM_All.
The FeatureVisibilityMode enum is a bit field, meaning that to display line data and circular features,
use FeatureVisibilityMode.FVM_ArcOfCircle | FeatureVisibilityMode.FVM_Line.
This call does not affect application created features, only features inside geometric instances.
Note: setGeometricInstancesFeaturesVisible is independent from setGeometricInstancesFeaturesTypesVisibility
which means that a geometric feature is visible if both statements are true:
true.feature.Returns true if pVisibilityMode is a valid FeatureVisibilityMode.
true if the call succeeded.
Sets the visibility state of the features of a list of geometric instance ids.
Returns true if the call succeeded, but this call still returns true if the visibility status for the
given features has not changed.
Note: setGeometricInstancesFeaturesVisible is independent from setGeometricInstancesFeaturesTypesVisibility
which means that a geometric feature is visible if both statements are true:
true.feature.
Note (bis): Setting features visible will not guarantee that the features will be visible at a current time. Indeed, features are
loaded (and displayed) if the 3D HD data of the given geometry is loaded. It may also happen that the given geometry has no feature,
and this call, even if successful, does not imply that anything will be drawn.true if the call succeeded.
Gets a deep copy of the application features of the FeatureManagerInterface.
Please refer to JSON.stringify.
Optional pKey: anyThe internal application features data.
The FeatureManagerInterface interface is the central point used to display
featuresof 3D geometries, create customfeatures, retrieve Object Oriented Bounding Boxes of geometries and perform measurements betweenfeatures.Warning: if migrated from an old evojuump,
featuresmay not be available in the given DMU, sincefeatureshave been added since the 4.1 version of the 3djuump architecture.Featuresconsist in lines, circles and patch borders (created with a given CAD model designing tool). The patch borders may be displayed with InfiniteEngineInterface.enablePatchBorders or InfiniteEngineInterface.setPatchBordersEnabled.The FeatureManagerInterface is obtained through the InfiniteEngineInterface.getFeatureManager.
Display
featuresof 3D geometriesFeatures of specific
geometric instancesmay be displayed (FeatureManagerInterface.setGeometricInstancesFeaturesVisible, FeatureManagerInterface.setGeometricInstanceFeaturesVisible) and then are available in picking requests. Line and arc of circles inside the given 3D geometries will then be displayed, and all lines /arc of circle rendering are also conditioned to the value of the given FeatureVisibilityMode.Featuresrendering modes are modified and retrieved with FeatureManagerInterface.setGeometricInstancesFeaturesTypesVisibility and FeatureManagerInterface.getGeometricInstancesFeaturesTypesVisibility.This may be :
featuresvisible : FeatureVisibilityMode.FVM_All.featuresvisible : FeatureVisibilityMode.FVM_ArcOfCircle.featuresvisible : FeatureVisibilityMode.FVM_Line.featuresvisible: FeatureVisibilityMode.FVM_None.This enum is a bit field, meaning that to display line data and circular
features, use FeatureVisibilityMode.FVM_ArcOfCircle | FeatureVisibilityMode.FVM_Line.The default FeatureVisibilityMode is FeatureVisibilityMode.FVM_All.
Showing feature elements may be done through the following:
Displayed `features` are `hover-able` and the FeatureManagerInterfaceSignal.FeatureHoverChanged is sent whenever a `feature` under the cursor changes.
Custom
FeaturecreationMultiple
featuresmay be created and displayed. Arcs of circle, lines, points and OOBBs may be created and displayed.Featuresmust be register onto the FeatureManagerInterface and are assigned a unique strictly positive integer (an id).Featuresmay be created by createApplicationFeatureFromFeature, and made visible / hidden with setApplicationFeaturesVisible.Featuresmay be removed with removeApplicationFeature, removeApplicationFeatures and removeAllApplicationFeatures.Featuresare composed of a type (FeatureItem.type, FeatureType) and data that is dependent on the type of thefeature.Arcs of circle (FeatureType.FT_ArcOfCircle)
A full circle
featureis represented with a center, a normal, and a radius. If added with an optional starting direction and an angle, thefeaturewill represent only a part of a circle (arc of circle). The arc of circle is represented by the point positioned P0 = Center + radius * startDirection. Then compute the point P1 which is the rotation of P0 of the given angle from Center along the axis Normal. Positive angles between P0 and P1 are the points that belong to the arc of circle. Negative angles are set to 0 (thus a point). Angles superior to2 * PIare cropped to2 * PI.Arcs of circle are created through createCircularArcApplicationFeature.
Lines (FeatureType.FT_Line)
Lines are represented by two points (Vector3).
Lines are created through createLineApplicationFeature.
Points (FeatureType.FT_Point)
Points are represented by a lone Vector3.
Points are created through createPointApplicationFeature.
OOBBs (FeatureType.FT_OOBB)
Object Oriented Bounding Boxes (OOBB) are similar to Axis Aligned Bounding Boxes (AABB) but with 3 axes that may not be axis aligned. OOBB are a lot more precise that AABB.
OOBBs can be displayed with createOOBBApplicationFeature.
Object Oriented Bounding Boxes retrieval
Object Oriented Bounding Boxes (OOBB are similar to Axis Aligned Bounding Boxes (AABB) but with 3 axes that may not be axis aligned. The OOBB are a lot more precise that AABB. The OOBB retrieval is asynchronous, each request is assigned an integer id (a strictly positive integer) while calling retrieveOOBB. The FeatureManagerInterfaceSignal.OOBBReady signal is triggered when a request has completed.
Measurements
Minimal distance between
featurescan be computed. A distance computation consists in two contact points, one for eachfeature. 2 more features, that cannot be displayed are used for performing computations. A measure is computed between two features, and amodifieris used to accurately define the measurement between the 2features. The modifier is of the type MeasurementType. This allows to tell if the measurement should be processed from all the points of afeatureor only the center of it (you may for example perform a measurement between the center of 2 geometries, more on this later).Geometry
features(FeatureType.FT_Geometry)A geometry
featureis a feature that contains a geometric instance id. Distance between geometries can be processed with geometry features. Geometryfeaturescannot be displayed since geometries are already displayed :).Plane
features(FeatureType.FT_Plane)A plane
featureis a feature that contains a position and a normal. Planefeaturescannot be displayed.See
OOBB