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

.. js:class:: wv.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:`~wv.CuttingSection.activate`
   * :js:meth:`~wv.CuttingSection.addPlane`
   * :js:meth:`~wv.CuttingSection.applyPlaneOpacity`
   * :js:meth:`~wv.CuttingSection.clear`
   * :js:meth:`~wv.CuttingSection.deactivate`
   * :js:meth:`~wv.CuttingSection.fromJson`
   * :js:meth:`~wv.CuttingSection.getCount`
   * :js:meth:`~wv.CuttingSection.getCuttingPlanes`
   * :js:meth:`~wv.CuttingSection.getNodeId`
   * :js:meth:`~wv.CuttingSection.getPlane`
   * :js:meth:`~wv.CuttingSection.getPlaneColor`
   * :js:meth:`~wv.CuttingSection.getPlaneIndexByNodeId`
   * :js:meth:`~wv.CuttingSection.getPlaneLineColor`
   * :js:meth:`~wv.CuttingSection.getPlaneOpacity`
   * :js:meth:`~wv.CuttingSection.getReferenceGeometry`
   * :js:meth:`~wv.CuttingSection.isActive`
   * :js:meth:`~wv.CuttingSection.removePlane`
   * :js:meth:`~wv.CuttingSection.resetPlanesOpacity`
   * :js:meth:`~wv.CuttingSection.setColor`
   * :js:meth:`~wv.CuttingSection.setOpacity`
   * :js:meth:`~wv.CuttingSection.setPlane`
   * :js:meth:`~wv.CuttingSection.setPlaneColor`
   * :js:meth:`~wv.CuttingSection.setPlaneLineColor`
   * :js:meth:`~wv.CuttingSection.setPlaneOpacity`
   * :js:meth:`~wv.CuttingSection.toJson`
   * :js:meth:`~wv.CuttingSection.updatePlane`
   
   



.. rst-class:: kind-group kind-methods

.. rubric:: Methods
   :class: kind-group-title


.. js:method:: wv.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:: wv.CuttingSection.addPlane

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

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



.. js:method:: wv.CuttingSection.fromJson

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



.. js:method:: wv.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:: wv.CuttingSection.getCuttingPlanes

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



.. js:method:: wv.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:: wv.CuttingSection.getPlane

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



.. js:method:: wv.CuttingSection.getPlaneColor

      .. rst-class:: sig-pretty-signature
      
         | getPlaneColor(**index**\ : *number*\ ): (*undefined* | :js:class:`Color <wv.Color>`\ )
      
      Gets the line color for all planes in the cutting section
      
      **Parameters**
      
      
         **index**\ : *number*
      
      
            Index of the color to get
      
      
      
      **Returns**\ : (*undefined* \| :js:class:`Color <wv.Color>`\ )
      
      
         The color of the cutting plane.
      
      



.. js:method:: wv.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:: wv.CuttingSection.getPlaneLineColor

      .. rst-class:: sig-pretty-signature
      
         | getPlaneLineColor(**index**\ : *number*\ ): (*undefined* | :js:class:`Color <wv.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 <wv.Color>`\ )
      
      
         The color of the cutting plane's line.
      
      



.. js:method:: wv.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:: wv.CuttingSection.getReferenceGeometry

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

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



.. js:method:: wv.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:: wv.CuttingSection.setPlane

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



.. js:method:: wv.CuttingSection.setPlaneColor

      .. rst-class:: sig-pretty-signature
      
         | setPlaneColor(**index**\ : *number*\ , **color**\ : :js:class:`Color <wv.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 <wv.Color>`
      
      
            The color to set.
      
      
      
      **Returns**\ : *void*
      



.. js:method:: wv.CuttingSection.setPlaneLineColor

      .. rst-class:: sig-pretty-signature
      
         | setPlaneLineColor(**index**\ : *number*\ , **color**\ : :js:class:`Color <wv.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 <wv.Color>`
      
      
            The color to set.
      
      
      
      **Returns**\ : *void*
      



.. js:method:: wv.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:: wv.CuttingSection.toJson

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



.. js:method:: wv.CuttingSection.updatePlane

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




