Table of Contents

Class DxfDBText

Namespace
GeometryHelper.Dxf
Assembly
GeometryHelper.dll

A TEXT of a DXF file, as AutoCAD's DBText: one line of words at Position, Height high, turned by Rotation in the plane of its Normal, held by its point as HorizontalMode and VerticalMode say.

public class DxfDBText : DxfEntity
Inheritance
DxfDBText
Derived
Inherited Members

Remarks

The text "Left base 30" at (2, 3, 0), 2.5 high, turned by 30 degrees, is Rotation 0.5236 radians, Justify BaseLeft and IsDefaultAlignment. Its points are given in world coordinates, as AutoCAD gives them, though the file writes them in the system of the normal's plane: a text on the normal (0, 0, -1) whose file says (3, 4, 5) stands at (-3, 4, -5).

A property set writes its groups as DxfWriter writes a number, the angles in degrees as the file holds them, every other group of the record kept as it was; a property given the value it has changes nothing. new DxfDBText { TextString = "B-12", Position = new GeoPoint3(10, 20, 0), Height = 3.5 } makes one in code, to be added to a drawing by AppendEntity(DxfEntity). GetGeometry() gives the DxfText DxfReader reads of it.

Where the drawing's FontSearchPath finds the SHX or TrueType font of the text's style, a text justified other than left on its baseline is put where its words stand about its AlignmentPoint, as AutoCAD 2021's AdjustAlignment puts it (check F1a), whenever its words, second point, height, width factor, turn, justification or style are set, and when one made in code is added to the drawing: "ABC" of txt.shx 4 high centred on (100, 50, 0) stands at (94.667, 50, 0), the ink of its letters 10.667 wide; an aligned text takes the height, and a fitted one the width factor, its two points give it, "ABC" aligned on two points 30 apart 11.25 high. A first point set on a text of another justification is kept as set. A TrueType font is measured as AutoCAD 2021 measures it (check F2): the box from the start of the baseline to the last pen, the ink past it counted, "ABC" of arial.ttf so centred on (100, 50, 0) at (94.259, 50, 0). With no fonts, or a font not measured (a big font's letters, a letter a TrueType font has not, the lines of %%u, %%o and %%k of an SHX font and of %%k of a TrueType one), the text stays as it is set.

Constructors

DxfDBText()

Initializes a text with no words at the origin, 2.5 high, as AutoCAD's new DBText(), on layer 0 in the text style Standard, in no file; give it its words and place before it is drawn.

Properties

AlignmentPoint

Gets or sets the second point of the text (groups 11, 21, 31), as AutoCAD's AlignmentPoint: in world coordinates, the point a text not aligned left on its baseline is held by; the origin where the record gives none, as for such a text. An annotative one's is that of the context it is read at, as Position says, at the elevation of its record.

GeometricExtents

Gets the box the text's words fill, as AutoCAD's GeometricExtents: where the drawing's FontSearchPath finds the SHX font of its style, the box of the ink of the whole line of words upright, its four corners slanted by Oblique, turned and placed as the text stands at its Position, as AutoCAD 2021 boxes it (check F1a), the position itself not among them: " A" of txt.shx 4 high at the origin from (4, 0, 0) to (6.667, 4, 0), "A" from (0, 0, 0) to (2.667, 4, 0), and slanted 15 degrees to (3.738, 4, 0), its top corner moved by 4 times the tangent. A text of no ink is boxed at its position. Of a TrueType font, the box from the start of the baseline to the last pen, the ink past it counted, each letter boxed from the lower of its bottom and the baseline as high as it is (check F2): "H" of arial.ttf 4 high from (0, 0, 0) to (4.035, 4, 0), its advance, and the degree sign from (0, 0, 0) to (2.235, 1.514, 0), though inked from 2.554 up. Elsewhere as GeometricExtents gives it, the position alone.

Height

Gets or sets how high the text is (group 40), as AutoCAD's Height; 2.5 where the record gives none. An annotative one's is as high as the scale it is read at makes it (Position): its record holds the height at its default scale, so that one 3 high at the default 1:2 is 1.5 high at 1:1, as AutoCAD 2021 reads it (check D35).

HorizontalMode

Gets or sets how the text stands across its point (group 72), as AutoCAD's HorizontalMode; TextLeft where the record gives none. An annotative one's is that of the context it is read at (Position), its 70, where it holds one: AutoCAD 2021 read an attribute whose record is aligned left, and whose context of 1:1 says 2, as aligned right (check D35b).

IsDefaultAlignment

Gets whether the text is aligned left on its baseline, its modes both nought, as AutoCAD's IsDefaultAlignment.

IsMirroredInX

Gets or sets whether the text is written backwards (flag 2 of group 71), as AutoCAD's IsMirroredInX.

IsMirroredInY

Gets or sets whether the text is written upside down (flag 4 of group 71), as AutoCAD's IsMirroredInY.

Justify

Gets or sets the justification of the text, as AutoCAD's Justify: its HorizontalMode and VerticalMode taken together, a text centred on its middle MiddleCenter; BaseLeft where the record gives neither.

Normal

Gets or sets the normal of the plane the text stands in (groups 210, 220, 230), as AutoCAD's Normal; of unit length, (0, 0, 1) where the record gives none.

Oblique

Gets or sets how far the letters lean (group 51, in degrees), as AutoCAD's Oblique: in radians, clockwise from upright; nought where the record gives none.

Position

Gets or sets where the text stands (groups 10, 20, 30), as AutoCAD's Position: in world coordinates, the file's point taken from the system of the Normal's plane; the origin where the record gives none. An annotative text, attribute or definition stands where its context of the scale 1:1 says, else its default context, as AutoCAD 2021 reads one whatever CANNOSCALE says: the attribute ATT_DVSUP of AutoCAD's sample Mechanical - Metric, whose record says (0.678, 265.33) and whose context of 1:1 says (-6.151, 265.33), stands at (-6.151, 265.33), its elevation the record's, which no context holds (check D35).

Rotation

Gets or sets how far the text is turned (group 50, in degrees), as AutoCAD's Rotation: in radians, counter-clockwise from the x axis of the system of its normal's plane; nought where the record gives none. An annotative one's is that of the context it is read at, as Position says.

TextString

Gets or sets the words of the text (group 1), as AutoCAD's TextString: as the file writes them, its special characters such as %%d kept, but a letter written as its escape, \U+00E9, read as the letter, and a caret and the character after it as AutoCAD reads them, a^Ib a, a tab and b, a^ b a^b, a^@b ending at a; empty where the record gives none. Those of an ATTRIB or ATTDEF of several lines are the words of the lines of its MTEXT joined by spaces, as AutoCAD 2021 reads both whatever their group 1 holds: the definition whose MTEXT reads LINE ONE\PLINE TWO\PLINE THREE gives LINE ONE LINE TWO LINE THREE.

TextStyle

Gets or sets the text style of the text, as AutoCAD's TextStyleId gives its id: the record of TextStyleName in the text style table of the text's drawing; null where it has none of that name, or the text is in no drawing and was made in code. text.TextStyle = db.TextStyleTable["GH_TXT"] writes 7 GH_TXT.

TextStyleName

Gets or sets the name of the text style of the text (group 7), as AutoCAD's TextStyleName: as the style table names it, its escapes read as letters; Standard where the record gives none.

Thickness

Gets or sets how far the text stands up along its Normal (group 39), as AutoCAD's Thickness; nought where the record gives none.

VerticalMode

Gets or sets how the text stands up and down from its point (group 73 of a TEXT, 74 of an ATTRIB or ATTDEF), as AutoCAD's VerticalMode; TextBase where the record gives none.

WidthFactor

Gets or sets how wide the letters are against their height (group 41), as AutoCAD's WidthFactor; 1 where the record gives none.

Methods

ConvertFieldToText()

Makes the text's fields words, as AutoCAD's ConvertFieldToText: the field of its words taken out with its children, as RemoveField() takes it out, and its words (1) kept as they are, the values AutoCAD last gave the fields among them. Nothing where it has no field.

GetTextWithFieldCodes()

Gets the words of the text with the codes of its fields in their places, as AutoCAD's getTextWithFieldCodes: the code of its field (GetField()), each field it holds standing as its code in its markers, at every depth. The TEXT that reads Drawn 27/10/2026, the date a field, gives Drawn %<\AcVar Date \f "dd/MM/yyyy">%; one with no field gives its TextString.