Sort circles by radius size

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

Geometry_sort_by_name.3dm

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:
{1;0}
0. D3.0 H18.0
{1;1}
0. D3.0 H18.0
{1;2}
0. D3.0 H18.0

{A;B}
data

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
Catalogue_Circles.gh (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.

Just made a quick test and it is working as expected:

The next phase will be to do the same for the pockets. One think that needs to be changed there it is the fact that I do need to move outside with 6mm, the edges that are touching the exterior contour, so I will have clear cuts without rounded corner on that particular spots.

To have a better understanding of what do I need this. In the bellow pictures, into the first one are the geometries that I ordered in layers according with the kind of mechanization that deeds to be applied.

Into the second picture, you can see the result of automatic machinning assignment after importing that DXF file into the machine CAM program, Maestro. Everything that you see there (all mechanisations from the left panel) it is created automatic.

This it is a simple example, just drills and contouring, without pockets required.

Advice:

  1. Provide the correct test geometry before the work is done, not after.

  2. Spend less time describing what you need and more time understanding the code you’ve been given, asking questions about how it works as necessary.

1 Like

Here it is a more complex part, that needs mechanization on both faces, the pockets are touching the exterior contour, so I moved manually the edges in contact with the contour by 6mm outside.


complex.3dm (244.8 KB)