Skip to content

Instantly share code, notes, and snippets.

@NiklasRosenstein
Created September 29, 2013 16:41
Show Gist options
  • Save NiklasRosenstein/6754141 to your computer and use it in GitHub Desktop.
Save NiklasRosenstein/6754141 to your computer and use it in GitHub Desktop.
@rosensteinn #c4dpytask #beginner How can you apply a Cinema 4D command to each selected object individually?
# @rosensteinn #c4dpytask #beginner How can you apply a Cinema 4D
# command to each selected object individually?
import c4d
# The ID of the Command which should be executed for each object.
# In this case, I chose the "Group Objects" command.
COMMAND_ID = 100004772
def main():
objects = doc.GetActiveObjects(c4d.GETACTIVEOBJECTS_CHILDREN)
for obj in objects:
doc.SetActiveObject(obj)
c4d.CallCommand(COMMAND_ID)
main()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment