Polyline

class rhino3dm.Polyline
Polyline()

Polyline constructor

Polyline(initialCapacity)

Initializes a new empty polyline with an initial capacity.

Parameters:

initialCapacity (int) – Number of vertices this polyline can contain without resizing.

Polyline()

Polyline constructor

IsValid

bool: Gets a value that indicates whether this polyline is valid. Valid polylines have at least one segment, no Invalid points and no zero length segments.Closed polylines with only two segments are also not considered valid.

SegmentCount

int: Gets the number of segments for this polyline.

IsClosed

bool: Test a polyline to see if it is closed.

Length

float: Gets the total length of the polyline.

IsClosedWithinTolerance(tolerance)

Test a polyline to see if it is closed.

Parameters:

tolerance (float) – The tolerance.

Returns:

Returns True if polyline has 4 or more points, the distance between the start and end points is <= tolerance, and there is a point in the polyline whose distance from the start and end points is > tolerance.

Return type:

bool

PointAt(t)

Gets the point on the polyline at the given parameter. The integer part of the parameter indicates the index of the segment.

Parameters:

t (float) – Polyline parameter.

Returns:

The point on the polyline at t.

Return type:

rhino3dm.Point3d

TangentAt(t)

Gets the unit tangent vector along the polyline at the given parameter. The integer part of the parameter indicates the index of the segment.

Parameters:

t (float) – Polyline parameter.

Returns:

The tangent along the polyline at t.

Return type:

rhino3dm.Vector3d

ClosesPoint(testPoint)

[todo] add documentation

ClosestParameter(testPoint)

Gets the parameter along the polyline which is closest to a test-point.

Parameters:

testPoint (rhino3dm.Point3d) – Point to approximate.

Returns:

The parameter along the polyline closest to testPoint.

Return type:

float

ToNurbsCurve()

Constructs a nurbs curve representation of this polyline.

Returns:

A Nurbs curve shaped like this polyline or None on failure.

Return type:

rhino3dm.NurbsCurve

ToPolylineCurve()

Constructs a polyline curve representation of this polyline.

Returns:

A curve shaped like this polyline or None on failure.

Return type:

PolylineCurve

GetSegments()

Constructs an array of line segments that make up the entire polyline.

Returns:

An array of line segments or None if the polyline contains fewer than 2 points.

Return type:

Line[]

SegmentAt(index)

Gets the line segment at the given index.

Parameters:

index (int) – Index of segment to retrieve.

Returns:

Line segment at index or Line.Unset on failure.

Return type:

Line

static CreateInscribedPolygon(circle, sideCount)

Create a regular polygon inscribed in a circle. The vertices of the polygon will be on the circle.

Parameters:
  • circle (Circle) – The circle.

  • sideCount (int) – The number of sides

Returns:

A closed polyline if successful, None otherwise.

Return type:

rhino3dm.Polyline

static CreateCircumscribedPolygon(circle, sideCount)

Create a regular polygon circumscribe about a circle. The midpoints of the polygon’s edges will be tangent to the circle.

Parameters:
  • circle (Circle) – The circle.

  • sideCount (int) – The number of sides

Returns:

A closed polyline if successful, None otherwise.

Return type:

rhino3dm.Polyline

static CreateStarPolygon(circle, radius, cornerCounts)

Create a regular star polygon. The star begins at circle.PointAt(0) and the vertices alternate between being on circle and begin on a concentric circle of other_radius.

Parameters:
  • circle (Circle) – The circle.

  • radius (float) – The radius of other circle.

  • cornerCount (int) – The number of corners on the circle. There will be 2*cornerCount sides and 2*cornerCount vertices.

Returns:

A closed polyline if successful, None otherwise.

Return type:

rhino3dm.Polyline