Clip planes are used to visually cut through 3D models by defining a separating plane
that hides geometry on one side. This makes it possible to examine internal structures
and cross-sections of models that would otherwise be hidden.
A clip room consists of six orthogonal planes forming a box that clips any geometry
outside of it, useful for focusing on specific regions of interest.
Key Features
Creating individual clip planes with specific orientation and position
Creating clip rooms (box-shaped clipping volumes)
Positioning clip planes relative to selected components
Enabling/disabling clip planes
Creating capping geometry to visualize cut surfaces
Configuring which nodes are affected by clipping
Quick Start
// Get the webvis contextconstcontext = webvis.getContext();// Create a basic clip planeconstclipPlaneId = context.createClipPlane({normal: [0, 0, 1], // Z-axis normal (up)position: [0, 0, 0] // Passing through origin});// Create a clip room around selected nodesconstselectedNodes = context.getSelectedNodes();context.clipOtherParts(selectedNodes);// Create and visualize a cut surfaceawaitcontext.createCapping(clipPlaneId);
Changes one or more properties of an existing clip room.
Allows modifying various aspects of the clip room such as size, position,
orientation (via transform matrix), visibility, and enabled state. Only the properties
specified in the properties object will be changed.
Since WebVis only supports a single clip room at a time, there's no need to specify
a clip room ID. If no clip room exists when this method is called, it will create one.
// Get the webvis contextconstcontext = webvis.getContext();// Change the size and position of a clip roomconstupdatedProps = context.changeClippingRoom({size: [20, 15, 10], // Resize the clip roomtransform: [ // Move to new position with rotation1, 0, 0, 0,0, 1, 0, 0,0, 0, 1, 0,5, 2, 3, 1// Translation component ],invisible:true// Hide the visual representation});// Disable the clip room temporarily without removing itcontext.changeClippingRoom({enabled:false});
Changes one or more properties of an existing clip plane .
Allows modifying various aspects of a clip plane such as orientation, position,
visibility, and selection of which nodes are affected. Only the properties
specified in the properties object will be changed.
// Get the webvis contextconstcontext = webvis.getContext();// Change the position and orientation of a clip planeconstupdatedProps = context.changeClipPlane(clipPlaneId, {normal: [0, 1, 0], // Update to Y-axis normalposition: [0, 0, 5], // Move to new positioninvisible:true// Hide the visual plane representation});// Exclude certain components from being clippedcontext.changeClipPlane(clipPlaneId, {excludedNodes: [1234, 5678] // These nodes won't be affected by the clip plane});
Creates a clip room that encompasses the selected node(s).
This method automatically calculates a bounding box around the specified target
node(s) and creates a clip room with the exact dimensions of that box. It's an
easy way to isolate specific components for closer examination by clipping away
all surrounding geometry.
The created clip room replaces any existing clip room .
Example usage:
// Get the webvis contextconstcontext = webvis.getContext();// Create a clip room around a single componentcontext.clipOtherParts(4567);// Create a clip room around multiple componentscontext.clipOtherParts([1234, 5678, 9012]);// Create a clip room around the currently selected componentsconstselectedNodes = context.getSelectedNodes();if (selectedNodes.length > 0) {context.clipOtherParts(selectedNodes);}
Parameters
target: number|number[]
ID or array of IDs of the nodes to create a clip room around
Returns void
createCapping
createCapping(clipPlaneId:number):Promise<void>
Experimental
Generates capping geometry for the surface that is cut by a clip plane.
This method creates visible geometry at the intersection of the clip plane and the model,
allowing you to see and interact with the cut surface. The generated capping geometry
supports measurements and all other operations that can be performed on regular geometry.
Once generated, capping geometry can be enabled, disabled, or removed using the
corresponding methods.
Example usage:
// Get the webvis contextconstcontext = webvis.getContext();// Create a clip planeconstclipPlaneId = context.createClipPlane({normal: [0, 0, 1],position: [0, 0, 0]});// Generate capping geometry for the cut surfaceawaitcontext.createCapping(clipPlaneId);// Later, disable the capping when not neededawaitcontext.disableCapping(clipPlaneId);
Parameters
clipPlaneId: number
The ID of the clip plane to create capping geometry for
Returns Promise<void>
Promise that resolves when the capping geometry has been created
A clip room consists of six orthogonal planes forming a box that clips any geometry
outside of it. This is useful for examining internal structures of complex models
or focusing on specific regions of interest.
Clip rooms can be positioned and sized using the properties object, and can be
made invisible (for clipping without showing the room boundaries) or disabled
temporarily without removing them.
// Get the webvis contextconstcontext = webvis.getContext();// Create a basic clip room at the origincontext.createClippingRoom({size: [10, 10, 10], // Size along X, Y, and Z axesname:"Engine Section"});// Create a positioned and rotated clip roomcontext.createClippingRoom({size: [5, 5, 5],// Matrix including rotation and translationtransform: [0.866, 0.5, 0, 0, // First row (rotation + scale) -0.5, 0.866, 0, 0, // Second row (rotation + scale)0, 0, 1, 0, // Third row (rotation + scale)10, 5, 3, 1// Fourth row (translation + w) ]});
Clip planes create a visual cut through 3D models, allowing examination of internal structures
by hiding geometry on one side of the plane. The orientation and position of the plane are
defined by its normal vector and a point on the plane.
A clip plane can be configured to exclude specific nodes from clipping or to clip only
specific nodes, using the excludedNodes and clippedNodes properties respectively.
// Get the webvis contextconstcontext = webvis.getContext();// Create a clip plane aligned with the XY planeconstclipPlaneId = context.createClipPlane({normal: [0, 0, 1], // Z-axis normalposition: [0.04, -0.03, -0.15], // Passing through a specific pointname:"Section View"});// Create a clip plane with excluded nodesconstclipPlaneId = context.createClipPlane({normal: [1, 0, 0],excludedNodes: [1234, 5678], // These nodes won't be clippedinvisible:true// Hide the visual representation of the plane});
Set the exclusive flag to clip geometry when using exclusiveClipplanes property
Returns number
The ID of the newly created clip plane
Deprecated
Calling createClipPlane with single parameters is deprecated, please use ClipPlaneProperties instead.
Creates a clip plane defined by the plane's normal, positioned at an optional point (otherwise at
the world space origin) and an optional name.
disableCapping
disableCapping(clipPlaneId:number):Promise<void>
Experimental
Disables the generated capping geometry for a clip plane.
This method temporarily hides the capping geometry without removing it from
the scene. The capping geometry can be made visible again using enableCapping.
This is useful when you need to switch between seeing the cut surface and
seeing through to the interior of the model.
Example usage:
// Get the webvis contextconstcontext = webvis.getContext();// Create a clip plane and generate capping geometryconstclipPlaneId = context.createClipPlane({normal: [0, 0, 1],position: [0, 0, 0]});awaitcontext.createCapping(clipPlaneId);// Hide the capping geometry temporarilyawaitcontext.disableCapping(clipPlaneId);// Show it again laterawaitcontext.enableCapping(clipPlaneId);
Parameters
clipPlaneId: number
The ID of the clip plane whose capping geometry should be disabled
Returns Promise<void>
Promise that resolves when the capping geometry has been disabled
enableCapping
enableCapping(clipPlaneId:number):Promise<void>
Experimental
Enables the generated capping geometry for a clip plane.
After capping geometry has been created for a clip plane, this method makes it visible
. The capping geometry represents the intersection between the clip plane
and the model, allowing visualization and interaction with the cut surface.
Example usage:
// Get the webvis contextconstcontext = webvis.getContext();// Create a clip plane and generate capping geometryconstclipPlaneId = context.createClipPlane({normal: [0, 0, 1],position: [0, 0, 0]});awaitcontext.createCapping(clipPlaneId);// Later disable capping and then re-enable itawaitcontext.disableCapping(clipPlaneId);// ...awaitcontext.enableCapping(clipPlaneId);
Parameters
clipPlaneId: number
The ID of the clip plane whose capping geometry should be enabled
Returns Promise<void>
Promise that resolves when the capping geometry has been enabled
getClipPlanes
getClipPlanes():number[]
Returns the IDs of all clip planes.
This method provides a list of all clip plane IDs that can be used with other
ClipPlaneAPI methods like changeClipPlane, removeClipPlane, or requestClipPlaneData.
Example usage:
// Get the webvis contextconstcontext = webvis.getContext();// Get all clip planes and print their propertiesconstclipPlaneIds = context.getClipPlanes();clipPlaneIds.forEach(async (id) => {constproperties = awaitcontext.requestClipPlaneData(id);console.log(`Clip plane ${id}: ${properties.name||'unnamed'}`);});
Returns number[]
An array of clip plane IDs. Empty array if no clip planes exist.
getClipRoom
getClipRoom():number
Returns the ID of the current clip room.
Since WebVis only supports a single clip room at a time, this method returns
a single ID value rather than an array. The ID can be used with other clip room
methods like requestClipRoomData.
Example usage:
// Get the webvis contextconstcontext = webvis.getContext();// Get the current clip room ID and retrieve its propertiesconstclipRoomId = context.getClipRoom();if (clipRoomId !== undefined) {constproperties = awaitcontext.requestClipRoomData();console.log(`Clip room size: [${properties.size}]`);} else {console.log("No clip room exists in the scene");}
Returns number
The ID of the current clip room, or undefined if no clip room exists
removeCapping
removeCapping(clipPlaneId:number):Promise<void>
Experimental
Completely removes the generated capping geometry for a clip plane.
This method permanently deletes any capping geometry that was previously created
for the specified clip plane. Unlike disableCapping, which merely hides the
geometry, this method removes it entirely from the scene.
If you later want to see capping geometry again, you'll need to call createCapping
to regenerate it.
Example usage:
// Get the webvis contextconstcontext = webvis.getContext();// Create a clip plane and generate capping geometryconstclipPlaneId = context.createClipPlane({normal: [0, 0, 1],position: [0, 0, 0]});awaitcontext.createCapping(clipPlaneId);// Later, permanently remove the capping geometryawaitcontext.removeCapping(clipPlaneId);
Parameters
clipPlaneId: number
The ID of the clip plane whose capping geometry should be removed
Returns Promise<void>
Promise that resolves when the capping geometry has been removed
This method completely removes the clip room and disables its clipping effect.
Only one clip room can exist at a time, so there's no need to specify an ID.
When the safe parameter is set to true and the clip room is referenced by snapshots,
the removal will be prevented and the method will return REFERENCED_BY_SNAPSHOT.
By default (safe is false), the clip room will be forcibly removed even if it's
referenced by snapshots.
// Get the webvis contextconstcontext = webvis.getContext();// Safe remove - will fail if referenced by snapshotsconstremoveResult = context.removeClippingRoom(true);if (removeResult === webvis.RemoveState.REFERENCED_BY_SNAPSHOT) {console.log("Cannot remove clip room - it's referenced by a snapshot");} elseif (removeResult === webvis.RemoveState.OK) {console.log("Clip room successfully removed");}// Force remove even if referenced by snapshots (default behavior)context.removeClippingRoom();
Parameters
Optionalsafe: boolean
Whether to prevent removal if the clip room is referenced by snapshots. Default: false
This method completely removes the specified clip plane from the scene. Any capping
geometry associated with the clip plane will also be removed.
When the safe parameter is set to true and the clip plane is referenced by snapshots,
the removal will be prevented and the method will return REFERENCED_BY_SNAPSHOT.
By default (safe is false), clip planes will be forcibly removed even if they're
referenced by snapshots.
// Get the webvis contextconstcontext = webvis.getContext();// Safe remove - will fail if referenced by snapshotsconstremoveResult = context.removeClipPlane(clipPlaneId, true);if (removeResult === webvis.RemoveState.REFERENCED_BY_SNAPSHOT) {console.log("Cannot remove clip plane - it's referenced by a snapshot");} elseif (removeResult === webvis.RemoveState.OK) {console.log("Clip plane successfully removed");}// Force remove even if referenced by snapshots (default behavior)context.removeClipPlane(clipPlaneId);
Parameters
clipPlaneId: number
The ID of the clip plane to remove
Optionalsafe: boolean
Whether to prevent removal if the clip plane is referenced by snapshots. Default: false
Retrieves the properties of a specific clip plane.
This method asynchronously fetches the current configuration of a clip plane,
including its position, orientation, visibility settings, and any node exclusions.
The data is returned as a ClipPlaneProperties object that can be inspected or used
to create a similar clip plane.
Example usage:
// Get the webvis contextconstcontext = webvis.getContext();constproperties = awaitcontext.requestClipPlaneData(clipPlaneId);console.log(`Clip plane position: [${properties.position}]`);console.log(`Clip plane normal: [${properties.normal}]`);// Use the properties to create a similar clip planeconstnewClipPlaneId = context.createClipPlane({ ...properties,name:properties.name + " (copy)"});
Retrieves the properties of the current clip room.
This method asynchronously fetches the current configuration of the clip room,
including its size, position, transformation matrix, and visibility settings.
The data is returned as a ClipRoomProperties object that can be inspected or used
to create a similar clip room after the current one is removed.
Example usage:
// Get the webvis contextconstcontext = webvis.getContext();// Get the clip room properties and display informationconstproperties = awaitcontext.requestClipRoomData();console.log(`Clip room size: [${properties.size}]`);console.log(`Clip room transform: [${properties.transform}]`);// Use the properties to create a similar clip room after removing the current onecontext.removeClippingRoom();context.createClippingRoom({ ...properties,size: [properties.size[0] * 1.5, properties.size[1] * 1.5, properties.size[2] * 1.5],name:properties.name ? properties.name + " (enlarged)" : "Enlarged Room"});
ClipPlaneAPI
Overview
Clip planes are used to visually cut through 3D models by defining a separating plane that hides geometry on one side. This makes it possible to examine internal structures and cross-sections of models that would otherwise be hidden.
A clip room consists of six orthogonal planes forming a box that clips any geometry outside of it, useful for focusing on specific regions of interest.
Key Features
Quick Start
Events
The API triggers the following events:
Related Types