Elon Posted May 7, 2020 Share Posted May 7, 2020 (edited) Hey all, I want to execute some operations every x iterations. Is there any simple way? I just started learning Houdini, I tried a dumb method below. Although it seems to work, it will take more time... As shown in figure 1, it's the beginning of an orange loop, I hope to do some check or delete operations in the green loop every 30 iterations of ORANGE. This is the expression in switchif5, call the iteration of ORANGE and divide it by 30, then use round () to judge whether it is an integer. (Incidentally, how to judge whether it is an integer more concisely) and if the bool result is ‘1’, means it's not 30/60/90th... iteration, so it will execute input1 and output nothing. And the same bool value ‘1’ will also be called in switchif6, so it will output without any operation in GREEN. And the ‘1’ will also be called at stop condition of GREEN end. so the GREEN will not run, too. (GREEN seems to run at least once before stop condition judging, but it runs with no data which output in switchif5) So does the calculation still take time even if run with empty data? Thanks! Edited May 7, 2020 by Elon Quote Link to comment Share on other sites More sharing options...
Noobini Posted May 8, 2020 Share Posted May 8, 2020 (edited) while trying out things, just keep it simple if you can... vu_XthIter.hiplc (no I can't refer to Keep It Simple Stupid paradigm anymore...it's no longer politically correct) Edited May 8, 2020 by Noobini 1 Quote Link to comment Share on other sites More sharing options...
k2p8 Posted May 9, 2020 Share Posted May 9, 2020 you can try a modulo (%) to execute instructions every x iterations if your variable is an integer like : if(integer%30 == 0, 1, 0) in that case it will execute instruction every 30 iterations 1 Quote Link to comment Share on other sites More sharing options...
Elon Posted May 12, 2020 Author Share Posted May 12, 2020 Thank you guys, I have optimized it and realized that I used a lot of text to describe a simple and stupid question 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.