[Sidefx-houdini-list] HOM changing geometry selection

Andy Nicholas andy at andynicholas.com
Thu Jul 27 03:44:12 EDT 2017


Hi Tom,
I’ve got half an answer for you. If you create a string parm on some node and fill it with point IDs, you can use the following python code to load it as a selection in the current viewer, edit it, and set it back to the original parameter. It basically works a bit like the “re-pick” button for group parameters.

# Set these up to point at your node and string parameter name
this_node = hou.node('/obj/geo1/subnet1')
parm_name = "point_group_str"

kwargs={}
kwargs["node"] = this_node
kwargs["parmtuple"] = n.parmTuple(parm_name)         # The name of the parameter to read/write
kwargs["geometrytype"] = hou.geometryType.Points    # The geometry type of the ids in the parameter
kwargs["inputindex"] = 0                                                # The input index of the node
soputils.selectGroupParm(kwargs)

So the code you need is all in the soputils.selectGroupParm() function. That’s why I’m saying this reply is only half an answer, as you’ll need to copy that function and reduce it down to the fundamental functionality that you need. The important call is to “selectGeometry()" at line 300. It’s undocumented and I’ve not had time to figure out the exact parameter values you need to pass it to get what you’re after, but I’m fairly sure you should be able to get what you need.

Hope that helps,
Andy


> On 27 Jul 2017, at 00:20, Tom Nixon <ignivomous at gmail.com> wrote:
> 
> Thanks Andy,
> 
> I would like to be able to provide a list of points/prims or their numbers
> and have that change the selection in the viewport (feature request made
> for a tool I have).
> 
> Seems the tools stop short of that ability - unless I'm missing something
> staring me in the face!
> 
> Cheers
> 
> On Wed, Jul 26, 2017 at 11:24 AM, Andy Nicholas <andy at andynicholas.com>
> wrote:
> 
>> Check out the second paragraph on this page. I think it explains what
>> you’re after:
>> 
>> www.sidefx.com/docs/houdini/hom/hou/Selection
>> 
>> Note that you have the constructor functions for hou.Selection where you
>> can create your own selection object and specify the points, primitives,
>> etc.
>> 
>> Cheers,
>> Andy
>> 
>> 
>>> On 26 Jul 2017, at 18:49, Tom Nixon <ignivomous at gmail.com> wrote:
>>> 
>>> Sorry, by change, I mean to set explicitly (not grow or shrink an
>> existing
>>> selection).
>>> 
>>> On Wed, Jul 26, 2017 at 10:42 AM, Tom Nixon <ignivomous at gmail.com>
>> wrote:
>>> 
>>>> Hey all,
>>>> 
>>>> I'm just hoping there is now some way to change the geometry selection
>>>> through HOM. I've come up short in the past, but maybe someone out there
>>>> has come across a way to do it?
>>>> 
>>>> Thanks,
>>>> Tom
>>>> 
>>> _______________________________________________
>>> Sidefx-houdini-list mailing list
>>> Sidefx-houdini-list at sidefx.com
>>> https://lists.sidefx.com:443/mailman/listinfo/sidefx-houdini-list
>> 
>> _______________________________________________
>> Sidefx-houdini-list mailing list
>> Sidefx-houdini-list at sidefx.com
>> https://lists.sidefx.com:443/mailman/listinfo/sidefx-houdini-list
>> 
> _______________________________________________
> Sidefx-houdini-list mailing list
> Sidefx-houdini-list at sidefx.com
> https://lists.sidefx.com:443/mailman/listinfo/sidefx-houdini-list




More information about the Sidefx-houdini-list mailing list