PolyCurve
=========

.. py:module:: rhino3dm

.. py:class:: PolyCurve

   .. py:method:: PolyCurve()

      PolyCurve constructor


   .. py:attribute:: SegmentCount

      int: Gets the number of segments that make up this Polycurve.

   .. py:attribute:: IsNested

      bool: Gets a value indicating whether or not a PolyCurve contains nested PolyCurves.

   .. py:attribute:: HasGap

      bool: This is a quick way to see if the curve has gaps between the sub curve segments.

   .. py:method:: SegmentCurve(index)

      Gets the segment curve at the given index.

      :param int index: Index of segment to retrieve.

      :return: The segment at the given index or None on failure.

      :rtype: rhino3dm.Curve

   .. py:method:: RemoveNesting()

      Explodes nested polycurve segments and reconstructs this curve from the shattered remains.
      The result will have not have any PolyCurves as segments but it will have identical
      locus and parameterization.

      :return: True if any nested PolyCurve was found and absorbed, False if no PolyCurve segments could be found.

      :rtype: bool

   .. py:method:: Explode()

      Explodes this PolyCurve into a list of Curve segments. This will not explode nested polycurves.
      Call  first if you need all individual segments.

      :return: An array of polycurve segments.

      :rtype: rhino3dm.Curve[]

   .. py:method:: Append(line)

      Appends and matches the start of the line to the end of polycurve.
      This function will fail if the polycurve is closed.

      :param Line line: Line segment to append.

      :return: True on success, False on failure.

      :rtype: bool

   .. py:method:: Append(arc)

      Appends and matches the start of the line to the end of polycurve.
      This function will fail if the polycurve is closed.

      :param Line line: Line segment to append.

      :return: True on success, False on failure.

      :rtype: bool

   .. py:method:: Append(curve)

      Appends and matches the start of the line to the end of polycurve.
      This function will fail if the polycurve is closed.

      :param Line line: Line segment to append.

      :return: True on success, False on failure.

      :rtype: bool

   .. py:method:: AppendSegment(curve)

      Appends the curve to the polycurve without changing the new segment's geometry.
      This function will fail if the PolyCurve is closed or if SegmentCount > 0 and the new segment is closed.

      :param rhino3dm.Curve curve: Segment to append.

      :return: True on success, False on failure.

      :rtype: bool

   .. py:method:: SegmentCurveParameter(polycurveParameter)

      Converts a polycurve parameter to a segment curve parameter.

      :param float polycurveParameter: Parameter on PolyCurve to convert.

      :return: Segment curve evaluation parameter or UnsetValue if the \
         segment curve parameter could not be computed.

      :rtype: float

   .. py:method:: PolyCurveParameter(segmentIndex, segmentCurveParameter)

      Converts a segment curve parameter to a polycurve parameter.

      :param int segmentIndex: Index of segment.
      :param float segmentCurveParameter: Parameter on segment.

      :return: Polycurve evaluation parameter or UnsetValue if the polycurve curve parameter could not be computed.

      :rtype: float

   .. py:method:: SegmentDomain(segmentIndex)

      Returns the polycurve sub-domain assigned to a segment curve.

      :param int segmentIndex: Index of segment.

      :return: The polycurve sub-domain assigned to a segment curve. \
         Returns Interval.Unset if segment_index < 0 or segment_index >= Count().

      :rtype: rhino3dm.Interval

   .. py:method:: SegmentIndex(polycurveParameter)

      Finds the segment used for evaluation at polycurve_parameter.

      :param float polycurveParameter: Parameter on polycurve for segment lookup.

      :return: Index of the segment used for evaluation at polycurve_parameter. \
         If polycurve_parameter < Domain.Min(), then 0 is returned. \
         If polycurve_parameter > Domain.Max(), then Count()-1 is returned.

      :rtype: int
