Skip to content

Instantly share code, notes, and snippets.

@yone80
Last active April 11, 2017 10:12
Show Gist options
  • Save yone80/e5e8e9ee7a7d63c3db20800a66081b5a to your computer and use it in GitHub Desktop.
Save yone80/e5e8e9ee7a7d63c3db20800a66081b5a to your computer and use it in GitHub Desktop.
Houdini Python SOP
node = hou.pwd()
geo = node.geometry()
geo.deletePrims(geo.prims(), True)
pt_delete = set(geo.points())
ptns = node.parm('group').eval().split()
for ptn in ptns:
edges = geo.globEdges(ptn)
pre_pt_idx = -1
for e in edges:
points = e.points()
if pre_pt_idx != points[0].number():
poly = geo.createPolygon()
poly.setIsClosed(False)
poly.addVertex(points[0])
pt_delete.discard(points[0])
poly.addVertex(points[1])
pt_delete.discard(points[1])
pre_pt_idx = points[1].number()
geo.deletePoints(list(pt_delete))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment