Grasshopper

algorithmic modeling for Rhino

Hey guys. I'm trying to learn about this great plugin.

I'm looking for a component that splits a list in a list of list.

I have 60 values, and i'd like to get a list of 15 sublists of 4 values each.

Can you help me out ?

Views: 5410

Reply to This

Replies to This Discussion

After a long walk with the dog and a good meal I made another UserObject to make SubSets with length N. Hope I got it right, anybody care to test it too? Are there comments on the previous version above?
Attachments:

Nice work man - just a finishing touch: could be nice with a description on the C parameter: 

false- gimme a doggie bag

true- toss the leftovers

Dunno why the ceiling isn't working inside the series expression... what are you getting in there incorrectly rounded ints? unrounded Numbers?

cheers

Thanks gotjosh, isn't the C culls remainder clear? I don't think there is a way to get a proper discription like in the std components, maybe with VB or C# but I still got to learn that. But the way you describe the two options makes me think the component is quite self explanatory:)
I haven't found a way to determin what is going wrong inside the Series, I'll try and find something using the search option in the forum, some time soon. Maybe someone will notice this discussion before that and help me out.

indeed it is self-explanatory, but its nice to play with polishing the clusters to make them even more user friendly...

 

if you double click on a cluster input arrow - you can override the default name, nickname and description...

 

in this way you can get the one letter visible on the component, and on roll over get the name, type and description info.

 

note: the attached example isn't a full user object, just a cluster derived from Pieter's most recent definition with the C input description added.

 

very useful Pieter, thanks :)

Attachments:
"double click on a cluster input arrow"
That is super usefull to know! Thanks again.

(Have you tested it with multiple lists?)

i didn't test the new one with multiple lists yet, no... maybe tomorrow... you can always use the exploration i did earlier with multiple lists and swap in the new UO...

 

cheers

I tested it, and think it's working fine. My day is done too, good night.
So is this a replacement for the other?
You decide which one you like best Michael.
I originally made this UserObject to split lists of length that could actually be divided by the N number, so these are remakes of that UO, now in order to simulate the i\N behaviour of the path mapper (which comes with a doggie bag if you make groups of say 6 items from a list of say 20 items)
path mapper hurts my head still. Can I ask what I asked previous. Is it improper to make components that keep data structure the same as input lists rather than add a {0}? so {0;0} stays {0;0} as opposed to {0;0;0}? I understand the data tree, I just cant clearly see what the advantage of one over the other is. thanks.

unfortunately, the answer is: it depends.

If the component is adding something to the tree that is relevant then it makes sense to add branches.

If it is just manipulating within a list or tree, then maybe not.

 

Ex: if i have 3 rectangles sent in at {0;0} and i make a component to return the 2nd edge and 4th edge of each of them, i need to have a new branch level so that i will have 2 edges in each of three new branches

{0;0;0}(N=2)

{0;0;1}(N=2)

{0;0;2}(N=2)

 

if i simplified back into {0;0} then i would have N=6 but the data wouldn't be divided as logically into meaningful sets.

 

(its getting late - i hope this makes sense)... good luck and good night...

let me just say thanks, you just sparked an eureka moment for me, in which I now understand lists much greater, GH is a lot easier now. wow.

RSS

About

Translate

Search

Photos

  • Add Photos
  • View All

© 2019   Created by Scott Davidson.   Powered by

Badges  |  Report an Issue  |  Terms of Service