CNC Software Toolchain for Linux

Hi! Some time ago I made a post about My Home Lab where I showed a small CNC that I built. In the same post I said that someday I would post some details on the software toolchain and that’s exactly what I’m going to do in this post.
The process of using a CNC to make 3D parts follows three simple steps:
1. Design the parts.
To design the parts I use HeeksCAD. HeeksCAD is a free, open source, CAD application written by Dan Heeks.
Heekscad screenshot
I found it some time ago and I think that there isn’t any free, open source software that can be compared to it. It is really, really great and allows you to design the parts. You can:
  • Import solid models from STEP and IGES files;
  • Draw construction geometry and lines and arcs, create new primitive solids, or make solids by extruding a sketch or by making a lofted solid between sketches;
  • Modify solids using blending, or boolean operations.
  • Save IGES, STEP and STL.
  • Printer plot the 2D geometry or to HPGL.
  • Import and export dxf files;
  • Drawing lines, arcs, ellipses, splines and polylines is supported.
  • Constraint based designs are also supported!
Learning how to use it is really simple and intuitive. There are some video tutorials in youtube that will teach you how to use all the features of HeeksCAD. Check the video below to see it in action. A few more video tutorials are available on youtube.
Update (18/03/12): Recently I found out about FreeCAD which became my #1 choice in CAD software. It is very rich in features and the possibility of making constraints-oriented drawing makes it very easy and fast to work with. After drawing in FreeCAD you can export it as .dxf but to import it in HeeksCAD you first need to open the .dxf in QCad and then save it again with the same format. For some reason HeeksCAD cannot open the .dxf files exported by FreeCAD. You can also export the 3D models in a .step file and then directly import them in HeeksCAD. Quick, fast and works great!
Freecad screenshot
The other two 3D CAD that I have ever used are Google Sketchup (free) and Alibre Design (commercial) but none of them can be used in linux. Google Sketchup was really easy to use, but missed some very useful features like the support for constraint based design. On the other hand, Alibre Design is a really good, professional, easy to use software but you have to buy it. However, I consider that HeeksCAD is a lot closer to Alibre Design than to Google Sketchup. There is also a 3d modelling software that can be used in linux, which is OpenSCAD. OpenSCAD is not an interactive modeller. Instead it is something like a 3D-compiler that reads in a script file that describes the object and renders the 3D model from this script file. It gives you full control over the modelling process and enables you to easily change any step in the modelling process or make designs that are defined by configurable parameters. However, since I was used to Alibre Design, FreeCAD became my #1 CAD (HeeksCAD being #2) software on linux. HeeksCAD also has a very good feature that, as far as I know, none of the other softwares that I referred has and will be described in the next step.

2. Generate the G-Code from the designed parts.

To generate the G-Code from the designed parts I use the HeeksCAD plugin, HeeksCNC. HeeksCNC allows you to choose between several types of cutting operations such as pocketing or profile operations, among others. You can set the tolerances, the steps, the tools to be used, etc. The first image on this post shows the toolpaths in green. You can see another tutorial showing how to use the HeeksCNC plugin below:
Regarding the milling of PCBs I use the pcb2gcode application. You just have to place a “millproject” file inside the folder where you have the gerber files of your PCBs and run the application in the console. My “millproject” file contains the following data:
# this is an example config file for pcb2gcode.
# place this in the same directory as your gerber files to save typing# You may want to uncomment and change those in local project files
#verbose# parameters for isolation routing / engraving / etching

# parameters for cutting out boards

# drilling parameters

# generate voronoi regions
The first “millproject” file that I found and used as an example ever since was the one found in the RepRap Wiki. There’s also some good info there. Check it out! 🙂
With pcb2gode you can generate a PCB with Voronoi regions. Voro.. what? I’ll explain 🙂 A PCB with Voronoi regions is a PCB where the isolation routing is optimized for the shortest path to be made by the CNC machine. Below you can see the difference between a normal PCB and a PCB with Voronoi regions:
 image of the original pcb
image of pcb with voronoi regions
3. Send the G-Code commands to the machine.
To perform this final step I use the Linux EMC2. You can install it in your computer or you can run it as a live CD. I think it is a very good and simple to use software for controlling machines. Yes, I’m saying machines because you can can control various types of machines with it. It has a wizard makes it very easy to create a profile for your own custom CNC Machine where you can customize the connections and the speeds and frequencies of the signals to be applied to the motors. It also features two manual control modes: the jog mode, and the console mode. In the jog mode you can control the machine using your mouse or your keyboard. In the console mode you can send it G-Code commands.
LinuxCNC screenshot
And with these three steps I think you are ready to make anything with your CNC using only free, open source software 😉 I hope you liked it and if you have any questions or suggestions of other software that I do not mention in this post, feel free to leave them in the comments section below! See you next time!

Did you find this post helpful? Do you wish to contribute to other projects regarding computer science, electronics, robotics or mechatronics that will be posted in this blog? If you wish to do so, you can donate via paypal using the button below. Thanks! 🙂