TopologyAPI¶
Interface TopologyAPI
addTopologyToSelection(
handle: TopologyHandle | TopologyHandle[],
): Promise<void>;
clearTopologySelection(): Promise<void>;
createCircularArcDescriptor(
point0: [number, number, number],
point1: [number, number, number],
point2: [number, number, number],
): { descriptor: TopologyCircularArcDescriptor; type: CIRCULAR_ARC };
createPointDescriptor(
point: [number, number, number],
): { descriptor: TopologyPointDescriptor; type: POINT };
getSelectedTopologyHandles(): TopologyHandle[];
getShapeHandle(handle: TopologyHandle): TopologyHandle;
getTopologyType(handle: TopologyHandle): TopologyType;
isTopologySelected(handle: TopologyHandle): boolean;
mapInternalToOriginalTopologyHandles(
handles: TopologyHandle[],
): Promise<OriginalTopologyHandle[]>;
mapOriginalToInternalTopologyHandles(
nodeID: number,
handles: OriginalTopologyHandle[],
): Promise<TopologyHandle[]>;
removeTopologyFromSelection(
handle: TopologyHandle | TopologyHandle[],
): Promise<void>;
requestBoxDescriptor(
nodeIds: number[],
): Promise<{ descriptor: TopologyBoxDescriptor; type: BOX }>;
requestNeighboringEdges(handle: TopologyHandle): Promise<TopologyHandle[]>;
requestNeighboringFaces(handle: TopologyHandle): Promise<TopologyHandle[]>;
requestTopologyDescriptor(
handle: TopologyHandle,
): Promise<TopologyDescriptor>;
setTopologyProperty<T extends keyof TopologyPropertyTypeMap>(
handle: TopologyHandle | TopologyHandle[],
property: T,
value: TopologyPropertyTypeMap[T],
): Promise<PromiseSettledResult<void>[]>;
setTopologySelection(
handle: TopologyHandle | TopologyHandle[],
): Promise<void>;
}
Hierarchy (View Summary)
- TopologyAPI
Index
Methods
Methods
add Topology To Selection
- addTopologyToSelection(handle: TopologyHandle | TopologyHandle[]): Promise<void>
Adds one or more topological entities to the current selection.
Parameters
- handle: TopologyHandle | TopologyHandle[]
The topological entity or array of topological entities which should be added to the current selection.
Returns Promise<void>
A promise which resolves when the operation is completed.
- handle: TopologyHandle | TopologyHandle[]
clear Topology Selection
create Circular Arc Descriptor
- createCircularArcDescriptor(
point0: [number, number, number],
point1: [number, number, number],
point2: [number, number, number],
): { descriptor: TopologyCircularArcDescriptor; type: CIRCULAR_ARC } Creates a circular arc descriptor based on three points.
Parameters
- point0: [number, number, number]
The first point.
- point1: [number, number, number]
The second point.
- point2: [number, number, number]
The third point.
Returns { descriptor: TopologyCircularArcDescriptor; type: CIRCULAR_ARC }
A circular arc descriptor.
descriptor: TopologyCircularArcDescriptor
The attributes of the topological entity.
type: CIRCULAR_ARC
The subtype of the topological entity.
- point0: [number, number, number]
create Point Descriptor
- createPointDescriptor(
point: [number, number, number],
): { descriptor: TopologyPointDescriptor; type: POINT } Creates a point descriptor for the specified point.
Parameters
- point: [number, number, number]
The point.
Returns { descriptor: TopologyPointDescriptor; type: POINT }
A point descriptor.
descriptor: TopologyPointDescriptor
The attributes of the topological entity.
type: POINT
The subtype of the topological entity.
- point: [number, number, number]
get Selected Topology Handles
- getSelectedTopologyHandles(): TopologyHandle[]
Returns all selected topological entities.
Returns TopologyHandle[]
All selected topological entities.
get Shape Handle
- getShapeHandle(handle: TopologyHandle): TopologyHandle
Returns a handle for the shape that contains the given topological entity.
Parameters
- handle: TopologyHandle
The topology handle.
Returns TopologyHandle
A handle for the shape that contains the given topological entity.
- handle: TopologyHandle
get Topology Type
- getTopologyType(handle: TopologyHandle): TopologyType
Returns the type of the given topological entity.
Parameters
- handle: TopologyHandle
The topology handle.
Returns TopologyType
The type of the given topological entity.
- handle: TopologyHandle
is Topology Selected
- isTopologySelected(handle: TopologyHandle): boolean
Returns true if the specified topological entity is selected, false otherwise.
Parameters
- handle: TopologyHandle
The topology handle.
Returns boolean
True if the specified topological entity is selected, false otherwise.
- handle: TopologyHandle
map Internal To Original Topology Handles
- mapInternalToOriginalTopologyHandles(
handles: TopologyHandle[],
): Promise<OriginalTopologyHandle[]> Maps the given webvis topology handles to the corresponding original topology handles.
Parameters
- handles: TopologyHandle[]
The webvis topology handles to be mapped.
Returns Promise<OriginalTopologyHandle[]>
The corresponding original topology handles.
- handles: TopologyHandle[]
map Original To Internal Topology Handles
- mapOriginalToInternalTopologyHandles(
nodeID: number,
handles: OriginalTopologyHandle[],
): Promise<TopologyHandle[]> Maps the given original topology handles to the corresponding webvis topology handles.
Parameters
- nodeID: number
The node which represents the part that contains the topological entities.
- handles: OriginalTopologyHandle[]
The original topology handles to be mapped.
Returns Promise<TopologyHandle[]>
The corresponding webvis topology handles.
- nodeID: number
remove Topology From Selection
- removeTopologyFromSelection(
handle: TopologyHandle | TopologyHandle[],
): Promise<void> Removes one or more topological entities from the current selection.
Parameters
- handle: TopologyHandle | TopologyHandle[]
The topological entity or array of topological entities which should be removed from the current selection.
Returns Promise<void>
A promise which resolves when the operation is completed.
- handle: TopologyHandle | TopologyHandle[]
request Box Descriptor
- requestBoxDescriptor(
nodeIds: number[],
): Promise<{ descriptor: TopologyBoxDescriptor; type: BOX }> Returns a box descriptor for the combined bounding box of the specified nodes.
Parameters
- nodeIds: number[]
The nodes for which the box descriptor should be created.
Returns Promise<{ descriptor: TopologyBoxDescriptor; type: BOX }>
The box descriptor for the combined bounding box of the specified nodes.
- nodeIds: number[]
request Neighboring Edges
- requestNeighboringEdges(handle: TopologyHandle): Promise<TopologyHandle[]>
Returns the neighboring edges of the specified topological entity.
Parameters
- handle: TopologyHandle
The topological entity for which the neighboring edges should be requested.
Returns Promise<TopologyHandle[]>
The neighboring edges of the specified topological entity.
- handle: TopologyHandle
request Neighboring Faces
- requestNeighboringFaces(handle: TopologyHandle): Promise<TopologyHandle[]>
Returns the neighboring faces of the specified topological entity.
Parameters
- handle: TopologyHandle
The topological entity for which the neighboring faces should be requested.
Returns Promise<TopologyHandle[]>
The neighboring faces of the specified topological entity.
- handle: TopologyHandle
request Topology Descriptor
- requestTopologyDescriptor(handle: TopologyHandle): Promise<TopologyDescriptor>
Returns a detailed descriptor for the specified topological entity. The descriptor contains the subtype and an object with a series of known attributes of the topological entity. For example, a descriptor for a circle includes the center and radius of the circle.
Parameters
- handle: TopologyHandle
The topological entity.
Returns Promise<TopologyDescriptor>
A detailed descriptor for the specified topological entity.
- handle: TopologyHandle
set Topology Property
- setTopologyProperty<T extends keyof TopologyPropertyTypeMap>(
handle: TopologyHandle | TopologyHandle[],
property: T,
value: TopologyPropertyTypeMap[T],
): Promise<PromiseSettledResult<void>[]> Sets a property of one or more topological entities.
Type Parameters
- T extends keyof TopologyPropertyTypeMap
The property which should be set.
Parameters
- handle: TopologyHandle | TopologyHandle[]
The topological entity or array of topological entities which should be modified.
- property: T
The property which should be set.
- value: TopologyPropertyTypeMap[T]
The new value of the property.
Returns Promise<PromiseSettledResult<void>[]>
A promise which resolves when the operation is completed.
- T extends keyof TopologyPropertyTypeMap
set Topology Selection
- setTopologySelection(handle: TopologyHandle | TopologyHandle[]): Promise<void>
Sets the current selection to the specified topological entities.
Parameters
- handle: TopologyHandle | TopologyHandle[]
One or more topological entities that should be selected.
Returns Promise<void>
A promise which resolves when the operation is completed.
- handle: TopologyHandle | TopologyHandle[]
TopologyAPI
Overview
The TopologyAPI provides access to low-level topological entities within a 3D model. A topological entity can be a point, some kind of edge or face, or a shape that groups several of these entities together.
A topological entity is usually represented by a TopologyHandle. Each topological entity has a general type and a more specific subtype.
Given a TopologyHandle, a more detailed descriptor can be requested via the requestTopologyDescriptor function. This descriptor contains the subtype and an object with a series of known attributes of the topological entity. For example, a descriptor for a circle includes the center and radius of the circle.
Quick Start
A topology handle can be obtained via mapOriginalToInternalTopologyHandles by providing the identifier of the entity in the original CAD file.
Alternatively, you can use a click event listener to obtain a handle for the topological entity under the mouse cursor:
Combination With Other APIs
When the viewer interaction level is set to TOPOLOGY via the function ViewerInteractionAPI.setInteractionLevel, webvis will emit TopologyPointerEnterEvents and TopologyPointerOutEvents when the mouse cursor enters or leaves a topological entity:
As demonstrated in the example above, you can use the function ViewerHighlightAPI.highlightEntity to highlight a topological entity.
In addition to that, the MeasurementAPI can be used to perform different kinds of measurements with topological entities. Examples include distance, angle, and thickness measurements, as well as tangent calculations.