Search - User list
Full Version: Select by @id in SOP group param
Root » Technical Discussion » Select by @id in SOP group param
Noboru Saka
hi,
When you select a Group using a Transform (SOP) with the mouse, the group selection is based on @ptnum.
However, when you have a large number of particles in a particle simulation, you often want to reduce them to 70% using delete (SOP), and sometimes you want to reduce it to 65%.
And if you don't approve the position of some of the points, you might shift them slightly using a Transform (SOP).
In that case, you'll regret reducing the group with delete (SOP) earlier. This is because when the percentage of increase or decrease changes, the points selected by the Transform (SOP) shift to other points.
Therefore, I think it would be better if this were selected based on @id. This isn't limited to particles; it applies everywhere.
For example, you can create a Python tool like this. It's easy.

/A script tool to convert the @ptnum group of an SOP to selection by @id
//group:24,33 -> group :@id=34 @id=22
node = hou.selectedNodes()[0]
geo = node.geometry()
id_list = [f"@id={p.attribValue('id')}" for p in geo.globPoints(node.parm('group').eval())]
node.parm('group').set(" ".join(id_list))

But it's a lot of trouble, and I wonder if there's a better way.

thanks
tamte
in Viewport Select state, press 9 to turn on Select Group mode, then Gear menu and pick Attributes/Id
then select some points in the viewport, press Enter and it will fill your Group parm with @id=1,22,33 etc..
same for any int or string attribute like @name, @path, ...
FedorK_FX
The selection is not based on ids by default because id is not an intrinsic or required attribute, you won't always have it. The cleanest way I'd say is to create a point group with a Group SOP using "Keep by Random Chance" parameters that does accept seed attributes like id. Then you delete the group with a Blast SOP.
Noboru Saka
using Select Group mode, i have got a group expressed by @id. great tips.
thanks
This is a "lo-fi" version of our main content. To view the full version with more information, formatting and images, please click here.