Gets the project netlist.

syntaxSyntax:
DlxProject.GetNetlist(options = 0)

Parameters

Parameter Description
options Enter a combination of the following values:
DlxApp.NETLISTFLAGS_NOREPORT Any messages produced during the compilation of the netlist are not shown.
DlxApp.NETLISTFLAGS_FORSIMULATOR The netlist does not include components excluded from the simulation.
DlxApp.NETLISTFLAGS_FORPCB The netlist does not include components excluded from the PCB.
DlxApp.NETLISTFLAGS_FORBOM The netlist does not include components excluded from the BOM.

Return Value

Returns the DlxNetlist corresponding to the project. If the netlist contains errors it returns an invalid object. Call the IsValid() method to determine if the object is valid.

Example

  Copy codeCopy code
var project = DlxApp.GetJob().GetProject();
if (!project.IsValid())
{
  throw new Error("Project not found.");
}

var netlist = project.GetNetlist(DlxApp.NETLISTFLAGS_NOREPORT|DlxApp.NETLISTFLAGS_FORBOM);
if (!netlist.IsValid())
{
  throw new Error("Invalid netlist.");
}

var valLen = 31;
var refLen = 14;
var devicesort = new DlxSort(DlxApp.SORT_TEXTFIRSTINT, false);
for (var i = 0; i < netlist.GetDeviceCount(); i++)
{
  var device = netlist.GetDevice(i);
  valLen = Math.max(valLen, device.GetValue().length);
  refLen = Math.max(refLen, device.GetReference().length);
  devicesort.AddString(device.GetReference(), i);
}
devicesort.Sort();

var pinNumLen = 7;
var pinNameLen = 14;
var pinTypeLen = 14;
for (i = 0; i < netlist.GetNetCount(); i++)
{
  var net = netlist.GetNet(i);
  if (net.GetPinCount() > 1)
  {
    for (var j = 0; j < net.GetPinCount(); j++)
    {
      var pin = net.GetPin(j);
      pinNumLen = Math.max(pinNumLen, pin.GetNumber().length);
      pinNameLen = Math.max(pinNameLen, pin.GetName().length);
      pinTypeLen = Math.max(pinTypeLen, pin.GetTypeName().length);
    }
  }
}

var deviceFormat = DlxApp.Format("%%-%is %%-%is %%-%is", valLen, refLen, refLen);
var lineFormat = DlxApp.Format("%%-7s %%-%is %%-%is %%-%is %%-%is %%s", refLen, pinNumLen, pinNameLen, pinTypeLen);

var file = new DlxFile("temp\\netlist.txt", DlxApp.FILEOPEN_WRITETEXT);
if (!file.IsValid())
{
  throw new Error("Unable to open file.");
}
file.Write("Wire List\n\n");

file.Write("<<< Component List >>>\n");
for (i = 0; i < devicesort.GetCount(); i++)
{
  device = netlist.GetDevice(devicesort.GetData(i));
  file.Write(DlxApp.Format(deviceFormat, device.GetValue(), device.GetReference(), "")+"\n");
}

var count = 0;
file.Write("\n<<< Wire List >>>\n");
file.Write(DlxApp.Format(lineFormat, "NODE", "REFERENCE", "PIN #", "PIN NAME", "PIN TYPE", "PART VALUE")+"\n");
for (i = 0; i < netlist.GetNetCount(); i++)
{
  net = netlist.GetNet(i);
  if (net.GetPinCount() > 1)
  {
    file.Write(DlxApp.Format("[%.5i] %s\n", ++count, net.GetName()));
    for (j = 0; j < net.GetPinCount(); j++)
    {
      pin = net.GetPin(j);
      device = pin.GetDevice();
      file.Write(DlxApp.Format(lineFormat, "", device.GetReference(), pin.GetNumber(), 
       pin.GetName(), pin.GetTypeName(), device.GetValue())+"\n");
    }
  }
}
DlxApp.Printf("ICONINFORMATIONNetlist saved in %s", file.GetFilePath());

See also