Jump to content

Fill Selection


Drughi

Recommended Posts

Hi!
In Cinema there is a feature called fill selection (see gif). I really miss it in Houdini and would like to recreate it using Python. I know some Python, but I've never used it for geometry related stuff. Since I don't know the functions I'm not sure on how to find the corresponding primitives. Can someone help me getting started? How would you approach it?

Any help is much appreciated!

ezgif-5-3017a8ee6528.gif

Link to comment
Share on other sites

I solved it myself. Did it the "easy way" and created the logic in sops.

Would still be interesting to do it all in Python, but this way i could easily solve it and its "more procedural".

If you are interested in the script - here you go:

import toolutils
selection = toolutils
viewer = selection.sceneViewer()
viewer.setPickGeometryType(hou.geometryType.Edges)
selection = selection.sceneViewer().selectGeometry()
node = selection.nodes()[0]

id = node.createOutputNode("attribwrangle", "point_id", 1)
id.parm("class").set("point")
id.parm("snippet").set("i@point_id = i@ptnum;")
id_pos = id.position()

blast = id.createOutputNode("blast", "edge_blast")
blast.parm("group").set(str(selection))
blast_pos = id_pos + hou.Vector2((2,-1))
blast.setPosition(blast_pos)

connectivity = blast.createOutputNode("connectivity", "connectivity", 1)
connectivity.parm("attribname").set("split_id")

copy = id.createOutputNode("attribcopy", "attribcopy", 1)
copy_pos = id_pos + hou.Vector2((0,-3))
copy.setPosition(copy_pos)
copy.setInput(1, connectivity, 0)
copy.parm("attribname").set("split_id")
copy.parm("matchbyattribute").set(1)
copy.parm("attributetomatch").set("point_id")

promote = copy.createOutputNode("attribpromote", "attribpromote", 1)
promote.parm("inname").set("split_id")
promote.parm("outclass").set(1)
promote.parm("method").set(0)
promote.setSelected(1, 1)
promote.setDisplayFlag(1)
promote.setRenderFlag(1)

viewer.setCurrentState("select")
viewer.setPickGeometryType(hou.geometryType.Primitives)
viewer.setGroupPicking(1)
viewer.setGroupListType(hou.groupListType.Primitives)
viewer.setGroupListMask("@split_id *")
viewer.setGroupListColoringGeometry(1)

 

ezgif-5-200cb08e2215.gif

Edited by Drughi
  • Thanks 1
Link to comment
Share on other sites

  • 1 month later...
  • 5 months later...

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...