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: 1052

Attachments:

Replies to This Discussion

Hi.

Is this what you are after?

Attachments:

Looks good, How can I then select those circles as a branch? For example,

I want to divide all the Radius 3 circles into 8 parts, all radius 9 into 6 parts etc.

Many Thanks for your help

Get this as well.

Attachments:

Thank you so much this is perfect. I wondered if you could have a look at this problem for me....

I have sizes set for the radius of the circles.... Do you know any way I can set the maximum number of each size circle, rather than it being random.

The problem being the larger sized circles are culling a lot of the circles... Big thanks!

Attachments:

Also try (with a very small dose of the Dark Side)

Attachments:

Hi Pete,

Thanks. Your clearly awesome at this stuff. Can you see if you can help with this file attached?

I have sizes set for the radius of the circles.... Do you know any way I can set the maximum number of each size circle, rather than it being random.

The problem being the larger sized circles are culling a lot of the circles... Big Thanks!

Attachments:

Er ... can you describe (like taking to a robot) what are you after?

For instance: (a) I have a grid, (b) I want to put some circles at grid pts with the following rules/conditions/restrictions/exceptions/whatever: blah, blah ...

Hi Pete,

1) I have a grid (space 3, y=30, x=70)

2) I want to put some circles randomly on the grid points,

3) where the radius size of the circles are defined as:  1.5, 3, 6, 9

4) A Maximum number of circles that can be populated (for each radius size) is set as an integer (or slider)

(ie. radius 1.5 = 10 , radius 3= 6, radius 6 = 6, radius 9=4)

Conditions are:

1) Each of the circle has a radius of influence,

Radius of influence = double the radius of the circle)

(3, 6, 12, 18)

2) Any overlapping circles in either: Radius of influence or the Circles are removed so that

No circles overlap.

3) There must also be 4 circles set at the corner points of the grid - These must be circles with a radius of 3 or 6

If you can do that I will be amazed as i've been trying for weeks! :(

Ive attached a sketch of what im looking for

Attachments:

I wrote a C# script which implements the following algorithm:

  1. Declare and populate list of fixed holes (these will not be messed with).
  2. Declare and populate a list of potential holes.
  3. Make sure none of the initial potential holes intersect with an initial fixed one.
  4. Pick a potential hole at random.
  5. Remove it from the potential list.
  6. Insert it into the fixed list.
  7. Remove all potential holes that intersect with this moved hole.
  8. Repeat 4 - 7 until there are no potential holes left.

This script assumes all circles are co-planar and that they are all parallel to the WorldXY plane. Also it's brute force so probably doesn't scale well to thousands of holes.

Attachments:

As a side-note, you'll need to use your 'influence' circles only, and replace them afterwards with the actual drilling circles. But that should be fairly straightforward with regular GH components.

Awesome David,

That's amazing!

Is there any way to limit the number of each sized hole? Could this be done with sliders for example?

Limit as in the final result? That'll be quite tricky, though I can definitely weigh the random selection process to favour certain holes. There's no way to guarantee both non-intersection and a certain minimum amount of circles, those may well be conflicting constraints.

At the moment the script is utterly unaware that there may be any meaning or distribution to the radii, they're all just treated as numbers. But something can be added to take that into account.

How exactly would you like to control this?

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