Grasshopper

algorithmic modeling for Rhino

iterative remove, insert objects in different lists

Hi everyone,

is it possible to remove certain objects in a list iteratively and insert them to another list?

regards,

yilmaz

Views: 1095

Replies to This Discussion

Hi Yilmaz,

Yes, it is possible. You need a Hoopsnake component.

This is a concept, it may help you to understand what you need to do.
I did it as an inspiration of tonights Arsenal F.C. match:

A definition shows which one of the players will Arsène Wenger, get rid off first, based on their age.
In each iteration he will get rid of the three oldest players in team, and transfer them to another NN club (another list):

Right click on Hoopsnake (component grouped in green color) and choose "Step". By repeating this, you will increase the number of desired iterations (desired transfers).
To get back to the beginning and cancel all transfers, right click on Hoopsnake and choose "Reset all".

If this is the first time you are using the hoopsnake, consult their official pages:

http://yconst.com/computation/hoopsnake

http://www.grasshopper3d.com/group/hoopsnake

And download some of the Example files from here:

http://www.food4rhino.com/project/hoopsnake

Attachments:

thanks a lot. gonna try it

Hi djordje,

finally I implemented Hoopsnake to my file. But the Auto-Loop-Function did not work. The Step-Function works fine, it is removing the predifened object. But Loop - no chance :(

Any suggestions why not?

Attachments:

"Auto loop all" will not determine the list you want.
Instead of that, it will make as many iterations as possible until the input list is empty (every point is culled). Then it will restart itself from the beginning.

What exactly do you want to achieve? Or to be more precise, what is the lowest value of "List length" (far most right comonent in your definition) you are searching for? 0?

what I want to do is actually remove objects in a list which do not match the given conditions. The removed objects should should be inserted to another list, where they can probably match the conditions, if not go to the other list.. and so on and so on

In the attached file the lower minimum of objects in the list should be 40, if 40 is reached than stop the iteration

Check the attached file.
When you open it, right click on "Hoopsnake" component and choose "Reset all" (you need to do this each time you open your .gh file). Then again right click and choose "Loop".

Basically your approach was correct, you just made a mistake when it comes to "smaller then" component. You needed "larger than" instead.

Attachments:

thanks!

Hey djordje,

one little question left. :)

Is it possible to create multiple hoops? Each of them depending on the next one etc. etc. In fact i find two threads in this forum, both of them without an answer yet.

Sorry I did not try using multiple Hoopsnake components.
Maybe it's possible, maybe not, I do not know.

the oficial hoopsnake examples show how to do that.

I see you're still stuck on loop logic. :)

To split the list into 40 items and have the rest in another list, there is a component doing exactly that. I see you reversed the list and culled from the front until 40 items are left. So I took the liberty to restore orginal ordering and split the list at item 40. Does exactly what your HS def does... just without HS. ;)

Attachments:

RSS

About

Translate

Search

Photos

  • Add Photos
  • View All

© 2024   Created by Scott Davidson.   Powered by

Badges  |  Report an Issue  |  Terms of Service