Grasshopper

algorithmic modeling for Rhino

Hi everyone. 

I am trying to do something very simple i think with a recursive element. 

Basically i want to move a rectangle iteratively using a counter in the Y direction.

When the distance reaches > 100 between the original rectangle and the moving rectangle i want the moving rectangle to reset to its original position but carry on moving.

Then i want this to repeat until the boolean toggle for the counter is reset.

I am not sure how to write the statement - if distance more than 100 then move -100 whilst maintaining the running of the iterations generated by the counter/timer.

Please see the attached definition which has the basics.

Many thanks

Chris 

Views: 3063

Attachments:

Replies to This Discussion

Hi,

I have answered a similar question on this post. Please notice how the stream component works in this definition. In your case, you will need to get the distance rather than the list's length. Hope this is helpful?

Best,

M.

Hi Mario,

Thanks for the answer. I've had a look at the definition and it does help - but I am still having difficulty achieving the intended result. 

This may be because the moving rectangle is in front of the hoopsnake loop not behind it. 

Any ideas? I cant seem to understand tthe logic of how to use the component so if you could give any further explanation that would be great. How to get it to reset each time so that it doesnt stop the simulation?

Regards 

Chris

Attachments:

How about this? without using the timer though, if using the timer is a prerequisite then you can affect the termination criterion by it.Best,

M.

Ok thanks again for your efforts Marios.

Perhaps i am missing something but this doesnt work for me.

I need to see the rectangle moving hence why i was using the counter and timer.

I will carry on trying different approaches!

Regards

Not working? You know that you have to double click the hoopsnake component and run the loop right? Refer to the attached GH definition.

Attachments:

Thats awesome

thank you. I opened your file - and it does work for me - I'll try and work out why my version of your previous post wasn't working then maybe i will understand where i was going wrong!

Thanks very much!

No worries!

I am glad it worked>

M.

RSS

About

Translate

Search

Videos

  • Add Videos
  • View All

© 2024   Created by Scott Davidson.   Powered by

Badges  |  Report an Issue  |  Terms of Service