Class AttributeDefinition
Represents an attribute definition EntityObject.
Inherited Members
Namespace: netDxf.Entities
Assembly: CADability.dll
Syntax
public class AttributeDefinition : DxfObject, ICloneable, IHasXData
Remarks
AutoCad allows to have duplicate tags in the attribute definitions list, but this library does not. To have duplicate tags is not recommended in any way, since there will be now way to know which is the definition associated to the insert attribute.
Constructors
| Improve this Doc View SourceAttributeDefinition(String)
Initializes a new instance of the AttributeDefinition class.
Declaration
public AttributeDefinition(string tag)
Parameters
| Type | Name | Description |
|---|---|---|
| System.String | tag | Attribute identifier. |
AttributeDefinition(String, TextStyle)
Initializes a new instance of the AttributeDefinition class.
Declaration
public AttributeDefinition(string tag, TextStyle style)
Parameters
| Type | Name | Description |
|---|---|---|
| System.String | tag | Attribute identifier. |
| TextStyle | style | Attribute TextStyle. |
AttributeDefinition(String, Double, TextStyle)
Initializes a new instance of the AttributeDefinition class.
Declaration
public AttributeDefinition(string tag, double textHeight, TextStyle style)
Parameters
| Type | Name | Description |
|---|---|---|
| System.String | tag | Attribute identifier. |
| System.Double | textHeight | Height of the attribute definition text. |
| TextStyle | style | Attribute TextStyle. |
Properties
| Improve this Doc View SourceAlignment
Gets or sets the text alignment.
Declaration
public TextAlignment Alignment { get; set; }
Property Value
| Type | Description |
|---|---|
| TextAlignment |
Color
Gets or sets the entity AciColor.
Declaration
public AciColor Color { get; set; }
Property Value
| Type | Description |
|---|---|
| AciColor |
Flags
Gets or sets the attribute flags.
Declaration
public AttributeFlags Flags { get; set; }
Property Value
| Type | Description |
|---|---|
| AttributeFlags |
Height
Gets or sets the text height.
Declaration
public double Height { get; set; }
Property Value
| Type | Description |
|---|---|
| System.Double |
Remarks
Valid values must be greater than zero. Default: 1.0.
When Alignment.Aligned is used this value is not applicable, it will be automatically adjusted so the text will fit in the specified width.
IsBackward
Gets or sets if the attribute definition text is backward (mirrored in X).
Declaration
public bool IsBackward { get; set; }
Property Value
| Type | Description |
|---|---|
| System.Boolean |
IsUpsideDown
Gets or sets if the attribute definition text is upside down (mirrored in Y).
Declaration
public bool IsUpsideDown { get; set; }
Property Value
| Type | Description |
|---|---|
| System.Boolean |
IsVisible
Gets or set the entity visibility.
Declaration
public bool IsVisible { get; set; }
Property Value
| Type | Description |
|---|---|
| System.Boolean |
Layer
Gets or sets the entity Layer.
Declaration
public Layer Layer { get; set; }
Property Value
| Type | Description |
|---|---|
| Layer |
Linetype
Gets or sets the entity Linetype.
Declaration
public Linetype Linetype { get; set; }
Property Value
| Type | Description |
|---|---|
| Linetype |
LinetypeScale
Gets or sets the entity line type scale.
Declaration
public double LinetypeScale { get; set; }
Property Value
| Type | Description |
|---|---|
| System.Double |
Lineweight
Gets or sets the entity line weight, one unit is always 1/100 mm (default = ByLayer).
Declaration
public Lineweight Lineweight { get; set; }
Property Value
| Type | Description |
|---|---|
| Lineweight |
Normal
Gets or sets the entity Vector3.
Declaration
public Vector3 Normal { get; set; }
Property Value
| Type | Description |
|---|---|
| Vector3 |
ObliqueAngle
Gets or sets the font oblique angle.
Declaration
public double ObliqueAngle { get; set; }
Property Value
| Type | Description |
|---|---|
| System.Double |
Remarks
Valid values range from -85 to 85. Default: 0.0.
Owner
Gets the owner of the actual DXF object.
Declaration
public Block Owner { get; }
Property Value
| Type | Description |
|---|---|
| Block |
Position
Gets or sets the attribute Vector3 in object coordinates.
Declaration
public Vector3 Position { get; set; }
Property Value
| Type | Description |
|---|---|
| Vector3 |
Prompt
Gets or sets the attribute information text.
Declaration
public string Prompt { get; set; }
Property Value
| Type | Description |
|---|---|
| System.String |
Remarks
This is the text prompt shown to introduce the attribute value when new Insert entities are inserted into the drawing.
Rotation
Gets or sets the attribute text rotation in degrees.
Declaration
public double Rotation { get; set; }
Property Value
| Type | Description |
|---|---|
| System.Double |
Style
Gets or sets the attribute text style.
Declaration
public TextStyle Style { get; set; }
Property Value
| Type | Description |
|---|---|
| TextStyle |
Remarks
The TextStyle defines the basic properties of the information text.
Tag
Gets the attribute identifier.
Declaration
public string Tag { get; }
Property Value
| Type | Description |
|---|---|
| System.String |
Remarks
Even thought the official DXF documentation clearly says that the attribute definition tag cannot contain spaces, most programs seems to allow them, but I cannot guarantee that all will behave this way.
Transparency
Gets or sets layer transparency (default: ByLayer).
Declaration
public Transparency Transparency { get; set; }
Property Value
| Type | Description |
|---|---|
| Transparency |
Value
Gets or sets the attribute default value.
Declaration
public object Value { get; set; }
Property Value
| Type | Description |
|---|---|
| System.Object |
Width
Gets or sets the text width, only applicable for text Alignment.Fit and Alignment.Align.
Declaration
public double Width { get; set; }
Property Value
| Type | Description |
|---|---|
| System.Double |
Remarks
Valid values must be greater than zero. Default: 1.0.
WidthFactor
Gets or sets the width factor.
Declaration
public double WidthFactor { get; set; }
Property Value
| Type | Description |
|---|---|
| System.Double |
Remarks
Valid values range from 0.01 to 100. Default: 1.0.
When Alignment.Fit is used this value is not applicable, it will be automatically adjusted so the text will fit in the specified width.
XData
Gets the entity XDataDictionary.
Declaration
public XDataDictionary XData { get; }
Property Value
| Type | Description |
|---|---|
| XDataDictionary |
Methods
| Improve this Doc View SourceClone()
Creates a new AttributeDefinition that is a copy of the current instance.
Declaration
public object Clone()
Returns
| Type | Description |
|---|---|
| System.Object | A new AttributeDefinition that is a copy of this instance. |
OnLayerChangedEvent(Layer, Layer)
Declaration
protected virtual Layer OnLayerChangedEvent(Layer oldLayer, Layer newLayer)
Parameters
| Type | Name | Description |
|---|---|---|
| Layer | oldLayer | |
| Layer | newLayer |
Returns
| Type | Description |
|---|---|
| Layer |
OnLinetypeChangedEvent(Linetype, Linetype)
Declaration
protected virtual Linetype OnLinetypeChangedEvent(Linetype oldLinetype, Linetype newLinetype)
Parameters
| Type | Name | Description |
|---|---|---|
| Linetype | oldLinetype | |
| Linetype | newLinetype |
Returns
| Type | Description |
|---|---|
| Linetype |
OnTextStyleChangedEvent(TextStyle, TextStyle)
Declaration
protected virtual TextStyle OnTextStyleChangedEvent(TextStyle oldTextStyle, TextStyle newTextStyle)
Parameters
| Type | Name | Description |
|---|---|---|
| TextStyle | oldTextStyle | |
| TextStyle | newTextStyle |
Returns
| Type | Description |
|---|---|
| TextStyle |
OnXDataAddAppRegEvent(ApplicationRegistry)
Declaration
protected virtual void OnXDataAddAppRegEvent(ApplicationRegistry item)
Parameters
| Type | Name | Description |
|---|---|---|
| ApplicationRegistry | item |
OnXDataRemoveAppRegEvent(ApplicationRegistry)
Declaration
protected virtual void OnXDataRemoveAppRegEvent(ApplicationRegistry item)
Parameters
| Type | Name | Description |
|---|---|---|
| ApplicationRegistry | item |
TransformBy(Matrix3, Vector3)
Moves, scales, and/or rotates the current attribute definition given a 3x3 transformation matrix and a translation vector.
Declaration
public void TransformBy(Matrix3 transformation, Vector3 translation)
Parameters
| Type | Name | Description |
|---|---|---|
| Matrix3 | transformation | Transformation matrix. |
| Vector3 | translation | Translation vector. |
Remarks
Matrix3 adopts the convention of using column vectors to represent a transformation matrix.
TransformBy(Matrix4)
Moves, scales, and/or rotates the current entity given a 4x4 transformation matrix.
Declaration
public void TransformBy(Matrix4 transformation)
Parameters
| Type | Name | Description |
|---|---|---|
| Matrix4 | transformation | Transformation matrix. |
Remarks
Matrix4 adopts the convention of using column vectors to represent a transformation matrix.
Events
| Improve this Doc View SourceLayerChanged
Declaration
public event AttributeDefinition.LayerChangedEventHandler LayerChanged
Event Type
| Type | Description |
|---|---|
| AttributeDefinition.LayerChangedEventHandler |
LinetypeChanged
Declaration
public event AttributeDefinition.LinetypeChangedEventHandler LinetypeChanged
Event Type
| Type | Description |
|---|---|
| AttributeDefinition.LinetypeChangedEventHandler |
TextStyleChange
Declaration
public event AttributeDefinition.TextStyleChangedEventHandler TextStyleChange
Event Type
| Type | Description |
|---|---|
| AttributeDefinition.TextStyleChangedEventHandler |
XDataAddAppReg
Declaration
public event XDataAddAppRegEventHandler XDataAddAppReg
Event Type
| Type | Description |
|---|---|
| XDataAddAppRegEventHandler |
XDataRemoveAppReg
Declaration
public event XDataRemoveAppRegEventHandler XDataRemoveAppReg
Event Type
| Type | Description |
|---|---|
| XDataRemoveAppRegEventHandler |