Adds this style to the list of public styles.

syntaxSyntax:
DlxStyle.AddToPublicStyles(name, class = "")

Parameters

Parameter Description
name A string with the style name.
class A string with the name of the class to which the style belongs. If this string is empty or the class does not exist, the style is not associated with a class.

Return Value

If the operation ends correctly, it returns a string containing the public style handle, otherwise it returns an empty string.

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.FindPage("PCB");
  if (page.IsValid() && doc.SelectPage(page))
  {
    var layer = page.GetLayerFromType(DlxApp.LAYERTYPE_TOPCOPPER);
    if (layer.IsValid())
    {  
      var padstyle = new DlxPadStyle();
      padstyle.InitPadSMD(1.5, 2.0);
      var handle = padstyle.AddToPublicStyles("R150X200", "smd");
      layer.DrawPad(new DlxPoint(100,150), padstyle, "1", 0);
      DlxApp.Printf("padstyle handle = %s", handle);
    }
  }
}

See also