Jump to content
Zybrand

foreach changing point order in solver sop

Recommended Posts

Hey guys,

I am using a foreach block in a solver sop but the foreach causes my point orders to changes, if I bypass the the foreach my point order stays intact as the points accumulate. In the foreach I am using a static point attribute that exists on the points before they enter the solver, and in the solver I want to use the attribute to apply different transforms to the points based on geometry with a matching attribute. Everything about the setup works apart from the point orders changing as the point increase messing up my system later down the line.

I attached a simple example to illustrate the problem. Any ideas for what I am doing wrong or could do differently?

Thanks,

Zybrand

foreach_point_order.hip

Share this post


Link to post
Share on other sites

you can use a "Sort" Sopnode directly after the foreach node to sort your points "by attribute", by your static point attrib so the order should become the same, as before the foreach again ;)

Share this post


Link to post
Share on other sites

It's like splitting pieces and merging back. Point order will be reordered to eliminate gaps within clusters: 0 1 2 3 4 5 will became 0 1 2 3 4 5, since it is impossible to have geometry with four points numbered as 0 1 2 and 5. Use @id point attribute for this.

There is also bad expression in Delete node. Metadata node creates "iteration" and "numiterations" attributes. Nonenexistent "iterations" attribute was used, result is always zero. Also every point will be deleted if expression result is non-zero. Not sure what need to be deleted there.

 

foreach_point_id.hipnc

  • Like 1

Share this post


Link to post
Share on other sites

Thanks for the help guys.

acey195 thanks for reminding me of the sort sop, so handy but I always forget about it. Your solution is clever but it does not work in my full setup because I am applying forces to the points and I can't have it re-sort in the solver each timestep.

F1 the delete sop iteration was a typo on my part in the example file, I see I didn't even write out the expression properly on that one, my bad. Thanks for the explanation on splitting pieces and merging them back that makes sense.

I changed my setup to calculate unique point ids for the points when they first enter the solver and I am using a sort sop after the solver to sort the point numbers according to the ids.  Attached is my setup with moving points.

 

foreach_point_order_fix.hip

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

×