Zybrand Posted June 27, 2016 Share Posted June 27, 2016 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 Quote Link to comment Share on other sites More sharing options...
acey195 Posted June 27, 2016 Share Posted June 27, 2016 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 Quote Link to comment Share on other sites More sharing options...
f1480187 Posted June 27, 2016 Share Posted June 27, 2016 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 1 Quote Link to comment Share on other sites More sharing options...
Zybrand Posted June 28, 2016 Author Share Posted June 28, 2016 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 Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.