Separate the objects in the group.
Syntax: |
---|
DlxSelection.Ungroup() |
Return Value
If the operation ends correctly, it returns true otherwise it returns false.
Remarks
The ungroup method deletes the grouping applied to objects. The group is deleted and its individual objects are added to the document.
Example
Copy 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"), "SOLID");
doc.SetStyle(pen);
var obj1 = layer.DrawLine(new DlxPoint(30, 30), new DlxPoint(80, 80));
var obj2 = layer.DrawEllipse(new DlxPoint(80, 80), 10);
DlxApp.Printf("%i objects in the layer.", layer.GetObjectCount());
// group the objects
var selection = page.GetSelection();
selection.Empty();
selection.AddObject(obj1);
selection.AddObject(obj2);
selection.Group("Line and Circle");
DlxApp.Printf("%i objects in the layer.", layer.GetObjectCount());
selection.Ungroup();
DlxApp.Printf("%i objects in the layer.", layer.GetObjectCount());
}
}
}
|