From 3D parts to 2D CNC machining curves

Hello guys!
Because of the help from this community I could create this code, and now I want to share it with you!

What does it does?
It creates 2D curves for CNC router machining, from a 3D part. These curves are baked in layers, accordingly to their pocketing depth. It may help some makers around here :slight_smile: It did saved me a lot of time already.

It works for parts within 18mm thickness (I did this way cuz I work with 18mm Plywood boards most of the time). It can recognize any pocketing or holes every each milimiter. The bottom of every part must be placed at XY plane

The code identifies XY oriented surfaces, make 2D drawings of their contours and bake them to the right layers using z coordinate.

And these are some improvements I’d like to make, maybe you guys could help me again?
1- Recognize any depth, instead of every each milimiter, and bake in the respective named layer.
2- Work with any thickness
3- Delete duplicated curves when a hole and a pocketing happens at the same time (image below)
4- Identifiy inside and outside curves, for cut_outside and cut_inside layers
5- Expand the pocketing curves outwards or inwards the boundaries of the part (cut outside or inside layers) (imagem below)
6- Get offset right, for clearance. Sometimes it goes inside, instead of outside.

auto nesting example.3dm (266.0 KB) Auto-Nesting 2.gh (36.2 KB)

I have a solution for this problem, but have you made any progress?

1 Like

Interest to see your solution.

As recently I needed a “feature extraction” like kinda tool, with the help of the comunity, I was able to solve some of your issues presented here:

This can be solved by measuring the distance between the surface of the pocket and the top surface and passing that value as parameter, let’s say “Depth” where you have right now the “Variable x”.

Again, measuring the distance between the topmost and bottom most surfaces you can have the overall thickness of the pieces and you can pass that value as parameter, let’s say “Material_thickness”

This can be fixed with a sorting algorithm that can search for duplicate curves. There are some components that can remove duplicate curves, need to investigate which method works best.

I do found that “Sasquash” components have a wonderfull tool that can separate automatically the inside/outside contours of a surface called “Brep/SurfaceBorder”.

WIP

This can be solved if you are forcing all the curves to have a certain direction. For this purpose I do use the “Sasquash/Curve/FlipCurveClockwise” and I do force all my “outside” curves to rotate CCW and the “inside” curves (for pockets) to rotate CW. I am connecting the “FlipCurveClockwise” right after the output from “SurfaceBorder”.