Adds a hole in the PCB.
Syntax: |
---|
DlxPage.DrawHole(position, style, name = "", rotation = 0, toPadOrigin = false) |
Parameters
Parameter | Description |
---|---|
position | A DlxPoint object with the location to insert the hole. |
style | A DlxPadStyle object with the style of the hole. |
name | The name to assign to the hole. |
rotation | Specify the rotation in degrees. |
toPadOrigin | SMD pads are always positioned relative to the center of the pad. Through-hole pads are positioned relative to the center of the hole unless the toPadCenter value is true. |
Return Value
The newly created DlxPad object. Call the IsValid() method to determine if the object was created correctly.
Remarks
This method fails if the style does not describe a through-hole pad.
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.GetActivePage();
if (page.IsValid())
{
var padstyle = new DlxPadStyle();
padstyle.InitHole(3.2);
page.DrawHole(new DlxPoint(100,150), padstyle, "MH1");
}
}
|