IonSnapService

Provides interactive snap-to-geometry against a Cesium ion 3D Tiles asset backed by a BIM/CAD Database model, using the ion REST API's element snap endpoint.

This class handles conversions between the reference frame of a source BIM/CAD Database and the view-dependent screen space pixel coordinates. Each snap, it transforms using the ion asset's source reference frame, the camera's transform, and the canvas dimensions so that view-dependent features— such as the pixel aperture, nearest position, or surface tracking— behave correctly.

This object is normally not instantiated directly, use IonSnapService.fromAssetId.

const snapper = await IonSnapService.fromAssetId(123456);
const canvas = viewer.scene.canvas;
const result = await snapper.snap({
elementId: "0x30000000df2",
testPoint: pickedPosition,
camera: viewer.camera,
canvasWidth: canvas.clientWidth,
canvasHeight: canvas.clientHeight,
});
if (defined(result)) {
console.log("snapped to", result.snapPoint);
}

See also

Constructors

Link copied to clipboard
constructor(options: IonSnapService.ConstructorOptions)

Types

Link copied to clipboard
object Companion
Link copied to clipboard
Link copied to clipboard
interface Result

The result of a successful IonSnapService.snap. Extends SnapService.Result with ion-specific fields.

Link copied to clipboard
interface SnapOptions

Properties

Link copied to clipboard

The ion asset id this snapper operates on.

Link copied to clipboard

A 4x4 transformation matrix from the source BIM/CAD Database reference frame local to the world's fixed reference frame.

Functions

Link copied to clipboard

Requests a snap against an element of this asset.

Link copied to clipboard