magneto Posted March 10, 2015 Share Posted March 10, 2015 Hi, I noticed Foreach SOP has a Stop Condition parameter but there is no example that I could find. For example can I stop it when a detail attribute has a certain value or when a group has no elements inside? It mentions something about stamping but I don't know what I can stamp? Should I be stamping the each node inside? Thanks Quote Link to comment Share on other sites More sharing options...
sadhu Posted March 10, 2015 Share Posted March 10, 2015 one use of stop condition that I know is to visualize output of each iteration. Write stamp(".","FORIDXVALUE",0)>$F in stop condition. If this value evaluates to zero it will continue not otherwise. If you compare this with a detail attribute , it should work. 1 Quote Link to comment Share on other sites More sharing options...
magneto Posted March 10, 2015 Author Share Posted March 10, 2015 Thanks I tried it but it says "infinite recursion". Also stamping only supports point attributes? Because mine is a detail attribute. Quote Link to comment Share on other sites More sharing options...
sadhu Posted March 10, 2015 Share Posted March 10, 2015 can you upload a test file ? Quote Link to comment Share on other sites More sharing options...
magneto Posted March 10, 2015 Author Share Posted March 10, 2015 (edited) Ok I made a simple file. I increment "aa" to 100, but I want Foreach to stop if "aa" is greater than 30. Thanks. foreachstop.hip Edited March 10, 2015 by magneto Quote Link to comment Share on other sites More sharing options...
sadhu Posted March 10, 2015 Share Posted March 10, 2015 try detail("../foreach1/attribwrangle1","aa",0)>30 in stop condition. Now value of "aa" is not going beyond 30. I never used it this way before. Not sure if this is the solution or it will work in all the cases. Will do more tests once I get little free time. 1 Quote Link to comment Share on other sites More sharing options...
GeordieM Posted May 28, 2015 Share Posted May 28, 2015 Did anyone ever get this working? Quote Link to comment Share on other sites More sharing options...
magneto Posted May 28, 2015 Author Share Posted May 28, 2015 You can reference the each1 node inside like this: argc(pointlist("../foreach1/each1", "mypointsgroup")) == 0 Quote Link to comment Share on other sites More sharing options...
GeordieM Posted May 28, 2015 Share Posted May 28, 2015 OK magnito I got you simple example working, I must be doing something weird in the other test I was making. There's a detail attrib called maxCount, set that to the max number of loops... TNKS! G foreachstop_working.hip Quote Link to comment Share on other sites More sharing options...
GeordieM Posted May 28, 2015 Share Posted May 28, 2015 Coolz, I wanted to do what I just uploaded but can't get to work with my specific example so must be something else going wrong... Quote Link to comment Share on other sites More sharing options...
magneto Posted May 28, 2015 Author Share Posted May 28, 2015 This example is working but you should prefix your attribute references in AttribWrangle with the right type, which in your case is i, so i@c, i@stop. I don't know if this could your issue in your other file but something to keep an eye on. Quote Link to comment Share on other sites More sharing options...
GeordieM Posted May 28, 2015 Share Posted May 28, 2015 Sorry yeah forgot that, but am doing that correctly in my other hip file, 'll clean it up and post it soon 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.