CuttingSection

class CuttingSection()

Object representing an individual cutting section, more information can be found here. A cutting section groups up to 6 cutting planes together and behaves independently of other cutting sections.

Methods

CuttingSection.activate()
activate(): Promise

Activates a cutting section for use. A cutting section must have at least one plane to be activated.

Returns: Promise

a promise if the cutting section was activated.
CuttingSection.addPlane()
addPlane(plane: Plane, referenceGeometry: (None | Point3[])?, options: { color: IColor, lineColor: IColor, opacity: number }): Promise

Adds a plane to the cutting section.

Parameters

plane: Plane

The plane to be used for cutting.

referenceGeometry: (None | Point3[]) = null

An optional list of four points representing a quad to be used as reference geometry for the cutting plane. Pass null to use no reference geometry for this cutting plane.

options: { color: IColor, lineColor: IColor, opacity: number }

Optional parameters for the cutting plane.

Returns: Promise

A promise that resolves to true if the plane was added successfully, or false if the maximum number of cutting planes has been reached.
CuttingSection.applyPlaneOpacity()
applyPlaneOpacity(index: number, opacity: number): void

Apply the opacity factor to the plane.

Parameters

index: number

The index of the cutting plane.

opacity: number

The value used to change the opacity if needed

Returns: void

CuttingSection.clear()
clear(): Promise

Removes all planes from this cutting section. This will also deactivate the cutting section.

Returns: Promise

CuttingSection.deactivate()
deactivate(): Promise

Removes a cutting section from use.

Returns: Promise

CuttingSection.fromJson()
fromJson(json: object): Promise

Parameters

json: object

Returns: Promise

CuttingSection.getCount()
getCount(): number

Gets the number of planes in this cutting secton.

Returns: number

the number of planes in this cutting section
CuttingSection.getCuttingPlanes()
getCuttingPlanes(): CuttingPlane[]

Gets the cutting planes for this cutting section.

Returns: CuttingPlane[]

the cutting planes for this cutting
CuttingSection.getNodeId()
getNodeId(index: number): (None | number)

Gets the [[NodeId]] for the reference geometry for the cutting plane at the given index. In the case of an invalid index or a cutting plane with no reference geometry, null will be returned.

Parameters

index: number

the index of the cutting plane.

Returns: (None | number)

[[NodeId]] of the reference geometry for the cutting plane at the given index or null.
CuttingSection.getPlane()
getPlane(index: number): (None | Plane)

Gets the plane for the item at the given index. In the case of an invalid index, null will be returned.

Parameters

index: number

The index of the cutting plane.

Returns: (None | Plane)

Plane that is used for cutting at the given index or null.
CuttingSection.getPlaneColor()
getPlaneColor(index: number): (undefined | Color)

Sets the line color for all planes in the cutting section

Parameters

index: number

Returns: (undefined | Color)

The color of the cutting plane.
CuttingSection.getPlaneIndexByNodeId()
getPlaneIndexByNodeId(id: number): (None | number)

Gets the index of a plane for the corresponding node id. In the case of an invalid id, null will be returned.

Parameters

id: number

The [[NodeId]] for the plane reference geometry.

Returns: (None | number)

The index of a plane associated with the provided [[NodeId]], or null if no plane is found.
CuttingSection.getPlaneLineColor()
getPlaneLineColor(index: number): (undefined | Color)

Sets the line color for the plane at the given index.

Parameters

index: number

The index of the cutting plane.

Returns: (undefined | Color)

The color of the cutting plane’s line.
CuttingSection.getPlaneOpacity()
getPlaneOpacity(index: number): (undefined | number)

Gets the opacity for the plane at the given index.

Parameters

index: number

The index of the cutting plane.

Returns: (undefined | number)

CuttingSection.getReferenceGeometry()
getReferenceGeometry(index: number): (None | Point3[])

Gets the reference geometry for the item at the given index. In the case of an invalid index, null will be returned

Parameters

index: number

The index of the cutting plane.

Returns: (None | Point3[])

A list of four points representing a quad to be used as reference geometry for the cutting plane, or null if there is no reference geometry.
CuttingSection.isActive()
isActive(): boolean

Gets whether a cutting section is active

Returns: boolean

boolean value indicating whether this cutting section is active
CuttingSection.removePlane()
removePlane(index: number): Promise

Removes the cutting plane at the specified index.

Parameters

index: number

The index of the cutting plane to remove.

Returns: Promise

CuttingSection.resetPlanesOpacity()
resetPlanesOpacity(): void

Reapply the opacity of the cutting planes to the engine This function must be explicitly called after _resetOpacity has been emitted by the engine

Returns: void

CuttingSection.setColor()
setColor(color: Color): Promise

Sets the color for all planes in the cutting section

Parameters

color: Color

Color to set

Returns: Promise

Promise that resolves when the operation has completed.
CuttingSection.setOpacity()
setOpacity(opacity: number): void

Sets the opacity for all planes in the cutting section

Parameters

opacity: number

opacity to set

Returns: void

CuttingSection.setPlane()
setPlane(index: number, plane: Plane, referenceGeometry: (None | Point3[])?, options: { color: IColor, lineColor: IColor, opacity: number }): Promise

Sets a plane currently in the cutting section at a given index.

Parameters

index: number

The index of the cutting plane to replace.

plane: Plane

The plane to be used for cutting.

referenceGeometry: (None | Point3[]) = null

a list of four points representing a quad to be used as reference geometry for the cutting plane. Pass null to use no reference geometry for this cutting plane.

options: { color: IColor, lineColor: IColor, opacity: number }

Optional parameters for the cutting plane.

Returns: Promise

A promise that resolves when the operation has completed.
CuttingSection.setPlaneColor()
setPlaneColor(index: number, color: Color): void

Sets the color for the plane at the given index.

Parameters

index: number

The index of the cutting plane.

color: Color

The color to set.

Returns: void

CuttingSection.setPlaneLineColor()
setPlaneLineColor(index: number, color: Color): void

Sets the line color for the plane at the given index.

Parameters

index: number

The index of the cutting plane.

color: Color

The color to set.

Returns: void

CuttingSection.setPlaneOpacity()
setPlaneOpacity(index: number, opacity: number): void

Sets the opacity for the plane at the given index.

Equivalent to section.applyPlaneOpacity(index, opacity)

Parameters

index: number

The index of the cutting plane.

opacity: number

A number between 0 and 1.

Returns: void

CuttingSection.toJson()
toJson(): object

Creates an object ready for JSON serialization.

Returns: object

The prepared object.
CuttingSection.updatePlane()
updatePlane(index: number, plane: Plane, geometryMatrix: Matrix?, finalizePosition: boolean?, resetTranslation: boolean?): Promise

Updates the position of a cutting plane and stand-in geometry if present.

Parameters

index: number

The index of the cutting plane.

plane: Plane

The plane to use for cutting.

geometryMatrix: Matrix = …

A matrix that is multiplied by the previous position matrix to update the geometry position.

finalizePosition: boolean = false

If true, sets the result of the geometry matrix multiplication as the new position matrix.

resetTranslation: boolean = false

If true, uses the provided geometry matrix for the geometry position.

Returns: Promise