(Deprecated) Add child nodes

This example uses API v1. See Add child nodes for example with API v2.

deprecated/addChildren.py
 1# © 2024 Autodesk, Inc. All rights reserved.
 2
 3# clean the scene
 4newScene();
 5
 6# create planet and moons
 7planetNode = createSphere(4, 3.0, .0 , .0, .0)
 8planetNode.setName("Planet")
 9
10moon1Node = createSphere(4, .5, .0 , .0, .0)
11moon1Node.setName("Moon")
12moon1Node.setTranslation(5.0,3.0,5.0)
13
14moon2Node = createSphere(4, .2, .0 , .0, .0)
15moon2Node.setName("Moon2")
16moon2Node.setTranslation(-1.0,6.0,0.0)
17
18# create a list of the moon nodes
19moonlist = []
20moonlist.append(moon1Node)
21moonlist.append(moon2Node)
22
23# create a new group for the moons
24moonGroup = createNode("Group","Moons")
25
26# add moons as children to the group
27addChilds(moonGroup,moonlist)
28
29# create a new group for the planet and the moon group
30planetGroup = createNode("Group","Planet")
31
32# add the planet and the moon group to the planet group
33addChilds(planetGroup, [moonGroup, planetNode])
34
35# moving the planet group with all children
36planetGroup.setTranslation(5.0,5.0,0.0)