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()addPlane()applyPlaneOpacity()clear()deactivate()fromJson()getCount()getCuttingPlanes()getNodeId()getPlane()getPlaneColor()getPlaneIndexByNodeId()getPlaneLineColor()getPlaneOpacity()getReferenceGeometry()isActive()removePlane()resetPlanesOpacity()setColor()setOpacity()setPlane()setPlaneColor()setPlaneLineColor()setPlaneOpacity()toJson()updatePlane()
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[, options]) 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. - options (
function()) – optional Optional parameters for the cutting plane. 
Adds a plane to the cutting section.
Returns: A promise that resolves to true if the plane was added successfully, or false if the maximum number of cutting planes has been reached. Return type: Promise <boolean> - plane (
 
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 - index (
 
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>
- json (
 
getCount
- 
CuttingSection.getCount() Gets the number of planes in this cutting secton.
Returns: the number of planes in this cutting section Return type: number 
getCuttingPlanes
- 
CuttingSection.getCuttingPlanes() Gets the cutting planes for this cutting section.
Returns: the cutting planes for this cutting Return type: [CuttingPlane] 
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 - index (
 
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 - index (
 
getPlaneColor
- 
CuttingSection.getPlaneColor(index) Arguments: - index (
number()) – None 
Sets the line color for all planes in the cutting section
Returns: The color of the cutting plane. Return type: undefined | Color - index (
 
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 - id (
 
getPlaneLineColor
- 
CuttingSection.getPlaneLineColor(index) Arguments: - index (
number()) – The index of the cutting plane. 
Sets the line color for the plane at the given index.
Returns: The color of the cutting plane’s line. Return type: undefined | Color - index (
 
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 - index (
 
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] - index (
 
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> - index (
 
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
setOpacity
- 
CuttingSection.setOpacity(opacity) Arguments: - opacity (
number()) – opacity to set 
Sets the opacity for all planes in the cutting section
Return type: void - opacity (
 
setPlane
- 
CuttingSection.setPlane(index, plane, referenceGeometry[, options]) 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. - options (
function()) – optional Optional parameters for the cutting plane. 
Sets a plane currently in the cutting section at a given index.
Returns: A promise that resolves when the operation has completed. Return type: Promise <void> - index (
 
setPlaneColor
setPlaneLineColor
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 - index (
 
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> - index (