Grasshopper

algorithmic modeling for Rhino

Hello,

I need to divide a single list into several sublists which correspond to the number of divisions in my mesh, so that these points can be used as anchor points in a kangaroo simulation. (So i can then rotate each of the mesh plane anchor points about the centre of the individual planes)

I have run into this kind of sorting problem before but unfortunately don't know how to manipulate lists in this way.

Does anyone know how can I divide a list into several sub lists according to a multiple (multiple controlled by a slider controlling the U division of the mesh)

Thanks,

Chris

 


Views: 9553

Replies to This Discussion

Using key components: Param Viewer, Integer Divide and Replace Branches you can group a list into separate branches.

Fantastic thanks Danny. It is the replace branches component that I was unfamiliar with- I need to start using it! :-)

Hi Danny, hi Chris, I made a UserObject some time ago which does the same, though it's not as nice and compact as yours Danny. Still I tested them for speed (both made into Userobjects of coarse), and it seems to me that my longer definition uses less heavy components and manages to scrape of milliseconds. Since this outcome really surprised me, I thought I'd share my component anyway, even after Danny's great solution. Maybe you get different results there than I got?...
Again: very neat indeed Danny!

Attachments:

Wow thanks Peter this is really cool! it should be made into a full component. Thank you very much for posting its really helpful.

Glad you like it :)

I know that it is old post but i just would like to thank you for SSLN.

I think it should be incuded in grasshoper.

There is a component in GH now called Partition List.

That's very kind of you Karol, thank you. As Danny pointed out there's this Partition List component since quite a while. I kept my UO because it is slightly different, and I needed that for something, though I can't recall what it was. Anyway, thanks for your responce.

Hi Pieter,

 

My method used to be even slower. Its all to do with the overheads in drawing the Param Viewer. David made some overhauls of the Param Viewer and the Panel Components in version 0.8.0008 to make them faster. But the fastest approach would be to create a C#.Script component that read in a data stream and output its path structure, therefore getting rid of the need to populate the param viewer with any information.

 

EDIT: @David, maybe the thing to do is to have an option show tree/paths for the Param Viewer.

 

Hi Danny thanks for your answer. I'm not able to write C#, Python or VB, but I try to optimise things as much as I can in GH. I found it remarkable that my definition with far more components than yours managed to be faster. Otherwise I wouldn't have uploaded my UO in the first place, since your solution very logical and it is really compact on the canvas too, which I like very much.
Do you have any idea why the profiler results change each time GH recomputes the solution? I'm not changing anything in the definition or its input... Would be nice to have the profiler work cumulative on a group, don't you think?
Thanks again.

Hi Danny,

THank you so much for posting this. However, I couldn't figure out how to keep the same number of items on each branch after I created sub-branches. I have 135 branches and I wanted to change the data to 9 branches and each with 15 items. For some reason, my first branch only has 8 items. Please see the attached images. Thank you so much in advance for your help.

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