Description This function returns the node number of the first child of the specified entity. If the specified entity has no child, then the function returns a -1.
Syntax childNode = GetChild ( nEnt )
Parameters childNode (Long) Returned node number of the first child of nEnt. If nEnt has no children, this value will be -1.
nEnt As Long Node number of the entity being queried for its first child node.
Example The example below demonstrates a recursive function that makes use of GetChild and GetSibling to recurse down the object tree hierarchy from a specific node
Dim nodeLevel As Long
Sub Main
ClearOutputWindow() Print "Entity" & vbTab & "Level" Dim startNode As Long startNode = 2 nodeLevel = 0 ResetTraceable startNode, True
End Sub
Sub ResetTraceable( ByVal nodeID As Long, _ ByVal recurse As Boolean)
Dim idx As Long If nodeID < 0 Then Exit Sub If IsSurface( nodeID ) Then Print GetFullName(nodeID) & vbTab & nodeLevel '... do something here ... End If If recurse Then idx = GetChild( nodeID ) nodeLevel = nodeLevel + 1 While idx > 0 ResetTraceable( idx, recurse ) idx = GetSibling( idx ) Wend End If nodeLevel = nodeLevel - 1
End Sub
See Also
|