Composite Objects with frame

You can group objects together to make a composite object that can be moved and rotated as though it were a single object. Create a frame object, and associate objects with that frame:

f = frame()

cylinder(frame=f, pos=(0,0,0), radius=0.1, length=1, color=color.cyan)

sphere(frame=f, pos=(1,0,0), radius=0.2, color=color.red)

f.axis = (0,1,0)

f.pos = (-1,0,0)

By default, frame() has a position of (0,0,0) and axis in the x direction (1,0,0). The cylinder and sphere are created within the frame. When any of the frame attributes are changed (pos, x, y, z, axis, or up), the composite object is reoriented and repositioned.

Another frame attribute is objects, which is a list of objects contained in the frame. If you want to make all the objects in a frame temporarily invisible, do the following (assume the frame is named f):

for obj in f.objects:
obj.visible = 0

You could use a similar method to set all the objects in a frame to have the same color.