Creates a track on the PCB.
Syntax: |
DlxLayer.DrawTrack(p1, p2, curve = 0)
DlxLayer.DrawTrack(center, sizex, sizey = 0, startAngle = 0, stopAngle = 0, rotAngle = 0, flags = DlxApp.ELLIPSE_CCW)
|
Parameters
Parameter |
Description |
p1 |
A DlxPoint object with the coordinates specifying the track start point. |
p2 |
A DlxPoint object with the coordinates specifying the track end point. |
curve |
Angle of the arc in degrees. |
center |
A DlxPoint object with the coordinates specifying the center of the arc. |
sizex |
A positive value that defines the radius of the circle or the half length of the x-axis of the ellipse. |
sizey |
A positive value defining the half length of the y-axis of the ellipse. If zero is specified, sizey is set equal to sizex. |
startAngle |
The angle, in degrees, of the arc start. |
stopAngle |
The angle, in degrees, of the end of the arc. |
rotAngle |
The angle, in degrees, of rotation of the ellipse. |
flags |
A combination of the following values:
Value |
Meaning |
DlxApp.ELLIPSE_CW |
The arc is drawn clockwise. |
DlxApp.ELLIPSE_CCW |
The arc is drawn counterclockwise. |
DlxApp.ELLIPSE_EANGLE |
The startAngle and stopAngle values are referred to the ellipse otherwise they are referred to the circle. |
DlxApp.ELLIPSE_OPEN |
The arc is open. |
DlxApp.ELLIPSE_CLOSED |
The arc is closed with segments in the center. |
DlxApp.ELLIPSE_CHORD |
The arc is closed to the chord. |
|
Return Value
The newly created DlxTrack object. Call the IsValid() method to determine if the
object was created correctly.
Example
|
Copy code
|
var prj = DlxApp.GetJob().GetProject("Example PCB");
if (!prj.IsValid())
prj = DlxApp.GetJob().NewProject("Example PCB");
var doc = prj.GetDocument("Examples PCB", DlxApp.DOCTYPE_PCB);
if (!doc.IsValid())
{
doc = prj.NewDocument("Examples Pcb", DlxApp.DOCTYPE_PCB);
doc.SetPageFormat("A4", false);
var page = doc.NewPage("PCB", 0, true);
page.LoadLayerStack("2 layer pcb stackup.clxlys");
page.DrawBoard(new DlxRect(10, 10, 290, 200));
page.SelectView("Draw Copper From Top");
}
if (doc.IsValid() && doc.Activate())
{
var page = doc.FindPage("PCB");
if (page.IsValid() && doc.SelectPage(page))
{
var layer = page.GetLayerFromType(DlxApp.LAYERTYPE_TOPCOPPER);
if (layer.IsValid())
{
var d = 20;
var p1 = new DlxPoint(60, 100);
var p2 = new DlxPoint(100, 100);
var trackstyle = new DlxTrackStyle(1.8);
doc.SetStyle(trackstyle);
layer.DrawTrack(p1, p2);
layer.DrawTrack(p2, p2.OffsetY(-d), -180);
layer.DrawTrack(p2.OffsetY(-d), p2.OffsetY(-d*2));
layer.DrawTrack(p2.OffsetY(-d*2), p2.OffsetY(-d*3), 180);
layer.DrawTrack(p2.OffsetY(-d*3), p2.Offset(40, -d*3));
}
}
}
|
See also