Grasshopper

algorithmic modeling for Rhino

Hi,
I have a little problem. Suppose I input a list of 20 boxes and 10 random index integers (in interval 0-20) to "list item component"... The question is how can I get those 10 boxes that remained?
Is there any way to compare two lists of geometries or substract one from another(if there are some common items in both lists)?

Thanks,
Simon

Views: 518

Replies to This Discussion

To answer your question directly if there is a way to compare two list and subtract comon items? I do not realy know right now if there is an easy "worth it way" to do it.

But this would be my approach, also because random numbers (which I have never tried before) repeats some random numbers which means your select item component will select an item twice and in doing so not realy split your random numbers into two lists of 10 but rather select maybe 8 out of the 20. This is why I use Jitter and Split list which seems to me solves the problem before it begins. You get your list of 20 boxes split into two random lists this way. If my explanation was exhaustive and unnecessary I appoligize.

I forgot to show it on the picture, the 20 is divided by "2" to split the list in the middle.

Hope its helpful :)
Attachments:
Thanks for answering!
I tried this way and finaly I have solved my problem. I also tried with "contains(s,p) function" but it works with strings and numbers.
We can imagine some cases when this solution wouldn't work. The thing is complicating if we consider more complex series of indexes for instance( 1,2,3, 7,8,9, 13,14,15...)etc.
I realized that It would be much easier if "list item comp" could return also remained part of list.
This is my small wish...
If you have more specific "indexes" or intervals you would like to extract use the "Sub List" component. Input your list of objects and specify one or multiple intervals you want extracted.
"for instance( 1,2,3, 7,8,9, 13,14,15...)etc. I realized that It would be much easier if "list item comp" could return also remained part of list."

Also try "Cull Patern" component. Then right click and select "Invert", it will give you the other side of the list. It easily does what you mentioned above.
Attachments:
Huge thanks!
You 've just enlightened me about two things (multiple intervals and inverted cull)
I should look into components menus closer :)

I attach my definition which inspired me to this question... maybe somebody will find more elegant way to make this type of thing
Attachments:

RSS

About

Translate

Search

Photos

  • Add Photos
  • View All

Videos

  • Add Videos
  • View All

© 2024   Created by Scott Davidson.   Powered by

Badges  |  Report an Issue  |  Terms of Service