Class Insert
Represents a block insertion EntityObject.
Inherited Members
Namespace: netDxf.Entities
Assembly: CADability.dll
Syntax
public class Insert : EntityObject, IHasXData, ICloneable
Constructors
| Improve this Doc View SourceInsert(Block)
Initializes a new instance of the Insert class.
Declaration
public Insert(Block block)
Parameters
| Type | Name | Description |
|---|---|---|
| Block | block | Insert Block. |
Insert(Block, Vector2)
Initializes a new instance of the Insert class.
Declaration
public Insert(Block block, Vector2 position)
Parameters
| Type | Name | Description |
|---|---|---|
| Block | block | Insert block definition. |
| Vector2 | position | Insert Vector2 in world coordinates. |
Insert(Block, Vector3)
Initializes a new instance of the Insert class.
Declaration
public Insert(Block block, Vector3 position)
Parameters
| Type | Name | Description |
|---|---|---|
| Block | block | Insert block definition. |
| Vector3 | position | Insert Vector3 in world coordinates. |
Insert(Block, Vector3, Double)
Initializes a new instance of the Insert class.
Declaration
public Insert(Block block, Vector3 position, double scale)
Parameters
| Type | Name | Description |
|---|---|---|
| Block | block | Insert block definition. |
| Vector3 | position | Insert Vector3 in world coordinates. |
| System.Double | scale |
Properties
| Improve this Doc View SourceAttributes
Gets the insert list of Attribute.
Declaration
public AttributeCollection Attributes { get; }
Property Value
| Type | Description |
|---|---|
| AttributeCollection |
Block
Gets the insert Block.
Declaration
public Block Block { get; }
Property Value
| Type | Description |
|---|---|
| Block |
DefaultInsUnits
Gets or sets the default drawing units to obtain the Insert transformation matrix, when the current Insert entity does not belong to a DXF document.
Declaration
public static DrawingUnits DefaultInsUnits { get; set; }
Property Value
| Type | Description |
|---|---|
| DrawingUnits |
Position
Gets or sets the Vector3 in world coordinates.
Declaration
public Vector3 Position { get; set; }
Property Value
| Type | Description |
|---|---|
| Vector3 |
Rotation
Gets or sets the insert rotation along the normal vector in degrees.
Declaration
public double Rotation { get; set; }
Property Value
| Type | Description |
|---|---|
| System.Double |
Scale
Gets or sets the insert Vector3.
Declaration
public Vector3 Scale { get; set; }
Property Value
| Type | Description |
|---|---|
| Vector3 |
Remarks
None of the vector scale components can be zero.
Methods
| Improve this Doc View SourceClone()
Creates a new Insert that is a copy of the current instance.
Declaration
public override object Clone()
Returns
| Type | Description |
|---|---|
| System.Object | A new Insert that is a copy of this instance. |
Overrides
| Improve this Doc View SourceExplode()
Explodes the current insert.
Declaration
public List<EntityObject> Explode()
Returns
| Type | Description |
|---|---|
| System.Collections.Generic.List<EntityObject> | A list of entities. |
GetTransformation()
Calculates the insertion rotation matrix.
Declaration
public Matrix3 GetTransformation()
Returns
| Type | Description |
|---|---|
| Matrix3 | The insert transformation matrix. |
Remarks
This method uses the DefaultInsUnits defined by the Insert class to obtain the scale between the drawing and the block units. Additionally, if the insert belongs to a block the units to use are the ones defined in the BlockRecord, and if the insert belongs to a layout the units to use are the ones defined in the document drawing variable InsUnits.
GetTransformation(DrawingUnits)
Calculates the insertion rotation matrix.
Declaration
public Matrix3 GetTransformation(DrawingUnits insertionUnits)
Parameters
| Type | Name | Description |
|---|---|---|
| DrawingUnits | insertionUnits | The insertion units. |
Returns
| Type | Description |
|---|---|
| Matrix3 | The insert transformation matrix. |
OnAttributeAddedEvent(Attribute)
Declaration
protected virtual void OnAttributeAddedEvent(Attribute item)
Parameters
| Type | Name | Description |
|---|---|---|
| Attribute | item |
OnAttributeRemovedEvent(Attribute)
Declaration
protected virtual void OnAttributeRemovedEvent(Attribute item)
Parameters
| Type | Name | Description |
|---|---|---|
| Attribute | item |
Sync()
Updates the actual insert with the attribute properties currently defined in the block. This does not affect any values assigned to attributes in each block.
Declaration
public void Sync()
Remarks
This method will automatically call the TransformAttributes method, to keep all attributes position and orientation up to date.
TransformAttributes()
Recalculate the attributes position, normal, rotation, text height, width factor, and oblique angle from the values applied to the insertion.
Declaration
public void TransformAttributes()
Remarks
Changes to the insert, the block, or the document insertion units will require this method to be called manually.
The attributes position, normal, rotation, text height, width factor, and oblique angle values includes the transformations applied to the insertion,
if required this method will calculate the proper values according to the ones defined by the attribute definition.
All the attribute values can be changed manually independently to its definition,
but, usually, you will want them to be transformed with the insert based on the local values defined by the attribute definition.
This method only applies to attributes that have a definition, some DXF files might generate attributes that have no definition in the block.
At the moment the attribute width factor and oblique angle are not calculated, this is applied to inserts with non uniform scaling.
TransformBy(Matrix3, Vector3)
Moves, scales, and/or rotates the current entity given a 3x3 transformation matrix and a translation vector.
Declaration
public override void TransformBy(Matrix3 transformation, Vector3 translation)
Parameters
| Type | Name | Description |
|---|---|---|
| Matrix3 | transformation | Transformation matrix. |
| Vector3 | translation | Translation vector. |
Overrides
Remarks
Matrix3 adopts the convention of using column vectors to represent a transformation matrix.
Events
| Improve this Doc View SourceAttributeAdded
Declaration
public event Insert.AttributeAddedEventHandler AttributeAdded
Event Type
| Type | Description |
|---|---|
| Insert.AttributeAddedEventHandler |
AttributeRemoved
Declaration
public event Insert.AttributeRemovedEventHandler AttributeRemoved
Event Type
| Type | Description |
|---|---|
| Insert.AttributeRemovedEventHandler |