Jump to content
Sign in to follow this  

Make a loop for a few primitives.

Recommended Posts

"This is necessary for the calculation of internal power in the construction of the roof of the building. (Maxwell-Cremona diagram)"

I have several primitives - these are lines.

Each next primitive must be placed at the point # 1 of the previous primitive, and so on.

I need to automate the process in a loop (and not as I did here -
manually ).

(The problem is solved correctly if everything closes)





Edited by reinforcedcc

Share this post

Link to post
Share on other sites

So, what you need to be using is a for each loop. There are many ways the for each loop can be configured though, making them hard to figure out. 

Here are some differences key dofferences off the top of my head. 

A point wrangle (essentially a for loop over points) will do a set of code for each point, it will be able to access information from other points, but it will not actually commit those changes until the end.

ex. Say I had 5 points each with an attribute value “value” equal to two. If I said to add the previous points “value” to the current points “value”, the values would all wind up being: 2, 4, 4, 4, 4.  Rather than 2, 4, 6, 8, 10.

By default, a for each loop will isolate whatever piece it isn’t working on. So if you are working on primitives, it would delete every other primitive except for the current iteration. Then at the end it will merge all the iterations together. The problem with this is that you are unable to access other parts of your geometry. 

And then there is a mode that will go through each and every piece, but will do it as a whole (meaning it does NOT isolate every piece beforehand) AND it will update the entire geometry before going through the loop again. 

I am pretty sure this is the type of loop that you want, so do some research into for loops on houdini’s documentation.


  • Like 1

Share this post

Link to post
Share on other sites

here is an example using for loop to iterate over each primitive, but still assemble in a feedback loop to keep appending primitives


  • Like 1

Share this post

Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this