Creates a bus line.

syntaxSyntax:
DlxLayer.DrawBus(p1, p2, bLink)
DlxLayer.DrawBus(vertices, bLink)

Parameters

Parameter Description
p1 A DlxPoint object with the coordinates specifying the bus start point.
p2 A DlxPoint object with the coordinates specifying the bus endpoint.
bLink Specify true if the bus must connect to electrical objects or false to draw only the bus line.
vertices An array of DlxPoint objects with the coordinates used to create the bus vertices.

Return Value

The last newly created DlxBus object. Call the IsValid() method to determine if the object was created correctly.

Example

  Copy codeCopy code
var prj = DlxApp.GetJob().GetProject("Example Sch");
if (!prj.IsValid())
  prj = DlxApp.GetJob().NewProject("Example Sch");
var doc = prj.GetDocument("Examples Sch", DlxApp.DOCTYPE_SCHEMATIC);
if (!doc.IsValid())
{
  doc = prj.NewDocument("Examples Sch", DlxApp.DOCTYPE_SCHEMATIC);
  doc.SetPageFormat("A4", false);
}
if (doc.IsValid() && doc.Activate())
{
  var page = doc.GetActivePage();
  if (page.IsValid())
  {
    var layer = page.GetLayerFromType(DlxApp.LAYERTYPE_DRAWING);
    if (layer.IsValid())
    {
      var busstyle = new DlxBusStyle(1.5, DlxApp.STYLE_NULL, "Blue");
      doc.SetStyle(busstyle);
      layer.DrawBus(new DlxPoint(50,50), new DlxPoint(100,50), true);
      layer.DrawBus(new DlxPoint(100,50), new DlxPoint(100,100), true);
      
      var vertices = new Array();
      vertices[0] = new DlxPoint(100,100);
      vertices[1] = new DlxPoint(150,100);
      vertices[2] = new DlxPoint(150,60);
      vertices[3] = new DlxPoint(200,60);
      vertices[4] = new DlxPoint(200,20);
      layer.DrawBus(vertices, true);
    }
  }
}

See also