Removes the specified object from this selection.

syntaxSyntax:
DlxSelection.RemoveObject(object)

Parameters

Parameter Description
object The object derived from DlxObject to be removed from this selection.

Return Value

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

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())
    {
      // create objects
      var pen = new DlxPenStyle(0.5, new DlxColor("orangered"), "DASHED");
      doc.SetStyle(pen);
      var obj1 = layer.DrawLine(new DlxPoint(30, 30), new DlxPoint(80, 80));
      pen.SetWidth(1);
      doc.SetStyle(pen);
      var obj2 = layer.DrawLine(new DlxPoint(40, 30), new DlxPoint(90, 80));
      pen.SetDashStyle("SOLID");
      doc.SetStyle(pen);
      var obj3 = layer.DrawLine(new DlxPoint(50, 30), new DlxPoint(100, 80));
      var obj4 = layer.DrawEllipse(new DlxPoint(100, 80), 10);
      // moves objects
      var selection = page.GetSelection();
      selection.Empty();
      selection.AddObject(obj1);
      selection.AddObject(obj2);
      selection.AddObject(obj4);
      var i = selection.GetTailObjectIterator();
      while (i.IsValid())
      {
        var obj = selection.GetPrevObject(i);
        DlxApp.Printf("object type: %s", obj.GetTypeName());
      }
      selection.RemoveObject(obj4);
      DlxApp.Printf("After removing the circle, %i objects remain.", selection.GetCount());
    }
  }
}

See also