Class Attribute
Represents a attribute EntityObject.
Implements
Inherited Members
Namespace: netDxf.Entities
Assembly: CADability.dll
Syntax
public class Attribute : DxfObject, ICloneable
Remarks
The attribute position, rotation, height and width factor values also includes the transformation of the Insert entity to which it belongs.
During the attribute initialization a copy of all attribute definition properties will be copied,
so any changes made to the attribute definition will only be applied to new attribute instances and not to existing ones.
This behavior is to allow imported Insert entities to have attributes without definition in the block,
although this might sound not totally correct it is allowed by AutoCad.
Constructors
| Improve this Doc View SourceAttribute(AttributeDefinition)
Initializes a new instance of the Attribute class.
Declaration
public Attribute(AttributeDefinition definition)
Parameters
| Type | Name | Description |
|---|---|---|
| AttributeDefinition | definition |
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 |
Definition
Gets the attribute definition.
Declaration
public AttributeDefinition Definition { get; }
Property Value
| Type | Description |
|---|---|
| AttributeDefinition |
Remarks
If the insert attribute has no definition it will return null.
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 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 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 Insert Owner { get; }
Property Value
| Type | Description |
|---|---|
| Insert |
Position
Gets or sets the attribute Vector3.
Declaration
public Vector3 Position { get; set; }
Property Value
| Type | Description |
|---|---|
| Vector3 |
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 tag.
Declaration
public string Tag { get; }
Property Value
| Type | Description |
|---|---|
| System.String |
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 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.
Methods
| Improve this Doc View SourceClone()
Creates a new Attribute that is a copy of the current instance.
Declaration
public object Clone()
Returns
| Type | Description |
|---|---|
| System.Object | A new Attribute 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 |
TransformBy(Matrix3, Vector3)
Moves, scales, and/or rotates the current attribute 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 Attribute.LayerChangedEventHandler LayerChanged
Event Type
| Type | Description |
|---|---|
| Attribute.LayerChangedEventHandler |
LinetypeChanged
Declaration
public event Attribute.LinetypeChangedEventHandler LinetypeChanged
Event Type
| Type | Description |
|---|---|
| Attribute.LinetypeChangedEventHandler |
TextStyleChanged
Declaration
public event Attribute.TextStyleChangedEventHandler TextStyleChanged
Event Type
| Type | Description |
|---|---|
| Attribute.TextStyleChangedEventHandler |