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 (36.2 KB)

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