How to creating CNC paths by script

Hello everybody,

I’m looking for a script to create CNC paths.
as a start, a line on the solid should be duplicated and extended by an original factor. Another line on the solid should serve as the second input. This second line is also to be extended by an original factor.
Now two perpendicular connecting lines to the second line have to be created and the second line has to be trimmed.
Main geometry layer: 5-axis
Layer of the connecting lines: 5-axis across

First Step:
Second Step:
Third Step:

Thanks for your help

Hi Gerbert,

Are you looking for python script, VB script, grasshopper script for this kind of process.

Have you also looked at some of the other topics on cnc as there are already examples out there.
Have you also attempted to do what you are trying to do via script, or are you hoping for someone to give you a solution?

Why dont you code it yourself? It is not so difficult, you just need to invest time.

If you do not want to, then there are number of plugins that will do it for you on food4rhino.
Also it depends on 5 axis machine you have i.e. the A and B rotations of motor, that will be different from machine to machine.

hello and thanks for your feedback.
My knowledge of Rhino Script or Phyton is not so extensive that I can work out a possible solution myself. My hope is that I can find and use something available in this forum.
I only need the described paths in CAD and implement them appropriately in CAM as processing.

Hello and thank you for your feedback.
I’m looking for a solution in Rhino Script or Phyton.
unfortunately I have not found anything suitable in the forum. My level of knowledge is not sufficient to solve the problem and I hope for the help of the “script pro´s”

I developed a CNC tool-path grasshopper plugin for IBOIS, EPFL, and we already tested that for several projects, I can upload the code on Github.

But again, every CNC machine has its own post-processor, ours works on G-Code and we have two methods for converting plane Z axis to A and B rotations of CNC.

Also, have you tried RhinoCam or MadCam, they are good software, and as a starting point I would recommend to test that.


Hello Petras,

Thanks for your answer.
wow, a very interesting project.
to the question about the CNC machine and the G code generation:
I only used Rhino as CAD software and would like to create the required geometries here, I use Alpha-CAM to create the program.
In Alpha-CAM only the lines are automatically occupied and the CNC program is generated with the appropriate post.
Here I need the lines for 5-axis milling. At the moment I have to draw them by hand, but automation would be an advantage.

Hello Gebert C,
RhinoCAM may able to produce a similar toolpath without having to create additional curves in Rhino as you can select surface/face edges from your solid/surface geometry as drive curves to generate toolpaths.
Feel free to download RhinoCAM demo to test your file: . If you have questions, please feel free to contact us at