Class DxfLeader
- Namespace
- GeometryHelper.Dxf
- Assembly
- GeometryHelper.dll
A LEADER of a DXF file, as AutoCAD's Leader: a line through its vertices in the world, with an arrow at its first,
drawn straight or as a spline, that points to an MTEXT, a TOLERANCE or an INSERT (Annotation), drawn by its
dimension style with the overrides of its extended data.
public sealed class DxfLeader : DxfCurve
- Inheritance
-
DxfLeader
- Inherited Members
Remarks
The leader through (0, 0, 0), (10, 10, 0) and (20, 10, 0) has three vertices, FirstVertex where its arrow is and LastVertex where its words are; as a curve its parameter is AutoCAD's, the index of a vertex plus how far along the segment it leaves, so that 1.5 is (15, 10, 0), and its length is 24.14. Splined (IsSplined), it is walked along the spline fitted through its vertices, as Explode() fits one, its parameter the lengths of its chords, the spline fitted once and kept until the drawing is next changed. GetGeometry() gives that curve, the polyline of its vertices or the spline, so that IntersectWith(DxfEntity, DxfIntersect) meets the leader on it, as AutoCAD's does: the leader from (0, 0, 0) to (10, 5, 0) meets the line x = 5 at (5, 2.5, 0).
The size of its arrow, the gap to its words and the other variables of its dimension style AutoCAD lets one leader have
of its own are read from its overrides where it has them, the extended data of ACAD between DSTYLE and its
braces, as AutoCAD and ezdxf write them, and from its dimension style where it has not: Dimasz 2.5 of the
style Standard until it is set to 3.5, which writes the override 1070 41, 1040 3.5. A variable a style gives no
value of is AutoCAD's own default, the one of its imperial drawing (DIMASZ 0.18). A copy in no file
(Clone()) reads the dimension style, the arrow block and the linetype of the drawing it was copied
from, as its original does.
Each property is written into the LEADER's own groups, every other group keeping its text; a property given the value
it has changes nothing. AutoCAD draws a leader anew from its vertices and its annotation (EvaluateLeader): what it
draws is not in the file, and the library writes the data it is drawn from. A file older than R13 has no LEADER, and
AppendEntity(DxfEntity) refuses one there.
Constructors
- DxfLeader()
Initializes a LEADER of no vertices with an arrow and no annotation, in the dimension style Standard, as AutoCAD's
new Leader(), on layer 0 in no file; give it its vertices with AppendVertex(GeoPoint3), two at least.
Properties
- AnnoHeight
Gets the height of the words the leader points to (group 40) as the file writes it, as AutoCAD's
AnnoHeight; nought where it gives none.
- AnnoType
Gets what the leader points to (group 73), as AutoCAD's
AnnoType; NoAnnotation where the record gives none.
- AnnoWidth
Gets the width of the words the leader points to (group 41) as the file writes it, as AutoCAD's
AnnoWidth; nought where it gives none.
- Annotation
Gets or sets what the leader points to, as AutoCAD's
Annotationgives its id: the MTEXT, TOLERANCE or INSERT of its handle (group 340) in the drawing; null where it points to none, or to a handle the drawing has no entity of.
- AnnotationOffset
Gets or sets how far the last vertex stands off the point the annotation is placed at (groups 213, 223, 233), as AutoCAD's
AnnotationOffset, in the world; nought where the record gives none.
- Closed
Gets false: a leader does not close, as AutoCAD's does not.
- Dimasz
Gets or sets the size of the arrow (DIMASZ, 41), as AutoCAD's
Dimasz: the leader's override, else its style's.
- Dimclrd
Gets or sets the colour of the leader (DIMCLRD, 176), as AutoCAD's
Dimclrd: a colour of the index, BYBLOCK or BYLAYER; the override, else the style's.
- DimensionStyle
Gets or sets the dimension style the leader is drawn by, as AutoCAD's
DimensionStylegives its id: by its name, as DimensionStyleName reads and writes it.
- DimensionStyleName
Gets or sets the name of the dimension style the leader is drawn by (group 3), as AutoCAD's
DimensionStyleName;Standardwhere the record gives none.
- Dimgap
Gets or sets the gap between the leader's hook and its words (DIMGAP, 147), as AutoCAD's
Dimgap: the override, else the style's.
- Dimldrblk
Gets or sets the block drawn as the arrow (DIMLDRBLK, 341), as AutoCAD's
Dimldrblkgives its id: the block of the override's handle (1005), else of the style's; null for AutoCAD's closed filled arrow, which needs no block.
- Dimlwd
Gets or sets the lineweight of the leader (DIMLWD, 371), as AutoCAD's
Dimlwd: the override, else the style's.
- Dimsah
Gets or sets whether the arrows are blocks of their own (DIMSAH, 173), as AutoCAD's
Dimsah: the override, else the style's.
- Dimscale
Gets or sets the scale of the sizes of the style (DIMSCALE, 40), as AutoCAD's
Dimscale: the override, else the style's.
- Dimtad
Gets or sets where the words stand against the hook (DIMTAD, 77), as AutoCAD's
Dimtad: 0 centred, 1 above; the override, else the style's.
- Dimtxt
Gets or sets the height of the words (DIMTXT, 140), as AutoCAD's
Dimtxt: the override, else the style's.
- EndParam
Gets the parameter at the last vertex, as AutoCAD's: the count of the segments of a straight leader; of a splined one the sum of the lengths of the chords between its vertices, as AutoCAD 2021 runs it, the spline fitted through its vertices walked over that length: 24.14 through (0, 0, 0), (10, 10, 0) and (20, 10, 0).
- EndPoint
Gets the last vertex, as AutoCAD's
EndPointof a leader.
- FirstVertex
Gets the first vertex, where the arrow is, as AutoCAD's
FirstVertex.
- GeometricExtents
Gets the box the leader fills, as AutoCAD's
GeometricExtents, its arrowhead not counted: the box of its vertices, a leader from (0, 0, 0) to (10, 5, 0) giving the box from the one to the other; a splined one (IsSplined) too, as AutoCAD 2021 gives it, though its spline bows past them: through (0, 0, 0), (10, 10, 0) and (20, 10, 0) the spline rises to y = 10.43 between the second vertex and the last, and the box runs from (0, 0, 0) to (20, 10, 0).
- HasArrowHead
Gets or sets whether an arrow is drawn at the first vertex (group 71), as AutoCAD's
HasArrowHead; true where the record gives none.
- HasHookLine
Gets whether a short line runs on from the last vertex to the annotation (group 75), as AutoCAD's
HasHookLine; true where the record gives none, as ezdxf reads one, which leaves the group out when it is 1.
- IsPlanar
Gets whether the leader lies in one plane, as AutoCAD's
IsPlanar: whether GetPlane() finds one, every vertex in the plane of its Normal through its first to Default. The leader through (0, 0, 0), (10, 10, 0) and (20, 10, 0) lies in one; its last vertex lifted to (20, 10, 0.5), it does not.
- IsSplined
Gets or sets whether the leader is drawn as a spline through its vertices (group 72 of 1), as AutoCAD's
IsSplined, rather than straight.
- LastVertex
Gets the last vertex, by the annotation, as AutoCAD's
LastVertex.
- Normal
Gets the normal of the plane of the leader (groups 210, 220, 230), as AutoCAD's
Normal: of unit length, (0, 0, 1) where the record gives none.
- NumVertices
Gets how many vertices the leader has, as AutoCAD's
NumVertices: its groups 10.
- Spline
Gets the spline that is exactly the leader, as AutoCAD's
Spline: of a straight leader, of degree 1 through its vertices, a knot at each step of its parameter; of a splined one, the spline fitted through its vertices, which Explode() gives where the leader has no arrow, of degree 3, its knots from 0 to EndParam, the sum of the lengths of its chords. A new DxfSpline in no file, on layer 0 with no look of its own.
- StartPoint
Gets the first vertex, as AutoCAD's
StartPointof a leader.
Methods
- AppendVertex(GeoPoint3)
Adds a vertex after the last, as AutoCAD's
AppendVertex: written as DxfWriter writes a number, with the count of the vertices (76).
- Explode()
Gets the arrowhead and the line, or the spline, the leader breaks into, as AutoCAD 2021's
Explodegives them: first, where it has an arrow (HasArrowHead), its arrowhead at the first vertex pointing away from the second, Dimasz times Dimscale long (a scale of nought taken as 1): an INSERT of the block of Dimldrblk turned and scaled so, or, where it names none, AutoCAD's closed filled arrow as a SOLID a third as wide as long, its corners the one on the right of the leader, the tip, and the one on its left; then one LWPOLYLINE through its vertices on its plane (a LINE between each two, a leader whose vertices stand off the plane of its normal, which a polyline cannot hold), or for a splined one (IsSplined) one SPLINE of degree 3 through them, starting along its first segment and ending along its last, its knots the lengths of the chords. Where it has an arrow, the line starts at the arrow's back, the arrow's length along its first segment. Each has the leader's own look, its colour, true colour, linetype and lineweight, whatever its dimension style or its overrides draw a leader with, as AutoCAD 2021 gives them. The leader from (0, 0, 0) through (10, 10, 0) to (20, 10, 0) with an arrow 2.5 long gives a SOLID of the corners (2.06, 1.47, 0), (0, 0, 0) and (1.47, 2.06, 0), and a polyline from (1.77, 1.77, 0) through (10, 10, 0) to (20, 10, 0). The hook AutoCAD runs on under the words of a leader that has one and holds its words above or below its line (Dimtad not nought), to where they end, is AutoCAD's to work out from its fonts, and is among them where the drawing's FontSearchPath measures the MTEXT it points to (check F1b): the last vertex moved along the hook to the far end of the words, "ABC" of txt.shx 2.5 high held at (22, 10, 0), its hook ending at (21.375, 8.125, 0), giving a polyline ending at (28.667, 8.125, 0).
- GetClosestPointTo(GeoPoint3, bool)
Gets the point of the leader nearest a point, as AutoCAD's
GetClosestPointTo: the first segment's where two are as near.
- GetDimstyleData()
Gets the variables the leader is drawn with, as AutoCAD's
GetDimstyleData: a new DxfDimStyleTableRecord in no table, named as its DimensionStyleName, each of its 74 variables as the leader reads it, its override (the list DSTYLE of its extended data of ACAD) where it has one, else its style's, else AutoCAD's own. A leader of the style ISO-25 given an arrow 3.5 long givesDimasz3.5 andDimtxt2.5, the style's.
- GetDistAtPoint(GeoPoint3)
Gets the distance along the leader from its first vertex to a point of it, as AutoCAD's
GetDistAtPoint.
- GetDistanceAtParameter(double)
Gets the distance along the leader from its first vertex to a parameter, as AutoCAD's
GetDistanceAtParameter.
- GetFirstDerivative(double)
Gets the derivative of the point by the parameter, as AutoCAD's
GetFirstDerivative: on a segment of a straight leader the vector from its start to its end; of a splined one the spline's.
- GetParameterAtDistance(double)
Gets the parameter at a distance along the leader from its first vertex, as AutoCAD's
GetParameterAtDistance.
- GetParameterAtPoint(GeoPoint3)
Gets the parameter at a point of the leader, as AutoCAD's
GetParameterAtPoint.
- GetPlane()
Gets the plane of the leader, as AutoCAD's
GetPlane: that of its Normal through its first vertex, where every vertex lies in it to Default.
- GetPointAtDist(double)
Gets the point at a distance along the leader from its first vertex, as AutoCAD's
GetPointAtDist.
- GetPointAtParameter(double)
Gets the point at a parameter, as AutoCAD's
GetPointAtParameter: of a straight leader the index of a vertex plus how far along the segment it leaves; of a splined one the parameter of the spline fitted through its vertices, run from 0 to EndParam, as each of these members of a splined leader walks that spline.
- GetSecondDerivative(double)
Gets the second derivative of the point by the parameter, as AutoCAD's
GetSecondDerivative: nought on the segments of a straight leader; of a splined one the spline's.
- RemoveLastVertex()
Takes the last vertex out, as AutoCAD's
RemoveLastVertex. A leader keeps two vertices, as AutoCAD keeps one: the vertex is not taken out where fewer would be left.
- SetDimstyleData(DxfDimStyleTableRecord)
Gives the leader the variables of a record, as AutoCAD's
SetDimstyleData: each that differs from what the leader reads written as an override, as AutoCAD writes one (1070 41, 1040 3.5), its dimension style left as it is; those it reads already change nothing, so that the record of its own style writes only where an override differs from the style. A block, linetype or text style is written by its handle, none by the handle 0; a record that names no text style leaves the leader's as it is. A variable the file's version has not is passed over where the record holds AutoCAD's own value of it, and refused where it holds another. A whole number is checked against AutoCAD's range as SetDimstyleData(DxfDimStyleTableRecord) checks it, aDimdecof 9 refused, and a size of the arrow, the text or the scale below nought. Every value is checked before any is written.
- SetFromStyle()
Takes away the leader's overrides of its dimension style, as AutoCAD's
SetFromStyle: the list DSTYLE of its extended data of ACAD, the rest of that data kept, and the data of ACAD with it where nothing else is left; each variable then reads as its style has it, a leader ofDimasz3.5 over the style Standard reading 2.5. A leader of no overrides changes nothing; the colour it writes for DIMCLRD BYBLOCK (77) is its own, not an override, and stays.
- SetPlane(GeoPlane3)
Puts the leader in a plane, as AutoCAD's
SetPlane: its normal (210) the plane's, each vertex moved straight onto the plane, and the direction of its hook line (211) laid in the plane, the x axis of the plane's own system where it stood along the normal. The leader through (0, 0, 5), (10, 10, 5) and (20, 10, 8) put in the floor runs through (0, 0, 0), (10, 10, 0) and (20, 10, 0), its normal (0, 0, 1). A vertex and a direction in the plane already keep their numbers, a hook (2, 0, 0) as a scale of 2 leaves it among them, and a normal the plane's to 1E-12 keeps its own, so that the leader put in its own plane changes nothing. The annotation is an entity of its own, and stays where it is; the offsets of the last vertex from it (212 and 213) are kept.
- SetVertexAt(int, GeoPoint3)
Moves a vertex, as AutoCAD's
SetVertexAt: its three groups written anew where a coordinate differs, the others kept.
- ToGeoPolyline2()
Gets the curve of a straight leader as a chain of the plane, as DxfReader reads it with PlanAs2D within the default tolerance: the leader above is the GeoPolyline2 (0, 0), (10, 10), (20, 10). One with a vertex at a height does not lie on the floor, and is refused; so is a splined one, which ToGeoSpline2() gives.
- ToGeoPolyline2(Tolerance)
Gets the curve of a straight leader as a chain of the plane, as ToGeoPolyline2() does, within a tolerance, which says which vertices are one.
- ToGeoPolyline3()
Gets the curve of a straight leader as the library's chain, as GetGeometry() gives it, to the bit: the GeoPolyline3 through its vertices in the world, a vertex within the point tolerance of the one kept before it left out. The leader through (0, 0, 0), (10, 10, 0) and (20, 10, 0) is that chain of two segments. A splined leader is refused: ToGeoSpline3() gives it.
- ToGeoSpline2()
Gets the curve of a splined leader as a spline of the plane, as DxfReader reads it with PlanAs2D within the default tolerance. One with a control point at a height does not lie on the floor, and is refused; so is a straight one, which ToGeoPolyline2() gives.
- ToGeoSpline2(Tolerance)
Gets the curve of a splined leader as a spline of the plane, as ToGeoSpline2() does, within a tolerance, which says which vertices are one.
- ToGeoSpline3()
Gets the curve of a splined leader as the library's spline, as GetGeometry() gives it, to the bit: the cubic Explode() fits through its vertices, leaving along its first segment and reaching along its last, its parameter from 0 to 1; through (0, 0, 0), (10, 10, 0) and (20, 10, 0) it rises to y = 10.43. A straight leader is refused: ToGeoPolyline3() gives it.
- VertexAt(int)
Gets a vertex in the world (groups 10, 20 and 30), as AutoCAD's
VertexAt.