Hey all! I am trying to create a method to delete primitive groups based on the @P.y value. I have it working to delete the primitive faces, but not the group/(pattern?). Any suggestions? the end goal is to create an hda out of the setup.
I attempted to use a delete expression as well as try to use vex, but I do not know how to select the primitive groups (like @name=tire, @shop_materialpath=licensePlate, etc.) to structure it into an expression. In the second image, you can see the prim group options I would like to delete.
Delete Primitive Groups by an expression/node
1676 3 1-
- anon_user_29325004
- Member
- 9 posts
- Joined: 12月 2023
- オフライン
-
- Tanto
- Member
- 542 posts
- Joined: 11月 2016
- オフライン
-
- animatrix_
- Member
- 5100 posts
- Joined: 2月 2012
- オフライン
Hi,
Here is one way to do it using VEX:

If you know each prim only belongs to a single group, you can optimize it further.
Here is one way to do it using VEX:
float height = ch("height"); string primgroups [ ] = detailintrinsic ( 0, "primitivegroups" ); foreach ( string group; primgroups ) { vector center = getbbox_center ( 0, group ); if ( center.y < height ) { int prims [ ] = expandprimgroup ( 0, group ); foreach ( int pr; prims ) removeprim ( 0, pr, 1 ); } }

If you know each prim only belongs to a single group, you can optimize it further.
Senior FX TD @ Industrial Light & Magic
Get to the NEXT level in Houdini & VEX with Pragmatic VEX! [www.pragmatic-vfx.com] https://lnk.bio/animatrix [lnk.bio]
Get to the NEXT level in Houdini & VEX with Pragmatic VEX! [www.pragmatic-vfx.com] https://lnk.bio/animatrix [lnk.bio]
-
- anon_user_29325004
- Member
- 9 posts
- Joined: 12月 2023
- オフライン
Thanks for the feedback! I actually resolved this a while ago and completely forgot to follow up with my initial post. I realize some people out there may try to do something similar, so I wanted to explain my solution, as I believe it is a little simpler.
First of all, I essentially applied the logic of @animatrix_, however instead of using VEX, I used the for each connected piece SOP, however I would suggest using For Each Named Piece if the primitives are named and organized already.
I used a point wrangle and created a variable for the getbbox_center() vector position to get the center position of each connected piece,and created an if statement stating if the Y value is greater than a certain value, use the removepoint() function to delete all the points and prims (using the @ptnum attribute).
This is of course a basic setup to get this done, without creating channels and other complementary functionality. Hope this helps someone that was trying something similar. Let me know if anyone needs further explanation or has any questions.
Below is a demo just using craig,but works the same way.
First of all, I essentially applied the logic of @animatrix_, however instead of using VEX, I used the for each connected piece SOP, however I would suggest using For Each Named Piece if the primitives are named and organized already.
I used a point wrangle and created a variable for the getbbox_center() vector position to get the center position of each connected piece,and created an if statement stating if the Y value is greater than a certain value, use the removepoint() function to delete all the points and prims (using the @ptnum attribute).
This is of course a basic setup to get this done, without creating channels and other complementary functionality. Hope this helps someone that was trying something similar. Let me know if anyone needs further explanation or has any questions.
Below is a demo just using craig,but works the same way.
-
- Quick Links


