Adds a pad in the footprint.

syntaxSyntax:
FWiz.DrawPad(posX, posY, padNumber, styleIndex, rotation=0, toPadOrigin=false)
FWiz.DrawPad(posX, posY, padNumber, padStyle, rotation=0, toPadOrigin=false)

Parameters

Parameter Description
posX Specifies the x-coordinate of the pad.
posY Specifies the y-coordinate of the pad.
padNumber The number to assign to the pad.
styleIndex Index of the pad style. There are 16 styles available with indexes from 0 to 15.
padStyle A DlxPadStyle object with the style of 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 toPadOrigin value is true.

Return Value

If the operation ends correctly, it returns the index of the pad, otherwise it returns -1;

Example

  Copy codeCopy code
function OnBuildFootprint()
{
  var A = FWiz.GetValue("A");
  var b = FWiz.GetValue("b");
  var c = FWiz.GetValue("c");
  var e = FWiz.GetValue("e");
  var J1 = FWiz.GetValue("J1");
  var E = FWiz.GetValue("E");
  var F = FWiz.GetValue("F");

  var styleIndex = 0;
  if (FWiz.IsAutoPadStyle(styleIndex))
  {
    styleIndex = 1;
    var holeSize = FWiz.CalcHoleDiameter(b, -1);
    var padSize = FWiz.CalcPadDiameter(holeSize);
    FWiz.GetPadStyle(styleIndex).InitTHPadStack(holeSize, padSize, FWiz.GetValue("PADSHAPEMODE")==1);
  }

  // Add Pads
  FWiz.DrawPad(0, 0, "2", styleIndex, 0);
  FWiz.DrawPad(-e, 0, "1", styleIndex, 0);
  FWiz.DrawPad(e, 0, "3", styleIndex, 0);

  // Add Legend
  var legendCtx = FWiz.GetLegendCtx();
  var rect = new DlxRect();
  var y = J1 + c / 2 - A / 2;
  rect.SetRect(new DlxPoint(0,y), E, A);
  y = rect.top - F;
  legendCtx.DrawLine(new DlxPoint(rect.left,y), new DlxPoint(rect.right,y));
  legendCtx.DrawRectangle(rect, FWiz.SHAPEMODE_OUTLINE);
  legendCtx.DrawAttributes();

  // Add Courtyard
  FWiz.DrawCourtyard(rect);

  // Set Name
  var description = FWiz.Format("TO-220 3 leads; in the upright position; %s", FWiz.GetIPCinfo());
  FWiz.SetFootprintName("TO-220V3", description);
}

See also