Sort circles by radius size

I do need to sort my circles by radius. I do found a solution to sort them by radius by I can’t find a way to separate them and group by radius. I tried Dispatch and some branch manipulation but I don’t understand what else I need to do from here to get the actual circles grouped by radius.

SortingCircles_by_RadiusSize.3dm (168.8 KB) (14.7 KB)

with your definition you end up with a data Tree that has 3 branches

in branch {0,0} you have circles diameter 1.5 mm
in branch {0,1} you have circles diameter 2.5 mm
in branch {0,2} you have circles diameter 5.0 mm

if you want to break them up into 3 separate lists you can use for instance ExplodeTree

To retrieve just a particular branch from the data tree you can use the TreeBranch component

1 Like

Thank you very much. It is working. Anyway, as I see the Explode Tree complained that there are more branches than this component has output parameters. Creating more outputs solved the problem. It is there a way to automatically create as many outputs as existing data branches?

You have already sort+seperate+group them here in 3 groups.

By exploding them you can view them seperately, but explode component are more used to debug and check data.If you have 10000 circles with 100 different radius, you don’t really want to show 100 outputs here, because it is meaningless.But if you want to show them, right click on the explode component and you will see match outputs.

Actually I do need to sort them by diameter and depth and put them in separate layers that have a notation like Depth_Diameter, because for every diameter I need to use the according drill diameter to make the hole up to the dept required by each mechanisation. So, load of fun for me.

When you have more experience on GH, you will see one don’t have to explode data tree to get his target data, you can just have it in a data structure.

Here is an example.
You have a dictionary, and you don’t have to tear them apart page by page and tile them all on the ground to check for words every time.
Just hold the dictionary and you can easily find target page by context

If you want to apply 3,4,5mm depth to 1.5 2 2.5mm radius circle.
just do it along with data structure.

That way was easier for me to visualize the circles. Because before I had a solution that didn’t worked very well, grouping the 5mm radius circles with the 2.5mm ones.

The actual depth I do calculate from the 3D object by measuring the distance between the top of the surface and the bottom of the hole. Now the holes have different diameters and depths and I need to sort and group them accordingly. After that I need to bake them into layers because the CAM software of my CNC machine this is how he can interpret a DXF file.

I suggest stop using some lazy plugin like vipers when you are new to GH.
This will make sure you understand basic GH data structure rule and manipulation really late in the game.

1 Like

I know, but in production environment I need to find the solutions as fast as possible. I used Vipers components because that was the fastest way to convert curves to circles. This definition initially gave me errors making wrong groups because in my file I do have two different kind of construction circles, so I rebuilt them initially.

Yes, I can understand it.
Anyway, once you have some spare time to actually learn this. I suggest remove these plugins and have a nice and steady process on learning it.
If and only if you really want to master it, instead of dealing with work assignment.

1 Like

I spent all my Sunday learning, but it is a lot. I learned some GH some years ago, but from then until now did’t needed too much.

Some plugins are nice and not really “lazy”:
Human/Elefront etc.

GH is difficult, and one sunday is not enough clearly. Even you have got some basic years ago, GH has updated a lot for years.
I think the more difficult thing is how to balance urgent work assignment and your personal knowledge structure.
If you have plenty of time and no one(teacher/boss) is asking you to do anything too difficult and in a rush, you will have a stable and solid knowledge structure like pyramid.
But if not, your pyramid will be hollow and like cheese, not cool.

So I guess the most difficult thing is to balance ideal and reality.
Good luck again. :stuck_out_tongue_closed_eyes:

1 Like

In my case I do need to do the oposite. To calculate the existing hole depths (this 2D contours are extracted from a 3D object) and after I apply the first sort by diameter, I do need to sort again by depth of the holes. Same diameter can have multiple hole depths. After that I do need to create some logic and to bake the result in layers that contains the depth and the hole diameter. Names something like Holes_<Depth>_<Diameter>. So, if I have a dozen different diameters/depths I do need to create dinamically all that layers. And this is only the circles. I found extremely difficult to find a solution to extract just the ouside contour of the parts. It was a lot of fun finding something that really works in any situation. After that I do need to find a way to extend the edges of the pockets that are touching the exterior contour outside of the shape, so I can have clear cuts without rounded corners in that spots. A lot of fun, if you ask-me.

would it be ok for you to post a Rhino file with a few sample 3D objects from which you usually manually retrieve all that data?

I think this task could be easily automated, but it’s difficult to hit the target without a real 3D file like the ones you usually work with :+1:

1 Like

Just a repost from the other thread that I opened here: Sort list of geometries by name - Grasshopper - McNeel Forum


Basically I want to achieve what Alphacam it is doing with their “feature extraction”. And it is also achievable in Grasshopper with some thinkering.

don’t take this as a solution because it’s -maybe- just a starting point to filter all the holes and sort of “catalogue” them by diameter and depth

-this is just a dirty prototype, things could be much easier if more thought is devoted :slight_smile: -

the on-screen visualization of the data ( D x.x - H xx ) is just there to show that the algorithm actually recognizes a given hole with its right diameter and its right depth (double checked a few of them, looks right)

what you see on the last panel is the best part of having a data-tree, things like:
0. D3.0 H18.0
0. D3.0 H18.0
0. D3.0 H18.0


A = index of Brep the hole is on
B = unique hole number on that brep
data = D, hole diameter and H, hole depth

if you want to bake circles per diameter per depth (using for instance Elefront) the fastest way is to just bake everything in a layer named as their data:

it won’t exactly serve your purpose “as it is”, I believe you want to apply this to breps that you have already sort of nested on the XY plane: at the moment it finds both circles that define top and bottom of any hole

if I have understood correctly, you will want to filter that data in such a way the only circle that gets baked is the one that sits on top

the definition requires Elefront for bake, define layer, define attributes, and also for the Clean Parallel component (1007.4 KB)

1 Like

Thank you very much for your help. Actually this operation I need to perform after nesting the 3D parts into sheets. I am using OpenNest.

Using this definition I can quickly have a nested unit into sheets. The 2D contours and feature extraction comes after.

nested_parts.3dm (5.7 MB)

From this model, I do need to create the holes and contours and create the layers for DXF export.

The overall shape will go into the “contour” layer, the other mechanizations into their respective layers. The holes will be sorted like “Hole_10_5”, after that the inside cutouts will go into “Pocket_10.5_E7” where E7 it is the number of the tool that I will use to cut the pockets.

All this information, grouped in 2D layers I do import in Mastercam who have a DXF processor, basically it reads all the shapes and based on the names of the layers, assigns automatically respective mechanizations that I do created the technologies for.