Hi~I recently meet the problem to batch move objects with the same offset distance, however, to set position respectively can be a disaster and a little fool, so I want to make them as children of a Null object that I can move all of them with just move Null object.
To let other potential beginners better pick up and understand, let me make 2 cubes as an easy example, so how to set B cube as the child of A cube by python? what if two B cubes or more?
#?????unknow how to set children ???
TO inserts cube as a child of another one, call BaseList2D.InsertUnder Then here you can call BaseObject.SetRelPos To set the relative position. The relative position is relative to the parent so this way you can easily have the same distance between multiple objects.
# Main function
# Creates 3 cubes in memory
aCube = c4d.BaseObject(c4d.Ocube)
bCube = c4d.BaseObject(c4d.Ocube)
cCube = c4d.BaseObject(c4d.Ocube)
# Inserts C under B, and B under A
# Defines the relative position of B and C
bCube.SetRelPos(c4d.Vector(250, 0, 0))
cCube.SetRelPos(c4d.Vector(250, 0, 0))
# Inserts a and all its children into the current document
# Pushes an update event to Cinema 4D
# Execute main()
Finally, while it's in C++, all the knowledge is applicable in python so I warmly suggest you to read the GeListNode Manual.
If you have any questions, let me know.
@m_adam Thanks a lot, great help, I will try your way