Class Hatch
Represents a hatch EntityObject.
Inherited Members
Namespace: netDxf.Entities
Assembly: CADability.dll
Syntax
public class Hatch : EntityObject, IHasXData, ICloneable
Constructors
| Improve this Doc View SourceHatch(HatchPattern, Boolean)
Initializes a new instance of the Hatch class.
Declaration
public Hatch(HatchPattern pattern, bool associative)
Parameters
| Type | Name | Description |
|---|---|---|
| HatchPattern | pattern | |
| System.Boolean | associative | Defines if the hatch is associative or not. |
Remarks
This constructor is initialized with an empty list of boundary paths, remember a hatch without boundaries will be discarded when saving the file.
When creating an associative hatch do not add the entities that make the boundary to the document, it will be done automatically. Doing so will throw an exception.
The hatch boundary paths must be on the same plane as the hatch.
The normal and the elevation of the boundary paths will be omitted (the hatch elevation and normal will be used instead).
Only the x and y coordinates for the center of the line, ellipse, circle and arc will be used.
Hatch(HatchPattern, IEnumerable<HatchBoundaryPath>, Boolean)
Initializes a new instance of the Hatch class.
Declaration
public Hatch(HatchPattern pattern, IEnumerable<HatchBoundaryPath> paths, bool associative)
Parameters
| Type | Name | Description |
|---|---|---|
| HatchPattern | pattern | |
| System.Collections.Generic.IEnumerable<HatchBoundaryPath> | paths | A list of HatchBoundaryPath. |
| System.Boolean | associative | Defines if the hatch is associative or not. |
Remarks
The hatch boundary paths must be on the same plane as the hatch. The normal and the elevation of the boundary paths will be omitted (the hatch elevation and normal will be used instead). Only the x and y coordinates for the center of the line, ellipse, circle and arc will be used.
Properties
| Improve this Doc View SourceAssociative
Gets if the hatch is associative or not, which means if the hatch object is associated with the hatch boundary entities.
Declaration
public bool Associative { get; }
Property Value
| Type | Description |
|---|---|
| System.Boolean |
BoundaryPaths
Gets the hatch boundary paths.
Declaration
public ObservableCollection<HatchBoundaryPath> BoundaryPaths { get; }
Property Value
| Type | Description |
|---|---|
| ObservableCollection<HatchBoundaryPath> |
Remarks
The hatch must contain at least on valid boundary path to be able to add it to the DxfDocument, otherwise it will be rejected.
Elevation
Gets or sets the hatch elevation, its position along its normal.
Declaration
public double Elevation { get; set; }
Property Value
| Type | Description |
|---|---|
| System.Double |
Pattern
Gets the hatch pattern.
Declaration
public HatchPattern Pattern { get; set; }
Property Value
| Type | Description |
|---|---|
| HatchPattern |
Methods
| Improve this Doc View SourceClone()
Creates a new Hatch that is a copy of the current instance.
Declaration
public override object Clone()
Returns
| Type | Description |
|---|---|
| System.Object | A new Hatch that is a copy of this instance. |
Overrides
Remarks
If the hatch is associative the referenced boundary entities will not be automatically cloned, its associative property will be set to false. Use CreateBoundary if required after cloning.
CreateBoundary(Boolean)
Creates a list of entities that represents the boundary of the hatch and optionally associates to it.
Declaration
public List<EntityObject> CreateBoundary(bool linkBoundary)
Parameters
| Type | Name | Description |
|---|---|---|
| System.Boolean | linkBoundary | Indicates if the new boundary will be associated with the hatch, turning the associative property to true. |
Returns
| Type | Description |
|---|---|
| System.Collections.Generic.List<EntityObject> | A list of entities that makes the boundary of the hatch. |
Remarks
If the actual hatch is already associative, the old boundary entities will be unlinked, but not deleted from the hatch document.
If linkBoundary is true, the new boundary entities will be added to the same layout and document as the hatch, in case it belongs to one,
so, in this case, if you also try to add the return list to the document it will cause an error.
All entities are in world coordinates except the LwPolyline boundary path since by definition its vertexes are expressed in object coordinates.
OnHatchBoundaryPathAddedEvent(HatchBoundaryPath)
Declaration
protected virtual void OnHatchBoundaryPathAddedEvent(HatchBoundaryPath item)
Parameters
| Type | Name | Description |
|---|---|---|
| HatchBoundaryPath | item |
OnHatchBoundaryPathRemovedEvent(HatchBoundaryPath)
Declaration
protected virtual void OnHatchBoundaryPathRemovedEvent(HatchBoundaryPath item)
Parameters
| Type | Name | Description |
|---|---|---|
| HatchBoundaryPath | item |
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.
UnLinkBoundary()
Unlinks the boundary from the hatch, turning the associative property to false.
Declaration
public List<EntityObject> UnLinkBoundary()
Returns
| Type | Description |
|---|---|
| System.Collections.Generic.List<EntityObject> | The list of unlinked entities from the boundary of the hatch. |
Remarks
The entities that make the hatch boundaries will not be deleted from the document if they already belong to one.
Events
| Improve this Doc View SourceHatchBoundaryPathAdded
Declaration
public event Hatch.HatchBoundaryPathAddedEventHandler HatchBoundaryPathAdded
Event Type
| Type | Description |
|---|---|
| Hatch.HatchBoundaryPathAddedEventHandler |
HatchBoundaryPathRemoved
Declaration
public event Hatch.HatchBoundaryPathRemovedEventHandler HatchBoundaryPathRemoved
Event Type
| Type | Description |
|---|---|
| Hatch.HatchBoundaryPathRemovedEventHandler |