
##############
CuttingSection
##############

.. js:class:: CuttingSection

   Object representing an individual cutting section, more information can be found `here <https://docs.techsoft3d.com/hoops/visualize-web/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.
   
   
   Index
   =====
   
   .. rubric:: Methods
   
   
   .. rst-class:: api-xref-list
   
   
   * :js:meth:`~CuttingSection.activate`
   * :js:meth:`~CuttingSection.addPlane`
   * :js:meth:`~CuttingSection.applyPlaneOpacity`
   * :js:meth:`~CuttingSection.clear`
   * :js:meth:`~CuttingSection.deactivate`
   * :js:meth:`~CuttingSection.fromJson`
   * :js:meth:`~CuttingSection.getCount`
   * :js:meth:`~CuttingSection.getCuttingPlanes`
   * :js:meth:`~CuttingSection.getNodeId`
   * :js:meth:`~CuttingSection.getPlane`
   * :js:meth:`~CuttingSection.getPlaneColor`
   * :js:meth:`~CuttingSection.getPlaneIndexByNodeId`
   * :js:meth:`~CuttingSection.getPlaneLineColor`
   * :js:meth:`~CuttingSection.getPlaneOpacity`
   * :js:meth:`~CuttingSection.getReferenceGeometry`
   * :js:meth:`~CuttingSection.isActive`
   * :js:meth:`~CuttingSection.removePlane`
   * :js:meth:`~CuttingSection.resetPlanesOpacity`
   * :js:meth:`~CuttingSection.setColor`
   * :js:meth:`~CuttingSection.setOpacity`
   * :js:meth:`~CuttingSection.setPlane`
   * :js:meth:`~CuttingSection.setPlaneColor`
   * :js:meth:`~CuttingSection.setPlaneLineColor`
   * :js:meth:`~CuttingSection.setPlaneOpacity`
   * :js:meth:`~CuttingSection.toJson`
   * :js:meth:`~CuttingSection.updatePlane`
   
   




Methods
=======

.. js:method:: CuttingSection.activate

   .. rst-class:: sig-pretty-signature
   
      | 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.
   
   



.. js:method:: CuttingSection.addPlane

   .. rst-class:: sig-pretty-signature
   
      | addPlane(**plane**\ : :js:class:`~Plane`\ , **referenceGeometry**\ : (*None* \| :js:class:`~Point3`\ [])?, **options**\ : { color: :js:class:`~IColor`\ , lineColor: :js:class:`~IColor`\ , opacity: *number* }): *Promise*
   
   Adds a plane to the cutting section.
   
   **Parameters**
   
      **plane**\ : :js:class:`~Plane`
   
         The plane to be used for cutting.
   
   
      **referenceGeometry**\ : (*None* \| :js:class:`~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: :js:class:`~IColor`\ , lineColor: :js:class:`~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.
   
   



.. js:method:: CuttingSection.applyPlaneOpacity

   .. rst-class:: sig-pretty-signature
   
      | 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*
   



.. js:method:: CuttingSection.clear

   .. rst-class:: sig-pretty-signature
   
      | clear(): *Promise*
   
   Removes all planes from this cutting section. This will also deactivate the cutting section.
   
   **Returns**\ : *Promise*
   



.. js:method:: CuttingSection.deactivate

   .. rst-class:: sig-pretty-signature
   
      | deactivate(): *Promise*
   
   Removes a cutting section from use.
   
   **Returns**\ : *Promise*
   



.. js:method:: CuttingSection.fromJson

   .. rst-class:: sig-pretty-signature
   
      | fromJson(**json**\ : *object*\ ): *Promise*
   
   **Parameters**
   
      **json**\ : *object*
   
   
   **Returns**\ : *Promise*
   



.. js:method:: CuttingSection.getCount

   .. rst-class:: sig-pretty-signature
   
      | getCount(): *number*
   
   Gets the number of planes in this cutting secton.
   
   **Returns**\ : *number*
   
      the number of planes in this cutting section
   
   



.. js:method:: CuttingSection.getCuttingPlanes

   .. rst-class:: sig-pretty-signature
   
      | getCuttingPlanes(): :js:class:`~CuttingPlane`\ []
   
   Gets the cutting planes for this cutting section.
   
   **Returns**\ : :js:class:`~CuttingPlane`\ []
   
      the cutting planes for this cutting
   
   



.. js:method:: CuttingSection.getNodeId

   .. rst-class:: sig-pretty-signature
   
      | 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.
   
   



.. js:method:: CuttingSection.getPlane

   .. rst-class:: sig-pretty-signature
   
      | getPlane(**index**\ : *number*\ ): (*None* \| :js:class:`~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* \| :js:class:`~Plane`\ )
   
      Plane that is used for cutting at the given index or null.
   
   



.. js:method:: CuttingSection.getPlaneColor

   .. rst-class:: sig-pretty-signature
   
      | getPlaneColor(**index**\ : *number*\ ): (*undefined* \| :js:class:`~Color`\ )
   
   Sets the line color for all planes in the cutting section
   
   **Parameters**
   
      **index**\ : *number*
   
   
   **Returns**\ : (*undefined* \| :js:class:`~Color`\ )
   
      The color of the cutting plane.
   
   



.. js:method:: CuttingSection.getPlaneIndexByNodeId

   .. rst-class:: sig-pretty-signature
   
      | 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.
   
   



.. js:method:: CuttingSection.getPlaneLineColor

   .. rst-class:: sig-pretty-signature
   
      | getPlaneLineColor(**index**\ : *number*\ ): (*undefined* \| :js:class:`~Color`\ )
   
   Sets the line color for the plane at the given index.
   
   **Parameters**
   
      **index**\ : *number*
   
         The index of the cutting plane.
   
   
   
   **Returns**\ : (*undefined* \| :js:class:`~Color`\ )
   
      The color of the cutting plane's line.
   
   



.. js:method:: CuttingSection.getPlaneOpacity

   .. rst-class:: sig-pretty-signature
   
      | 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*\ )
   



.. js:method:: CuttingSection.getReferenceGeometry

   .. rst-class:: sig-pretty-signature
   
      | getReferenceGeometry(**index**\ : *number*\ ): (*None* \| :js:class:`~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* \| :js:class:`~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.
   
   



.. js:method:: CuttingSection.isActive

   .. rst-class:: sig-pretty-signature
   
      | isActive(): *boolean*
   
   Gets whether a cutting section is active
   
   **Returns**\ : *boolean*
   
      boolean value indicating whether this cutting section is active
   
   



.. js:method:: CuttingSection.removePlane

   .. rst-class:: sig-pretty-signature
   
      | 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*
   



.. js:method:: CuttingSection.resetPlanesOpacity

   .. rst-class:: sig-pretty-signature
   
      | 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*
   



.. js:method:: CuttingSection.setColor

   .. rst-class:: sig-pretty-signature
   
      | setColor(**color**\ : :js:class:`~Color`\ ): *Promise*
   
   Sets the color for all planes in the cutting section
   
   **Parameters**
   
      **color**\ : :js:class:`~Color`
   
         Color to set
   
   
   
   **Returns**\ : *Promise*
   
      Promise that resolves when the operation has completed.
   
   



.. js:method:: CuttingSection.setOpacity

   .. rst-class:: sig-pretty-signature
   
      | setOpacity(**opacity**\ : *number*\ ): *void*
   
   Sets the opacity for all planes in the cutting section
   
   **Parameters**
   
      **opacity**\ : *number*
   
         opacity to set
   
   
   
   **Returns**\ : *void*
   



.. js:method:: CuttingSection.setPlane

   .. rst-class:: sig-pretty-signature
   
      | setPlane(**index**\ : *number*\ , **plane**\ : :js:class:`~Plane`\ , **referenceGeometry**\ : (*None* \| :js:class:`~Point3`\ [])?, **options**\ : { color: :js:class:`~IColor`\ , lineColor: :js:class:`~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**\ : :js:class:`~Plane`
   
         The plane to be used for cutting.
   
   
      **referenceGeometry**\ : (*None* \| :js:class:`~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: :js:class:`~IColor`\ , lineColor: :js:class:`~IColor`\ , opacity: *number* }
   
         Optional parameters for the cutting plane.
   
   
   
   **Returns**\ : *Promise*
   
      A promise that resolves when the operation has completed.
   
   



.. js:method:: CuttingSection.setPlaneColor

   .. rst-class:: sig-pretty-signature
   
      | setPlaneColor(**index**\ : *number*\ , **color**\ : :js:class:`~Color`\ ): *void*
   
   Sets the color for the plane at the given index.
   
   **Parameters**
   
      **index**\ : *number*
   
         The index of the cutting plane.
   
   
      **color**\ : :js:class:`~Color`
   
         The color to set.
   
   
   
   **Returns**\ : *void*
   



.. js:method:: CuttingSection.setPlaneLineColor

   .. rst-class:: sig-pretty-signature
   
      | setPlaneLineColor(**index**\ : *number*\ , **color**\ : :js:class:`~Color`\ ): *void*
   
   Sets the line color for the plane at the given index.
   
   **Parameters**
   
      **index**\ : *number*
   
         The index of the cutting plane.
   
   
      **color**\ : :js:class:`~Color`
   
         The color to set.
   
   
   
   **Returns**\ : *void*
   



.. js:method:: CuttingSection.setPlaneOpacity

   .. rst-class:: sig-pretty-signature
   
      | 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*
   



.. js:method:: CuttingSection.toJson

   .. rst-class:: sig-pretty-signature
   
      | toJson(): *object*
   
   Creates an object ready for JSON serialization.
   
   **Returns**\ : *object*
   
      The prepared object.
   
   



.. js:method:: CuttingSection.updatePlane

   .. rst-class:: sig-pretty-signature
   
      | updatePlane(**index**\ : *number*\ , **plane**\ : :js:class:`~Plane`\ , **geometryMatrix**\ : :js:class:`~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**\ : :js:class:`~Plane`
   
         The plane to use for cutting.
   
   
      **geometryMatrix**\ : :js:class:`~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*
   





