Vizard 7 » Command Index » Vizard objects » node3d » <node3d>.getChild
7.6

<node3d>.getChild

This action grabs a subchild from a child object

<node3d>.getChild(  
name  
flags = viz.CHILD_DEFAULT  
)  
name
Specifies the name of the object. This should correspond to the node name found in the scene graph file or the name given to the sub-object in the modeling program used to create this parent object.
flags = viz.CHILD_DEFAULT
One of the following flags:

Flag

Description

viz.CHILD_INSERT_TRANSFORM

When creating the new node object, insert the node transform above the found child node.

viz.CHILD_REPLACE_TRANSFORM

When creating the new node object, replace the found child node with the new node transform. The child node must be an OSG Group or Transform node. If the child node is a Transform node, the transform matrix will be preserved.

viz.CHILD_DEFAULT

The default flag is viz.CHILD_INSERT_TRANSFORM

Remarks

This command will create a new Vizard <node3d> object from the underlying scene graph node with the specified name. If there are multiple scene graph nodes with the same name, then the first encountered node will be used.

Calling this command multiple times with the same name and flags will return the same <node3d> object.

When using the default viz.CHILD_INSERT_TRANSFORM flag, the underlying scene graph of the node will by slightly modified, by inserting a transform above the specified child node.

The viz.CHILD_REPLACE_TRANSFORM flag is useful when the child node is an OSG Transform node and you want the new node to contain the existing transform matrix of the child. In this case, instead of inserting a transform above the child node, the child node is removed from the scene graph and replaced by the new node transform.

Note: This command does not work on underlying OpenSceneGraph osg::Drawable objects. The specified name must refer to an osg::Node object.

Return Value

<node3d> object

Example

parent = viz.add('robot_arm.wrl')
elbow = parent.getChild('elbow_joint')
elbow.setAxisAngle(1,0,0, 45)

See also

<node3d>.getChildren
<node3d>.getParents
<node3d>.getNodeNames
<node3d>.insertGroupAbove
<node3d>.insertGroupBelow
<node3d>.getTransform