iterating over primitives in a group
5914 4 0- arcymaszon
- Member
- 1 posts
- Joined: June 2015
- Offline
hello, i am quite new to houdini and i recently encountered a problem: i have a polygon which i divided by bricking. then i found all primitives that are too small and made a new group with them. next i made a foreach node, and wanted to iterate only by primitives in this group (to merge each one to its nearest neighbour). but foreach can only iterate over all primitives, i cant select specific group. how can it be done? also another question, inside foreach loop, if im iterating over primitives, how can i access its info (position, rotation, etc) to write in parameters?
- Enivob
- Member
- 2536 posts
- Joined: June 2008
- Offline
You can always split your network into two paths. One path will delete the group and the other will delete all but the group. You operate upon each path independently then “Merge” them back to gather for the final result.
Inside the FOREACH you can lay down a Transform node and use the global variables $CEX,$CEY,$CEZ to gain access to the centroid (pivot center) of the primitive you are processing. This is how I scaled down each primitive in the group from it's own center. You can rotate and translate as well.
Inside the FOREACH you can lay down a Transform node and use the global variables $CEX,$CEY,$CEZ to gain access to the centroid (pivot center) of the primitive you are processing. This is how I scaled down each primitive in the group from it's own center. You can rotate and translate as well.
Using Houdini Indie 20.0
Windows 11 64GB Ryzen 16 core.
nVidia 3050RTX 8BG RAM.
Windows 11 64GB Ryzen 16 core.
nVidia 3050RTX 8BG RAM.
- tamte
- Member
- 8549 posts
- Joined: July 2007
- Online
- Enivob
- Member
- 2536 posts
- Joined: June 2008
- Offline
- tamte
- Member
- 8549 posts
- Joined: July 2007
- Online
Enivobit of course always depends on what you need to accomplish
The FOREACH is convenient but I was not sure how to accomplish this without it. Do you have suggestions? I have started to see some examples where users are looping through data inside a Wrangle node.
so in some cases VEX is perfectly capable of replacing foreach - much faster
in others, like the one on your example can be easily done using Primitive SOP as attached - still much faster than foreach
while there are as well ones where you can't avoid Foreach SOP (unless you use similar technique like Copy SOP , Solver SOP, Gas Repeat etc. which would be similarly slow)
Tomas Slancik
FX Supervisor
Method Studios, NY
FX Supervisor
Method Studios, NY
-
- Quick Links