Create a path from a list of vertices.
Syntax: |
---|
DlxLayer.DrawPath(p1, p2, thickness, startCap, endCap, bLink) DlxLayer.DrawPath(vertices, thickness, startCap, endCap, bLink) |
Parameters
Parameter | Description | |||||
---|---|---|---|---|---|---|
p1 | A DlxPoint object with the coordinates specifying the path start point. | |||||
p2 | A DlxPoint object with the coordinates specifying the path endpoint. | |||||
thickness | Thickness of the path. | |||||
startCap endCap |
Specifies the shape of the ends of the path. Specify one of the following values:
|
|||||
bLink | Specify true if the path should connect to other objects in the path. | |||||
vertices | An array of DlxPoint objects with the coordinates used to create the path vertices. |
Return Value
The last newly created DlxPath object. Call the IsValid() method to determine if the object was created correctly.
Example
Copy code | |
---|---|
var prj = DlxApp.GetJob().GetProject("Example Sch");
if (!prj.IsValid())
prj = DlxApp.GetJob().NewProject("Example Sch");
var doc = prj.GetDocument("Examples Sch", DlxApp.DOCTYPE_SCHEMATIC);
if (!doc.IsValid())
{
doc = prj.NewDocument("Examples Sch", DlxApp.DOCTYPE_SCHEMATIC);
doc.SetPageFormat("A4", false);
}
if (doc.IsValid() && doc.Activate())
{
var page = doc.GetActivePage();
if (page.IsValid())
{
var layer = page.GetLayerFromType(DlxApp.LAYERTYPE_DRAWING);
if (layer.IsValid())
{
var vertices = new Array();
vertices[0] = new DlxPoint(30,30);
vertices[1] = new DlxPoint(50,60);
vertices[2] = new DlxPoint(100,60);
vertices[3] = new DlxPoint(100,30);
vertices[4] = new DlxPoint(150,40);
layer.DrawPath(vertices, 1, DlxApp.PATHCAP_ROUND, DlxApp.PATHCAP_ARROW, true);
}
}
}
|