To connect a component.

syntaxSyntax:
DlxSelection.Connect()

Return Value

If the operation ends correctly, it returns true otherwise it returns false.

Remarks

The necessary but not sufficient condition to realize a physical connection between two electrical terminals is that they are physically in contact or that the coordinates of the end points coincide. The simple overlapping of the electrical terminals does not make the connection but it is necessary that the objects have been actually connected. The connection between the electrical objects is made automatically during the creation and positioning of the objects. If the objects are already positioned in the schematic, the connection must be made explicitly.

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 p1 = new DlxPoint(60,60);
      var p2 = new DlxPoint(120,60);
      var p3 = new DlxPoint(120,120)
      layer.DrawWire(p1, p2, true);
      layer.DrawWire(p2, p3, true);

      p1.x += 100;
      p2.x += 100;
      p3.x += 100;

      var w1 = layer.DrawWire(p1, p2, false);
      var w2 = layer.DrawWire(p2, p3, false);
      var sel = page.GetSelection();
      sel.Empty();
      sel.AddObject(w1);
      sel.Connect();
    }
  }
}

See also