Skip to content

Instantly share code, notes, and snippets.

@Dogydogsun
Created May 18, 2022 08:15
Show Gist options
  • Save Dogydogsun/3b640a718f50e6e96617623fcd17eed7 to your computer and use it in GitHub Desktop.
Save Dogydogsun/3b640a718f50e6e96617623fcd17eed7 to your computer and use it in GitHub Desktop.
Short Maya Python script to create clusters for all sub-elements of a geometry
import maya.cmds as cmds
for sel in cmds.ls(sl=True):
dup = cmds.duplicate(sel)
cmds.polySeparate(dup)
parts = cmds.ls(sl=True)
parentGrp = cmds.listRelatives(p = True)
for part in parts:
cmds.select(part)
cmds.cluster()
cmds.cluster(e=True, g=part, rm = True)
cmds.delete(part)
cmds.delete(parentGrp)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment