Table of Contents

Class DxfPolyline

Namespace
GeometryHelper.Dxf
Assembly
GeometryHelper.dll

A LWPOLYLINE of a DXF file, as AutoCAD's Polyline: a chain of vertices in the plane of its Normal at its Elevation, each segment a line or, where the vertex it leaves has a bulge, an arc, with a width at each end of each segment.

public sealed class DxfPolyline : DxfCurve
Inheritance
DxfPolyline
Inherited Members

Remarks

The vertices are in the system of the polyline's normal, as AutoCAD's GetPoint2dAt(int) gives them; GetPoint3dAt(int) gives them in the world. The polyline (0, 0), (10, 0), (10, 10) with a bulge of 1 on its second vertex is a line 10 long and a half circle of radius 5, Length 25.71; its parameter is AutoCAD's, the index of the vertex a segment leaves plus how far along it, in angle on an arc: 1.5 is (15, 5), the far side of the half circle.

A vertex set is written in its groups 10 and 20 (40 and 41 for its widths, 42 for its bulge) as DxfWriter writes a number, the other vertices and every other group of the record kept as they were. A file older than R14 has no LWPOLYLINE: AppendEntity(DxfEntity) refuses one there, and a DxfPolyline2d is added instead.

Constructors

DxfPolyline()

Initializes a polyline of no vertices, as AutoCAD's new Polyline(), on layer 0 in no file; give it its vertices with AddVertexAt(int, GeoPoint2, double, double, double).

DxfPolyline(int)

Initializes a polyline of no vertices, as AutoCAD's new Polyline(vertices), which only makes room for that many.

Properties

Area

Gets the area the polyline closes, as AutoCAD's Area: that of the polygon of its vertices with what each arc adds or takes off; an open polyline taken as closed by a line from its last vertex to its first.

Closed

Gets or sets whether a segment runs from the last vertex back to the first (flag 1 of group 70), as AutoCAD's Closed.

ConstantWidth

Gets or sets the width of the whole polyline, as AutoCAD's ConstantWidth: the width every segment has at both ends, a vertex with no width of its own taking the constant width of group 43; nought where the widths differ.

Elevation

Gets or sets how far the plane of the polyline stands from the origin along its normal (group 38), as AutoCAD's Elevation; nought where the record gives none.

EndParam

Gets the parameter at the end of the polyline: the count of its segments, as AutoCAD's.

HasBulges

Gets whether a vertex has a bulge other than nought, as AutoCAD's HasBulges.

HasWidth

Gets whether the polyline has a width other than nought anywhere, as AutoCAD's HasWidth: a vertex's, or the constant width. Asked of a polyline whose vertices are not read, it keeps none of them.

IsOnlyLines

Gets whether every segment is a line, none an arc, as AutoCAD's IsOnlyLines.

Length

Gets the length of the polyline, the sum of those of its segments, as AutoCAD's Length.

Normal

Gets or sets the normal of the plane of the polyline (groups 210, 220, 230), of unit length; (0, 0, 1) where the record gives none.

NumberOfVertices

Gets how many vertices the polyline has, as AutoCAD's NumberOfVertices: its groups 10.

Plinegen

Gets or sets whether the linetype runs on round the vertices rather than starting again at each (flag 128 of group 70), as AutoCAD's Plinegen.

Thickness

Gets or sets how far the polyline stands up along its Normal (group 39); nought where the record gives none.

Methods

AddVertexAt(int, GeoPoint2, double, double, double)

Adds a vertex, as AutoCAD's AddVertexAt: before the vertex of the index, or after the last where the index is the count. Its widths are written where either is not nought, its bulge where it is not.

ConvertFrom(DxfEntity, bool)

Gives the polyline the vertices, look and data of a DxfPolyline2d, as AutoCAD's ConvertFrom: its vertices with their bulges and widths in the same system, its normal, elevation, thickness, closure, linetype generation and constant width; with transferId this polyline takes the other's place in its drawing, its handle, owner, extension dictionary and reactors, as AutoCAD hands the object id over, and the other is erased. A curve-fitted polyline gives its vertices as drawn, the extra ones the fitting made among them; one fitted with a spline is refused, as AutoCAD refuses it.

ConvertTo(bool)

Gets a DxfPolyline2d of the polyline's vertices, look and data, as AutoCAD's ConvertTo: its vertices with their bulges and widths, its normal, elevation, thickness, closure and linetype generation; with transferId the new polyline takes this one's place in its drawing, its handle, owner, extension dictionary and reactors, and this one is erased, as AutoCAD hands the object id over.

Explode()

Gets the lines and arcs the polyline breaks into, as AutoCAD's Explode: a LINE for each straight segment and an ARC for each bulged one, in its order, in the plane of its normal at its elevation, each with its look and thickness; its widths left out, as AutoCAD leaves them out, and a segment of no length too. A closed square of side 10 with one side bulged by 1 comes out as three lines and a half circle, and a donut, two vertices 10 apart each bulged by 1 and closed, as two half circles of radius 5. Each LINE and ARC is on the polyline's Normal, as AutoCAD gives it the polyline's, so that its wall stands up the same way: on the normal (0, 0, -1) at elevation 5 with a thickness of 2, the walls stand from z = -5 down to -7.

Extend(bool, GeoPoint3)

Moves an end of the polyline to a point on its end segment run on, as AutoCAD's Extend: on the line through a line segment or the circle of an arc, in the polyline's plane, past the end it moves: a point on the segment itself is refused, as a spline's is, an end being run on and not cut back.

Extend(double)

Runs an end segment of the polyline on to a parameter past an end, as AutoCAD's Extend: above EndParam the last segment on, its end vertex moved to how far past it the parameter is along that segment (EndParam + 0.5 runs it on by half its length, or half its angle on an arc); below nought the first back. A line runs on along itself, an arc round its circle, its bulge that of the arc it becomes; the widths run on as they change along it. The record is written once.

GetArcSegment2dAt(int)

Gets the arc that leaves a vertex in the system of the polyline's normal, as AutoCAD's GetArcSegment2dAt.

GetArcSegmentAt(int)

Gets the arc that leaves a vertex in the world, as AutoCAD's GetArcSegmentAt, as the reader reads one.

GetBulgeAt(int)

Gets the bulge of the segment that leaves a vertex (group 42), as AutoCAD's GetBulgeAt: nought for a line.

GetClosestPointTo(GeoPoint3, bool)

Gets the point of the polyline nearest a point, as AutoCAD's GetClosestPointTo: the first segment's where two are as near. The polyline is not extended past its ends.

GetDistAtPoint(GeoPoint3)

Gets the distance along the polyline from its start to a point of it, as AutoCAD's GetDistAtPoint.

GetDistanceAtParameter(double)

Gets the distance along the polyline from its start to a parameter, as AutoCAD's GetDistanceAtParameter.

GetEndWidthAt(int)

Gets the width of the polyline where the segment that leaves a vertex ends (group 41), as AutoCAD's GetEndWidthAt: the polyline's constant width (43) where the vertex gives none.

GetFirstDerivative(double)

Gets the derivative of the point by the parameter, as AutoCAD's GetFirstDerivative: on a line the vector from its start to its end, on an arc the tangent as long as the arc.

GetLineSegment2dAt(int)

Gets the line segment that leaves a vertex in the system of the polyline's normal, as AutoCAD's GetLineSegment2dAt.

GetLineSegmentAt(int)

Gets the line segment that leaves a vertex in the world, as AutoCAD's GetLineSegmentAt.

GetOffsetCurves(double)

Gets the polylines at a distance from this one in its plane, as AutoCAD's GetOffsetCurves: to the right of its way seen from the tip of its Normal where the distance is above nought, so that a closed polyline running counter-clockwise grows and an arc segment running so takes the larger radius, as a DxfArc does. The arcs stay arcs and the corners are run on until the segments meet, as AutoCAD's OFFSETGAPTYPE 0 runs them; where a part comes nearer the polyline than the distance it is cut away, as the library's offsets of a chain cut it, which can leave several polylines or none. The square 10 by 10 counter-clockwise offset by 1 is the square 12 by 12 about the same centre. Each keeps the look, elevation, normal, thickness and constant width; widths of the vertices go. A closed polyline that crosses itself, a side passing through another, has none, as AutoCAD 2021 gives none of the bow tie (-10, 1), (10, -1), (10, 1), (-10, -1), and one Debug line says so; one that only touches itself is offset.

GetOffsetCurvesGivenPlaneNormal(GeoVector3, double)

Gets the polylines at a distance from this one in the plane of a normal, as AutoCAD's GetOffsetCurvesGivenPlaneNormal: as GetOffsetCurves(double), the plane being the polyline's own, and the side the right seen from the tip of the normal given, the left of the polyline's way where it is the polyline's normal turned over. A DxfArc and a DxfCircle grow their radius whichever way the normal given points, so that under the normal turned over a polyline of one arc and that arc offset to opposite sides.

GetParameterAtDistance(double)

Gets the parameter at a distance along the polyline from its start, as AutoCAD's GetParameterAtDistance.

GetParameterAtPoint(GeoPoint3)

Gets the parameter at a point of the polyline, as AutoCAD's GetParameterAtPoint.

GetPoint2dAt(int)

Gets a vertex in the system of the polyline's normal (groups 10 and 20), as AutoCAD's GetPoint2dAt.

GetPoint3dAt(int)

Gets a vertex in the world, as AutoCAD's GetPoint3dAt: the vertex at the polyline's elevation, taken from the system of its normal to the world as DxfReader takes it.

GetPointAtDist(double)

Gets the point at a distance along the polyline from its start, as AutoCAD's GetPointAtDist.

GetPointAtParameter(double)

Gets the point at a parameter, the index of a vertex plus how far along the segment it leaves, as AutoCAD's GetPointAtParameter.

GetSecondDerivative(double)

Gets the second derivative of the point by the parameter, as AutoCAD's GetSecondDerivative: nought on a line.

GetSegmentType(int)

Gets what the segment that leaves a vertex is, as AutoCAD's GetSegmentType: a line, an arc, one whose ends are the same point within the point tolerance, the one vertex of a polyline that has no other, or none for the last vertex of an open polyline.

GetSplitCurves(IReadOnlyList<double>)

Gets the pieces the polyline is cut into at parameters, as AutoCAD's GetSplitCurves: polylines of the same look in no file, an open one from its start to the first parameter, on to the next and to its end, a closed one from each to the next and from the last on round its first vertex to the first, given whole where it is cut at fewer than two places. A segment cut keeps the part of its arc (its bulge that of the part) and its widths read off along it: the polyline (0, 0), (10, 0), (10, 10) with a bulge of 1 on its second vertex cut at 1.5 is (0, 0), (10, 0), (15, 5) with a bulge of 0.414 and (15, 5), (10, 10) with the same. A parameter at an end or within the point tolerance along the polyline of another cuts nothing.

GetStartWidthAt(int)

Gets the width of the polyline where the segment that leaves a vertex starts (group 40), as AutoCAD's GetStartWidthAt: the polyline's constant width (43) where the vertex gives none.

OnSegmentAt(int, GeoPoint2, double)

Gets whether a point of the plane lies on the segment that leaves a vertex, within the point tolerance, as AutoCAD's OnSegmentAt.

RemoveVertexAt(int)

Takes a vertex out, as AutoCAD's RemoveVertexAt. A polyline keeps two vertices at least, as AutoCAD keeps one on save and audit: the vertex is not taken out where fewer would be left.

Reset(bool, int)

Keeps the first vertices and takes the others out, as AutoCAD's Reset: where the vertices are reused, as many as given are kept. A polyline keeps two vertices at least, so a reset that would leave fewer is refused.

ReverseCurve()

Turns the polyline to run from its end to its start, as AutoCAD's ReverseCurve: the vertices in the other order, each segment's bulge turned over and its widths swapped; a closed polyline keeps its first vertex.

SetBulgeAt(int, double)

Sets the bulge of the segment that leaves a vertex, as AutoCAD's SetBulgeAt: 1 is a half circle to the left.

SetEndWidthAt(int, double)

Sets the width where the segment that leaves a vertex ends, as AutoCAD's SetEndWidthAt.

SetFromGeCurve(object)

Gives the polyline the vertices and bulges of a chain or loop, as AutoCAD's SetFromGeCurve, written as DxfWriter writes one as a LWPOLYLINE: a GeoPolyline2, GeoPolylineArc2, GeoPolygon2 or GeoPolygonArc2 on the normal (0, 0, 1) at no elevation, closed for a loop, read back by the matching method of the plane to the bit; a GeoPolyline3, GeoPolylineArc3, GeoPolygon3 or GeoPolygonArc3 whose every vertex is within the default point tolerance of the plane through its first vertex square to the polyline's own Normal, and no point of its arcs further off it than the planar tolerance (a half circle of radius 100 turned 0.001 out of it stands 0.1 off, and is written in its own plane), in the system of that normal, at the elevation of its first vertex, so that a mirrored polyline stays mirrored and a chain on one line has a plane to be in: the polyline (0, 0), (10, 0) at the elevation 5 takes the chain from (0, 0, 5) to (20, 0, 5) and gives it back from ToGeoPolyline3() to the bit. Any other of those is written in the system of the plane it lies in within the default tolerance, its normal turned up in its largest component; the chain from (0, 0, 0) to (10 000, 0, 0.1), on one line and off the polyline's plane by more than the tolerance, lies in none and is refused, not flattened. Its handle, layer, look, thickness and extended data are kept, as DxfEntity's setters keep them. Where the shape is written anew, its widths and its linetype generation (Plinegen) are not kept; a shape written as the shape it has now is written, as the one GetGeometry() gives, leaves it as it is, widths and fitting and all.

SetPointAt(int, GeoPoint2)

Moves a vertex, given in the system of the polyline's normal, as AutoCAD's SetPointAt.

SetStartWidthAt(int, double)

Sets the width where the segment that leaves a vertex starts, as AutoCAD's SetStartWidthAt. A constant width the polyline had is given to every vertex first, as the widths are no longer one.

ToGeoPolygon2()

Gets the polyline as a loop of straight edges of the plane, as ToGeoPolygon3() reads it, where it lies on the floor as ToGeoPolyline2() says: the closed polyline (0, 0), (10, 0), (10, 10) at no elevation is the GeoPolygon2 of those corners.

ToGeoPolygon2(Tolerance)

Gets the polyline as a loop of straight edges of the plane, as ToGeoPolygon2() does, within a tolerance, which says which vertices are one and whether it encloses an area.

ToGeoPolygon3()

Gets the polyline as a loop of straight edges in the world: closed or not, its last vertex joined back to its first, as the AutoCAD bridge's ToGeoPolygonArc2 joins one, and a last vertex on the first left out. The closed polyline (0, 0), (10, 0), (10, 10) at the elevation 5 is the GeoPolygon3 of those three corners at z = 5, as GetGeometry() gives it. A polyline with an arc is refused (ToGeoPolygonArc3() gives it), and so is one that encloses no area, its vertices on one line.

ToGeoPolygonArc2()

Gets the polyline as a loop with arcs of the plane, as ToGeoPolygonArc3() reads it, where it lies on the floor as ToGeoPolyline2() says: the closed polyline (0, 0), (10, 0), (10, 10), (0, 10) with a bulge of -0.25 on its second vertex is the GeoPolygonArc2 of those corners and that bulge, as the AutoCAD bridge's ToGeoPolygonArc2 reads it from AutoCAD.

ToGeoPolygonArc2(Tolerance)

Gets the polyline as a loop with arcs of the plane, as ToGeoPolygonArc2() does, within a tolerance, which says which vertices are one and whether it encloses an area.

ToGeoPolygonArc3()

Gets the polyline as a loop with arcs in the world, bulge for bulge: closed or not, its last vertex joined back to its first, the bulge of the last vertex that of the closing edge, as the AutoCAD bridge's ToGeoPolygonArc2 reads one. A closed polyline of two vertices with an arc, a circle drawn as two half circles, has its first arc halved at its middle, as the reader reads it, so that it has the three vertices a loop has: two half circles of radius 10 are the GeoPolygonArc3 of area 314.159. One with no arc is the loop whose bulges are all nought. A loop of no area, read as an area at the vector tolerance, is refused.

ToGeoPolyline2()

Gets the polyline as a chain of straight segments of the plane, as ToGeoPolyline3() reads it, where it lies on the floor as DxfReader reads one with PlanAs2D: its normal (0, 0, 1) and its elevation nought, its vertices as they are; or its normal (0, 0, -1), as AutoCAD writes a mirrored polyline, its x turned over and its bulges negated, the vertices in their order. One at an elevation, or on a tilted normal, is refused rather than flattened; GetPoint2dAt(int) gives its vertices in the system of its normal whatever that is, as the AutoCAD bridge reads them.

ToGeoPolyline2(Tolerance)

Gets the polyline as a chain of straight segments of the plane, as ToGeoPolyline2() does, within a tolerance, which says which vertices are one.

ToGeoPolyline3()

Gets the polyline as a chain of straight segments in the world, of its vertices as DxfReader reads them: the polyline (0, 0), (10, 0), (10, 10) at the elevation 5 is the GeoPolyline3 through (0, 0, 5), (10, 0, 5) and (10, 10, 5); closed, the chain runs on back to (0, 0, 5), as the AutoCAD bridge's ToGeoPolylineArc2 reads a closed one. A vertex within the point tolerance of the one before it is left out with the segment between them. A polyline with an arc is refused, its arcs not cut into chords here: ToGeoPolylineArc3() gives it exactly. Its widths are no part of the shape.

ToGeoPolylineArc2()

Gets the polyline as a chain with arcs of the plane, as ToGeoPolylineArc3() reads it, where it lies on the floor as ToGeoPolyline2() says: the polyline above is the GeoPolylineArc2 of a line from (0, 0) to (10, 0) and a half circle to (10, 10).

ToGeoPolylineArc2(Tolerance)

Gets the polyline as a chain with arcs of the plane, as ToGeoPolylineArc2() does, within a tolerance, which says which vertices are one.

ToGeoPolylineArc3()

Gets the polyline as a chain with arcs in the world, bulge for bulge, as DxfReader reads its vertices: the bulge on a vertex is that of the segment leaving it, and on the last vertex of an open polyline belongs to nothing; closed, the chain runs on back to its first vertex, the bulge of the last vertex that of the closing segment. The polyline (0, 0), (10, 0), (10, 10) with a bulge of 1 on its second vertex is the GeoPolylineArc3 of a line 10 long and a half circle of radius 5; one with no arc the chain whose bulges are all nought.