Grasshopper

algorithmic modeling for Rhino

# Help Please! Sorting Lists into subsets for manipulation

I am new to GH

I have a random set of circles in my list.

I want to sort the list (of circles) into branches so circles of the same size are ordered into their own list.

So I can then perform further operations by selecting the branches individually.

Any help is appreciated

Thanks

Views: 1034

Attachments:

### Replies to This Discussion

What about if the circles weren't random and just worked on a jitter to give me different outcomes?
Or
If they are random, can we weight them so they are a ratio of maybe 4:3:2:1 (1being the largest hole size)

The problem I am seeing from what I hope to achieve is that there are too many holes. It seems the script continues until I can't fit in any more circles. Can we limit the overal number as a percentage or a maximum number of circles that can be generated = say 50 or 100. Can that be dynamically controlled?

I'd sort of like to keep the circle generating part separate from the circle culling part. Here's one possible approach that uses weighted randomness:

Each potential circle is associated with a number that tells you how likely it is to get picked. So if you want more big circles then you give those a weight close to 1 and small circles a weight close to zero. This allows you to play around distributions without using hard constraints.

Another approach would be to not pick circles randomly, but pick them in order. Then, if you supply all big circles first they will get handled first.

To get this second approach working, replace the line

int idx = _random.Next(0, _potential.Count);

with

int idx = 0;

Ok thanks

Can you suggest any way of limiting the number of circles generated?

Generate fewer circles to begin with?

Random Reduce the output if you feel there's too many of them?

Yes how can I do that please?

Use the [Random Reduce] component to remove a bunch of objects randomly from a collection.

by June Lee

by June Lee

by June Lee

by June Lee