CuttingSection

class CuttingSection()

Object representing an individual cutting section, more information can be found [here](https://docs.techsoft3d.com/communicator/latest/prog_guide/viewing/scene_attributes/cutting-planes.html). A cutting section groups up to 6 cutting planes together and behaves independently of other cutting sections.


Methods

activate

CuttingSection.activate()

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

Returns

a promise if the cutting section was activated.

Return type

Promise <void>

addPlane

CuttingSection.addPlane(plane, referenceGeometry)
Arguments
  • plane (Plane()) – The plane to be used for cutting.

  • referenceGeometry (null | [Point3]()) – 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.

Adds a plane to the cutting section.

Return type

Promise <boolean>

applyPlaneOpacity

CuttingSection.applyPlaneOpacity(index[, opacity])
Arguments
  • index (number()) – The index of the cutting plane.

  • opacity (number()) – optional The value used to change the opacity if needed

Apply the opacity factor to the plane.

Return type

void

clear

CuttingSection.clear()

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

Return type

Promise <void>

deactivate

CuttingSection.deactivate()

Removes a cutting section from use.

Return type

Promise <void>

fromJson

CuttingSection.fromJson(json)
Arguments
  • json (object()) – None

Return type

Promise <void>

getCount

CuttingSection.getCount()

Gets the number of planes in this cutting secton.

Returns

the number of planes in this cutting section

Return type

number

getNodeId

CuttingSection.getNodeId(index)
Arguments
  • index (number()) – the index of the cutting plane.

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.

Returns

[[NodeId]] of the reference geometry for the cutting plane at the given index or null.

Return type

null | number

getPlane

CuttingSection.getPlane(index)
Arguments
  • index (number()) – The index of the cutting plane.

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

Returns

Plane that is used for cutting at the given index or null.

Return type

null | Plane

getPlaneIndexByNodeId

CuttingSection.getPlaneIndexByNodeId(id)
Arguments
  • id (number()) – The [[NodeId]] for the plane reference geometry.

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

Returns

The index of a plane associated with the provided [[NodeId]], or null if no plane is found.

Return type

null | number

getPlaneOpacity

CuttingSection.getPlaneOpacity(index)
Arguments
  • index (number()) – The index of the cutting plane.

Gets the opacity for the plane at the given index.

Return type

undefined | number

getReferenceGeometry

CuttingSection.getReferenceGeometry(index)
Arguments
  • index (number()) – The index of the cutting plane.

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

Returns

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.

Return type

null | [Point3]

isActive

CuttingSection.isActive()

Gets whether a cutting section is active

Returns

boolean value indicating whether this cutting section is active

Return type

boolean

removePlane

CuttingSection.removePlane(index)
Arguments
  • index (number()) – The index of the cutting plane to remove.

Removes the cutting plane at the specified index.

Return type

Promise <void>

resetPlanesOpacity

CuttingSection.resetPlanesOpacity()

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

Return type

void

setColor

CuttingSection.setColor(color)
Arguments

Sets the color for all planes in the cutting section

Returns

Promise that resolves when the operation has completed.

Return type

Promise <void>

setOpacity

CuttingSection.setOpacity(opacity)
Arguments
  • opacity (number()) – opacity to set

Sets the opacity for all planes in the cutting section

Return type

void

setPlane

CuttingSection.setPlane(index, plane, referenceGeometry)
Arguments
  • index (number()) – The index of the cutting plane to replace.

  • plane (Plane()) – The plane to be used for cutting.

  • referenceGeometry (null | [Point3]()) – 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.

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

Return type

Promise <void>

setPlaneOpacity

CuttingSection.setPlaneOpacity(index, opacity)
Arguments
  • index (number()) – The index of the cutting plane.

  • opacity (number()) – A number between 0 and 1.

Sets the opacity for the plane at the given index.

Equivalent to section.applyPlaneOpacity(index, opacity)

Return type

void

toJson

CuttingSection.toJson()

Creates an object ready for JSON serialization.

Returns

The prepared object.

Return type

object

updatePlane

CuttingSection.updatePlane(index, plane, geometryMatrix, finalizePosition, resetTranslation)
Arguments
  • 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()) – If true, sets the result of the geometry matrix multiplication as the new position matrix.

  • resetTranslation (boolean()) – If true, uses the provided geometry matrix for the geometry position.

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

Return type

Promise <void>