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

<node3d>.addParent

Add a parent to the node

<node3d>.addParent(  
parent  
scene = viz.MainScene  
node = ''  
)  
parent
This can be another <node3d> object or one of the following:

viz.WORLD
viz.SCREEN
viz.ORTHO
scene = viz.MainScene
If viz.WORLD or viz.SCREEN is given as the parent, then this parameter specifies which scene to attach the node to.

If viz.ORTHO is given as the parent, then this parameter specifies which window to attach the node to.
node = ''
If parenting to another node3d object, this value specifies the name of the subnode to place this node under. The name must refer to a OSG group node.

Remarks

This command will attach the node to the specified parent, but preserve existing parents. This allows the node to exist in multiple scenes at the same time.

Return Value

None

Example

#Add the ball to scene 1 (default)
ball = viz.add('ball.wrl')

#Duplicate the ball to scene 2
ball.addParent(viz.WORLD,2)

#The ball will be translated on both scenes
ball.setPosition(0,1,0)

See also

<node3d>.clone
<node3d>.copy
<node3d>.removeParent
<node3d>.setParent
<node3d>.clearParents
<node3d>.clearChildren