Skip to content

Instantly share code, notes, and snippets.

@crydalch
Created July 25, 2012 23:47
Show Gist options
  • Save crydalch/3179399 to your computer and use it in GitHub Desktop.
Save crydalch/3179399 to your computer and use it in GitHub Desktop.
Fracture Points SOP
#
# A companion SOP to the Points to Fracture shelf tool. Generates points,
# and applies the instance attribute to them.
#
node = hou.pwd()
geo = node.geometry()
# Add code to modify the contents of geo.
if node.parm("pointlist").eval():
plist = node.parm("pointlist").eval()
plist = plist.split(" ")
if node.parm("attrlist").eval():
ilist = node.parm("attrlist").eval()
ilist = ilist.split(" ")
inst_attr = geo.addAttrib(hou.attribType.Point, "instance", "")
coords = []
for x in plist:
c = [ float(c) for c in x.split(',') ]
coords.append(c)
i=0
while i < len(coords):
pt = geo.createPoint()
pt.setPosition(coords[i])
if node.parm("attrlist").eval():
pt.setAttribValue(inst_attr, ilist[i])
i+=1
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment