Python Group Extractor

mail@pastecode.io avatar
unknown
python
2 years ago
444 B
5
Indexable
Never
node = hou.pwd()
geo = node.geometry()
parent = node.parent()
pos = node.position()
groups = geo.primGroups()

pos_offset = -3


for group in groups:
    pos_offset += 3
    name = group.name()
    next_pos = [pos[0] + pos_offset, pos[1] -2]
    blast = parent.createNode("blast")
    blast.setFirstInput(node)
    blast.setPosition(next_pos)
    blast.parm("group").set(name)
    blast.setName(f"extracted_{name}")