Set the shape of the pad.
Syntax: |
---|
DlxPadStyle.SetCustomShape(layerType, height, width, vertices, rotation = 0) |
Parameters
Parameter | Description | |||||||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
layerType | The layer on which to apply the pad shape. Specify one of the following values:
|
|||||||||||||||||||||||||
height | Specifies the size of the pad on the y-axis. | |||||||||||||||||||||||||
width | Specifies the size of the pad on the x-axis. | |||||||||||||||||||||||||
vertices | String describing the shape of the pad. | |||||||||||||||||||||||||
rotation | Specify the rotation of the shape in degrees. |
Return Value
If the operation ends correctly, it returns true otherwise it returns false.
Remarks
LAYERTYPE_ALLPCBLAYERS describes the default shape, i.e. the shape the pad takes for all layers for which no specific shape has been defined. LAYERTYPE_ALLINNERCOPPER describes the shape of the pad for all inner layers.
The shape of the pad consists of a polygon centered at the point of coordinates (0.0) and described by a series of vertices and arcs. Vertices are pairs of coordinates (X,Y). The arcs are specified by the character A followed by the coordinates of the center and the angle of sweep (Ax,y,a) or the character C followed by the coordinates of the end point and the angle of curvature (Cx,y,a). Positive angle values draw the arc in the counterclockwise direction. The shape can be rotated by specifying the character R followed by the angle of rotation in degrees. The coordinates are specified in the field vertices. The pad is resized to the values specified in the width and height fields. To keep the original dimensions, specify zero for width and height.
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 padstyle = new DlxPadStyle();
padstyle.SetCustomShape(DlxApp.LAYERTYPE_ALLPCBLAYERS, 1.5, 2.0, "(0,2)(-1,1)(-1,0)(-2,-0.5)(-2,-1)(A0,-1,180)(2,-0.5)(1,0)(1,1)", 0);
layer.DrawPad(new DlxPoint(100,150), padstyle, "1");
}
}
}
|