Last active
April 11, 2017 10:12
-
-
Save yone80/e5e8e9ee7a7d63c3db20800a66081b5a to your computer and use it in GitHub Desktop.
Houdini Python SOP
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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