Grasshopper

algorithmic modeling for Rhino

I have 42 randomized points (2D populate) I would like to learn how to randomly split the list into 3 three sub lists but also control the quantity of the sub lists. In other words, I would like to randomly select a list of 16 points, a list of 22 points and a list of 4 points which would then represent the three separate sized squares. Can anyone help? Much appreciated for your time.

Views: 7743

Replies to This Discussion

You can use "Partition List".

Attachments:

Thank you Hyungsoo Kim - this was exactly what i was trying to achieve. David Rutten also provided some other great approaches. Thank you once again to you both

The order of points generated by Populate2D is already fairly random. You still want to randomize it again?

You can use [Partition List] to break up your list into 3 unequal parts (just make sure that the sum of the three parts equals the length of the original list). This will generate a tree of lists. If you want these lists to actually have separate outputs, you can either [Explode] the tree, or you need to use other kinds of components.

For example you could use [Split List] twice, once to split the lists into parts A&B vs. C, and then another Split List component to split the still combined A&B into separate A and B lists.

Or perhaps use three individual [Sub List] components, all with different domains that represent your desired list lengths. So using your numbers, the first splitting domain would be from 0 to 21 (for a total of 22 points), your second splitting domain would go from 22 to 25 (giving you the next 4 items) and the third domain would go from 26 to 41 (giving you the last 16 values).

Attachments:

Thank you for your time David. The solutions from Hyungsoo Kim and yourself provided everything I needed to know. The partition list was my problem area, I wasn't aware I could use a list as an input to separate the original list into unequal quantities. thanks again.

It would be nice to see if its possible to set up a "bumper" zone around each square so they don't overlap or better yet if we could set a limit where the squares come within for example 4 inches of each other but no closer and it still keeps the randomness. 

Thank you, David. It is the perfect solution. 

soundcloud downloader

Is it possible to identify a minimum distance between each square similar to circle packing?

thank you

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