Table of Contents

Class DxfAttributeReference

Namespace
GeometryHelper.Dxf
Assembly
GeometryHelper.dll

An ATTRIB of a DXF file, as AutoCAD's AttributeReference: the value an INSERT gives one of its block's attributes, a text of the INSERT's own named by its Tag, reached through AttributeCollection.

public sealed class DxfAttributeReference : DxfDBText
Inheritance
DxfAttributeReference
Inherited Members

Remarks

The INSERT of the block BOLT whose attribute TAG1 reads M24 has one with Tag TAG1 and TextString M24; every member of DxfDBText reads and sets its text as it does a TEXT's, its points in world coordinates. Setting one writes the ATTRIB's record in its place among the INSERT's, every other record keeping its bytes.

The ATTRIB belongs to its INSERT, its Owner: it is moved with it, erased with it, or erased alone, the INSERT's other ATTRIBs keeping their handles. One made in code, new DxfAttributeReference(position, "M24", "TAG1", null) or filled from its definition by SetAttributeFromBlock(DxfAttributeDefinition, GeoTransform3), is added to an INSERT by AppendAttribute(DxfAttributeReference), not to a block. Its groups are read as ezdxf reads them: those of the text from its part AcDbText, the tag, flags, field length and vertical mode (group 74) from its part AcDbAttribute.

Constructors

DxfAttributeReference()

Initializes an attribute with no tag or value at the origin, 2.5 high, as AutoCAD's new AttributeReference(), in no file; give it its tag, or fill it from its definition, before it is added to an INSERT.

DxfAttributeReference(GeoPoint3, string, string, DxfTextStyleTableRecord)

Initializes an attribute, as AutoCAD's new AttributeReference(position, value, tag, style): at a point, with its value and tag, 2.5 high, in a text style, in no file until it is added to an INSERT.

Properties

FieldLength

Gets or sets the length of the attribute's field (group 73), as AutoCAD's FieldLength; nought where the record gives none.

Invisible

Gets or sets whether the attribute is not drawn (flag 1 of group 70), as AutoCAD's Invisible.

IsConstant

Gets whether the attribute's value is fixed by its definition (flag 2 of group 70), as AutoCAD's IsConstant.

IsMTextAttribute

Gets or sets whether the attribute is a text of several lines, an MTEXT embedded in its record (group 101), as AutoCAD's IsMTextAttribute.

IsPreset

Gets whether the attribute takes its default value without asking (flag 8 of group 70), as AutoCAD's IsPreset.

IsVerifiable

Gets whether the attribute's value is checked when it is given (flag 4 of group 70), as AutoCAD's IsVerifiable.

LockPositionInBlock

Gets or sets whether the attribute keeps its place in the block when the block is edited (the group 280 after its tag), as AutoCAD's LockPositionInBlock; false where the record gives none.

MTextAttribute

Gets or sets the MTEXT the attribute is made of where it is of several lines, as AutoCAD's MTextAttribute.

Tag

Gets or sets the tag of the attribute (group 2), as AutoCAD's Tag: the name its block's definition gives it, such as TAG1.

Methods

SetAttributeFromBlock(DxfAttributeDefinition, GeoTransform3)

Fills the attribute from its definition in a block, as AutoCAD's SetAttributeFromBlock: the definition's text (its words as the default value, its height, rotation, alignment, style and the rest), tag, flags, field length and lock, and its look, then placed by the transformation that places the block, an INSERT's BlockTransform. Its prompt is not an attribute's and is left out. A definition of several lines gives its embedded MTEXT and makes the attribute one of several lines, its type (71) 2 where the definition's is 4, as ezdxf writes them, its value the words of every line of that MTEXT joined by spaces, as AutoCAD 2021 writes it. A definition not aligned left on its baseline gives its alignment point placed, the origin where its record has none: centred on (0, 0) in a block an INSERT places at (6000, 1000), it gives an attribute held by (6000, 1000), written 11 6000 21 1000, as AutoCAD 2021 gave it (check D30). An annotative attribute is placed so in the context it is shown at (Position), its other contexts left as they were, and its record where that context is the default: AutoCAD 2021 put ATT_DVSUP of its sample at (5.278, 265.33) in its context of 1:1 alone where 1:2 was the default, its record keeping the default's point and given the height 6, at 1:2, of the definition 3 high (check D35).

SetAttributeFromBlock(GeoTransform3)

Places the attribute again from its definition, as AutoCAD's SetAttributeFromBlock of one transformation does: the definition of its tag in the block its INSERT places, by SetAttributeFromBlock(DxfAttributeDefinition, GeoTransform3).

UpdateMTextAttribute()

Places the attribute's MTEXT where its text stands, as AutoCAD's UpdateMTextAttribute, called after the attribute is moved or filled by SetAttributeFromBlock(DxfAttributeDefinition, GeoTransform3): the MTEXT's location the text's second point where it is not aligned left on its baseline, else its first; its height, direction, normal and style the text's; its attachment the text's justification, a baseline taken as the bottom; its words and width kept. Nothing changes for an attribute of one line, or one whose MTEXT agrees.