Grasshopper

algorithmic modeling for Rhino

hey guys,

 

i've run into a very basic but quite difficult data management issue.

 

say i have a list of curves (flattened), and i'd like to break it into three sub-lists by percentage - A% B% C%. A+B+C needs to be equal to 100% and on sliders for ease of flexing. besides, these sub-lists should be unique meaning that they do not contain duplicated items. (ideally, i'd like an option to have the percentage breakup to be random as well, so it's not say the first 30 lines, then middle 40 lines, and last 30 lines of 100 lines.)

 

how can i achieve this?

 

thanks so much in advance!

 

 

Views: 4454

Replies to This Discussion

A simple way (not sure if it's the right or the most efficient way) could be to simply just run the list of curves through a Jitter component to make the list order random...

Then use the split list to make it into first two list and then split one of them again.

If you want to do it with percentages then calculate like this:
30% of number of curves:
0,30*NUMBER OF CURVES...

 

It's a basic way that should work (not tested though)

Thanks Esben. This certainly works but not without a flaw.

I'll have to keep introducing levels of split to the already split list, which makes the percentage flexing more complicated. Say I split the original list 40% and 60% and then the latter again by 20% and 80% The three percentages I get would be:

40%

12%

48%

You can't really directly manipulate the resulting percentages, can you? And it'll be more problematic if I want more than 3 percentages?

 

Thank you though! I'm using your method for the time being!

Yes that is exactly the problem with the easy method... It is a workaround...

 

I guess the right way to do it is to work with VB... I am not to skilled in VB yet, but maybe someone can write you something.

This can help having the three (or four...) inputs always sum up to 1, or 100 if multiplied by 100.

Hope this helps at least a little,

- Giulio
_______________
giulio@mcneel.com
McNeel Europe

Yes, Giulio. This definitely helps! Thanks a lot!

Thank u guys

RSS

About

Translate

Search

Videos

  • Add Videos
  • View All

© 2024   Created by Scott Davidson.   Powered by

Badges  |  Report an Issue  |  Terms of Service