Gets the child object identified by the specified name.
Syntax: |
DlxObject.GetChild(name, mode = DlxApp.CHILDFIND_ANYOBJECT)
|
Parameters
Parameter |
Description |
name |
The name of the object. |
mode |
Specify one of the following values:
DlxApp.CHILDFIND_ANYOBJECT |
DlxApp.CHILDFIND_VISIBLEONLY |
DlxApp.CHILDFIND_HIDDENONLY |
|
Return Value
Returns a DlxObject child object identified by the specified name.
Call the IsValid method to determine if the object is valid.
Remarks
If the object to be found belongs to a sub-level of the main object, you can use the new line character "\n"
to specify the full path. For example: obj1\nobj2\nobj3, looks for the object named obj3 included
in the object named obj2 belonging to the object named obj1.
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())
{
var pos = layer.GetFrontObjectIterator();
while (pos.IsValid())
{
var obj = layer.GetNextObject(pos);
if (obj.GetName() == "obj0")
{
var o = obj.GetChild("obj1\nobj2\nobj3");
if (o.IsValid())
{
DlxApp.Printf("Found: %s", o.GetTypeName());
}
}
}
}
}
}
|
See also