.. role:: ts-api-decorator

#########
PartLines
#########

.. js:module:: cee.mrk
   :noindex:

.. container:: ts-api-section

   .. js:class:: PartLines

      A part that can show lines in a ``MarkupModel``.

      Use ``MarkupModel.addLinesPart`` to create a new instance of this class.



.. container:: api-index-section

   .. rubric:: Accessors

   .. rst-class:: api-index-list-item api-kind-accessor api-parent-kind-class

   * :js:attr:`~cee.mrk.PartLines.color`
   * :js:attr:`~cee.mrk.PartLines.customData`
   * :js:attr:`~cee.mrk.PartLines.lineWidth`
   * :js:attr:`~cee.mrk.PartLines.terminatorDrawMode`



.. container:: api-index-section

   .. rubric:: Methods

   .. rst-class:: api-index-list-item api-kind-method api-parent-kind-class

   * :js:meth:`~cee.mrk.PartLines.clearTerminators`
   * :js:meth:`~cee.mrk.PartLines.rayIntersect`
   * :js:meth:`~cee.mrk.PartLines.setArrowEndTerminator`
   * :js:meth:`~cee.mrk.PartLines.setArrowStartTerminator`
   * :js:meth:`~cee.mrk.PartLines.setBarEndTerminator`
   * :js:meth:`~cee.mrk.PartLines.setBarStartTerminator`
   * :js:meth:`~cee.mrk.PartLines.setVertices`
   * :js:meth:`~cee.mrk.PartLines.setVerticesFloat32Array`





------------

Accessors
=========

.. container:: ts-api-section

   .. js:function:: PartLines.color()



      The single color of the part


      :rtype: Color3Like

   .. js:function:: PartLines.color( color)

      :param color: None
      :type color: Color3Like


      :rtype: void



.. container:: ts-api-section

   .. js:function:: PartLines.customData()



      Custom data for the part. This field is not used by EnvisionWeb.


      :rtype: any

   .. js:function:: PartLines.customData( data)

      :param data: None
      :type data: any


      :rtype: void



.. container:: ts-api-section

   .. js:function:: PartLines.lineWidth()



      Controls the line width (pixels)


      :rtype: number

   .. js:function:: PartLines.lineWidth( width)

      :param width: None
      :type width: number


      :rtype: void



.. container:: ts-api-section

   .. js:function:: PartLines.terminatorDrawMode()



      The line terminator draw mode


      :rtype: LineTerminatorDrawMode

   .. js:function:: PartLines.terminatorDrawMode( drawMode)

      :param drawMode: None
      :type drawMode: LineTerminatorDrawMode


      :rtype: void



Methods
=======

.. rst-class:: ts-api-section

clearTerminators
----------------

.. js:method:: PartLines.clearTerminators()



   Clear start and end terminators


   :rtype: void

.. rst-class:: ts-api-section

rayIntersect
------------

.. js:method:: PartLines.rayIntersect( ray, hitItem)

   :param ray: None
   :type ray: Ray
   :param hitItem: None
   :type hitItem: PartHitItem


   Picking


   :rtype: boolean

.. rst-class:: ts-api-section

setArrowEndTerminator
---------------------

.. js:method:: PartLines.setArrowEndTerminator( arrowHeadLengthInPixels, arrowHeadWidthInPixels)

   :param arrowHeadLengthInPixels: None
   :type arrowHeadLengthInPixels: number
   :param arrowHeadWidthInPixels: None
   :type arrowHeadWidthInPixels: number


   Draw arrows at end of lines


   :rtype: void

.. rst-class:: ts-api-section

setArrowStartTerminator
-----------------------

.. js:method:: PartLines.setArrowStartTerminator( arrowHeadLengthInPixels, arrowHeadWidthInPixels)

   :param arrowHeadLengthInPixels: None
   :type arrowHeadLengthInPixels: number
   :param arrowHeadWidthInPixels: None
   :type arrowHeadWidthInPixels: number


   Draw arrows at start of lines


   :rtype: void

.. rst-class:: ts-api-section

setBarEndTerminator
-------------------

.. js:method:: PartLines.setBarEndTerminator( lengthInPixels)

   :param lengthInPixels: None
   :type lengthInPixels: number


   Draw bars at end of lines


   :rtype: void

.. rst-class:: ts-api-section

setBarStartTerminator
---------------------

.. js:method:: PartLines.setBarStartTerminator( lengthInPixels)

   :param lengthInPixels: None
   :type lengthInPixels: number


   Draw bars at start of lines


   :rtype: void

.. rst-class:: ts-api-section

setVertices
-----------

.. js:method:: PartLines.setVertices( vertices)

   :param vertices: None
   :type vertices: ArrayLike <number>


   Sets the vertices for the lines.

   The coordinates need to be interleaved (x0, y0, z0, x1, y1, z1, ...)

   Lines will be drawn between [x0, y0, z0] and [x1, y1, z1], and between [x2, y2, z2] and [x3, y3, z3], ...,
   so the number of lines will be vertices.length / 6.

   In order to draw a continuous path connecting all the given points, use ``utils.PathGenerator``:


   .. code-block:: javascript

      const mrkModel = new cee.mrk.MarkupModel();
      const partLines = mrkModel.addLinesPart();
      const points: cee.Vec3[] = [ ... ];
      const vertices = cee.utils.PathGenerator.generateVerticesForPath(points);
      partLines.setVertices(vertices);



   :rtype: void

.. rst-class:: ts-api-section

setVerticesFloat32Array
-----------------------

.. js:method:: PartLines.setVerticesFloat32Array( vertices)

   :param vertices: None
   :type vertices: Float32Array


   Sets the vertices for the lines from a Float32Array.

   The coordinates need to be interleaved (x0, y0, z0, x1, y1, z1, ...)

   This is the most optimal setting as the PartLines will just hold a reference to the passed array and
   not copy any data.

   Lines will be drawn between [x0, y0, z0] and [x1, y1, z1], and between [x2, y2, z2] and [x3, y3, z3], ...,
   so the number of lines will be vertices.length / 6.


   :rtype: void

