DXFReaderNETControlAddGradientHatch Method (HatchGradientPatternType, ListEntityObject, ListEntityObject, Int16, Int16, Double, Boolean, String)
|
Adds a new gradient hatch to the current drawing.
Namespace:
DXFReaderNET
Assembly:
DXFReaderNET (in DXFReaderNET.dll) Version: 20.10.54
Syntax public EntityObject AddGradientHatch(
HatchGradientPatternType GradientType,
List<EntityObject> Boundary,
List<EntityObject> HollowBoundary = null,
short AciColor1 = 1,
short AciColor2 = 5,
double Rotation = 0,
bool Centered = true,
string LayerName = ""
)
Public Function AddGradientHatch (
GradientType As HatchGradientPatternType,
Boundary As List(Of EntityObject),
Optional HollowBoundary As List(Of EntityObject) = Nothing,
Optional AciColor1 As Short = 1,
Optional AciColor2 As Short = 5,
Optional Rotation As Double = 0,
Optional Centered As Boolean = true,
Optional LayerName As String = ""
) As EntityObject
public:
EntityObject^ AddGradientHatch(
HatchGradientPatternType GradientType,
List<EntityObject^>^ Boundary,
List<EntityObject^>^ HollowBoundary = nullptr,
short AciColor1 = 1,
short AciColor2 = 5,
double Rotation = 0,
bool Centered = true,
String^ LayerName = L""
)
member AddGradientHatch :
GradientType : HatchGradientPatternType *
Boundary : List<EntityObject> *
?HollowBoundary : List<EntityObject> *
?AciColor1 : int16 *
?AciColor2 : int16 *
?Rotation : float *
?Centered : bool *
?LayerName : string
(* Defaults:
let _HollowBoundary = defaultArg HollowBoundary null
let _AciColor1 = defaultArg AciColor1 1
let _AciColor2 = defaultArg AciColor2 5
let _Rotation = defaultArg Rotation 0
let _Centered = defaultArg Centered true
let _LayerName = defaultArg LayerName ""
*)
-> EntityObject
METHOD AddGradientHatch(
GradientType AS HatchGradientPatternType,
Boundary AS List<EntityObject>,
HollowBoundary AS List<EntityObject> := NULL,
AciColor1 AS SHORT := 1,
AciColor2 AS SHORT := 5,
Rotation AS REAL8 := 0,
Centered AS LOGIC := TRUE,
LayerName AS STRING := ""
) AS EntityObject
Parameters
- GradientType
- Type: DXFReaderNET.EntitiesHatchGradientPatternType
The hatch gradient type. - Boundary
- Type: System.Collections.GenericListEntityObject
A list of entities defining the boundary. - HollowBoundary (Optional)
- Type: System.Collections.GenericListEntityObject
A list of entities defining the boundary that encloses or defines empty or open spaces within an area. - AciColor1 (Optional)
- Type: SystemInt16
Starting AutoCAD Color Index of the gradient (Default value = 1 Red). - AciColor2 (Optional)
- Type: SystemInt16
Ending AutoCAD Color Index of the gradient (Default value = 5 Blue). - Rotation (Optional)
- Type: SystemDouble
Specifies the angle of the gradient fill (Default value = 0). - Centered (Optional)
- Type: SystemBoolean
Specifies a symmetrical gradient configuration (Default value = true). - LayerName (Optional)
- Type: SystemString
The layer name. If omitted, or layername doesn't exist, the CurrentLayer will be used.
Return Value
Type:
EntityObjectThe new added
Hatch.
Remarks The entity is added to the active layout. See also the
code sample.
Examples
This sample will generate a new drawing with the different gradient types as shown in the picture.
[C#]
int k;
int j;
int n = 0;
dxfReaderNETControl1.NewDrawing();
dxfReaderNETControl1.SetLimits(new Vector2(-1, -1), new Vector2(31, 31));
for (k = 0; k <= 2; k++)
{
for (j = 0; j <= 2; j++)
{
List<DXFReaderNET.Entities.LwPolylineVertex> polyVertexes = new List<DXFReaderNET.Entities.LwPolylineVertex>();
polyVertexes.Add(new DXFReaderNET.Entities.LwPolylineVertex(j * 10, k * 10));
polyVertexes.Add(new DXFReaderNET.Entities.LwPolylineVertex(j * 10 + 9, k * 10));
polyVertexes.Add(new DXFReaderNET.Entities.LwPolylineVertex(j * 10 + 9, k * 10 + 9));
polyVertexes.Add(new DXFReaderNET.Entities.LwPolylineVertex(j * 10, k * 10 + 9));
List<DXFReaderNET.Entities.EntityObject> Boundary = new List<DXFReaderNET.Entities.EntityObject>();
Boundary.Add(dxfReaderNETControl1.AddLightWeightPolyline(polyVertexes, true));
DXFReaderNET.Entities.HatchGradientPatternType hgType = (DXFReaderNET.Entities.HatchGradientPatternType)n;
n += 1;
Vector3 Position = polyVertexes[3].Position.ToVector3() + new Vector3(0, 0.2, 0);
dxfReaderNETControl1.AddText(hgType.ToString(), Position, Position, 0.7);
dxfReaderNETControl1.AddGradientHatch(hgType, Boundary);
}
}
dxfReaderNETControl1.ZoomLimits();
dxfReaderNETControl1.Refresh();
[Visual Basic]
Dim k As Integer
Dim j As Integer
Dim l As Double = 10
Dim n As Integer = 0
With DxfReaderNETControl1
.NewDrawing()
.SetLimits(New Vector2(-1, -1), New Vector2(31, 31))
For k = 0 To 2
For j = 0 To 2
Dim polyVertexes As List(Of Entities.LwPolylineVertex) = New List(Of Entities.LwPolylineVertex)
polyVertexes.Add(New Entities.LwPolylineVertex(j* 10, k* 10))
polyVertexes.Add(New Entities.LwPolylineVertex(j* 10 + 9, k* 10))
polyVertexes.Add(New Entities.LwPolylineVertex(j* 10 + 9, k* 10 + 9))
polyVertexes.Add(New Entities.LwPolylineVertex(j* 10, k* 10 + 9))
Dim Boundary As List(Of Entities.EntityObject) = New List(Of Entities.EntityObject)
Boundary.Add(.AddLightWeightPolyline(polyVertexes, True))
Dim hgType As Entities.HatchGradientPatternType = n
n += 1
Dim Position As Vector3 = polyVertexes(3).Position.ToVector3 + New Vector3(0, 0.2, 0)
.AddText(hgType.ToString(), Position, Position, 0.7)
.AddGradientHatch(hgType, Boundary)
Next j
Next k
.ZoomLimits()
.Refresh()
End With
See Also