Adds a pad in the PCB.

syntaxSyntax:
DlxLayer.DrawPad(position, style, number = "", name = "", rotation = 0, toPadOrigin = false)

Parameters

Parameter Description
position A DlxPoint object with the location to insert the pad.
style A DlxPadStyle object with the style of the pad.
number The number to assign to the pad.
name The name to assign to the pad.
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 pad is SMD and the layer is not the Top Copper or Bottom Copper layer.

Example

  Copy codeCopy 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 layer = page.GetLayerFromType(DlxApp.LAYERTYPE_TOPCOPPER);
    if (layer.IsValid())
    {
      var padstyle = new DlxPadStyle();
      padstyle.InitPadSMD(3, 2, 1);
      layer.DrawPad(new DlxPoint(100,150), padstyle, "1");
    }
  }
}

See also