Program-Independent > Mechanical
CAM with FreeCAD
Contributors:
Larry Hiller, Hamid Hussain, Nate Gorton
Larry Hiller, Hamid Hussain, Nate Gorton
For many years, our team used Autodesk Inventor's CAM plugin to make toolpaths for our CNC Router. This software was expensive, and we had only one license that we had to pay for each year. To solve this issue, we switched to FreeCAD, an open-source cross-platform software that had quite a few basic CAM features. This new software makes it easy for any member of the team to install and CAM parts for routing.
This article will help with operating the CNC Router, which you can learn more about here. You can also watch a video walkthrough of the process shown in this article.
FreeCAD can be installed on Windows, MacOS, and Linux through their website. A download link has been provided here for the graphical installer.
For those on Linux, you can also install FreeCAD through your distro's app store (KDE Plasma Discover, pamac, GNOME App Center, etc.)
Windows: winget install FreeCAD
MacOS (with brew): brew install --cask freecad
Debian/Ubuntu: sudo apt-get install freecad
Fedora: sudo dnf install freecad
Arch Linux: pacman -S freecad
Gentoo: emerge freecad
We've made a custom preset for routing polycarbonate and other sheet material which you can download here.
This is a 3rd-Party tool for FreeCAD that makes selecting many similar holes easy. This will be demonstrated later in the article, but is only recommended, not strictly necessary.
Click the button to be taken to the SmartSelect GitHub page, then click on the file "SmartSelect.FCMacro" and hit the download button as shown in the picture. Then go back and do the same for "SmartSelectUI.ui".
The Macros folder of FreeCAD is located somewhere on your computer. This folder is where your bits, preset and SmartSelect files will go, but first we need to find it. To do this, find your toolbar (usually at the top of the screen) and click Macro, then Macros.
This will open a menu. At the bottom of this new window, there is a text box labelled User Macros Location. This is your macros folder. For the rest of this section, it will be referred to as your FCMACRO folder.
You should open this folder in your computer's file manager (ex. Windows Explorer, Finder, Files, Dolphin) and keep it open.
Defaults:
Windows: C:/Users/(your user)/AppData/Roaming/FreeCAD/MacroMacOS: /Users/(your user)/Library/Application Support/FreeCAD/MacroLinux (Flatpak): /home/(your user)/.var/app/org.freecadweb.FreeCAD/data/FreeCAD/MacroLinux: /home/(your user)/.FreeCAD/MacrosNow, you can install your CAM Preset and the SmartSelect macro by moving the "job_polycarb.json", "SmartSelect.FCMacro", and "SmartSelectUI.ui" files into the FCMACRO folder that you just found. After doing that, your FCMACRO folder should look something like this.
Finally, we will enable the SmartSelect macro and make it appear on the FreeCAD toolbar. To do this, open the Macros menu once again by going to Macro > Macros on the top toolbar.
Once this is open, you should now see SmartSelect in the list of User Macros. This means that you moved it into the correct folder and FreeCAD is able to see it. If you don't see SmartSelect, make sure you put both the FCMacro and UI files for it into the FCMACRO folder. If you do, click it once to select it and then click the Toolbar button on the right of the window.
If FreeCAD asks you if you want to do a walkthrough of the toolbar menu, select "Do not show again". If you get a popup after that, just click the "Add" button.
The Toolbar window will have two sections. On the left you should see SmartSelect. On the right, click the dropdown and select either the global or Path workspace, depending on if you want SmartSelect to appear all the time or only in the CAM workspace.
Once you select a toolbar, click the New button on the right side and create a toolbar called SmartSelect.
To add the SmartSelect Macro to your new toolbar, select SmartSelect on the left side and then click the arrow pointing right. You should see SmartSelect appear inside the toolbar on the right.
Finally, restart FreeCAD, click on Create New and enter the Path workspace again. You should now see a button labelled SmartSelect on the right side of the toolbar.
You have now installed the preset, bits, and SmartSelect macro. You will use all of these in the next sections.
To begin CAMing with FreeCAD, you must first export your part. To do this select your part and right click to bring up the menu, towards the middle of the menu you will find and click the "Export" button. Export as a STEP file format.
If you do not have a part to export, download the example part below and skip ahead to the "Importing to FreeCAD" section
Next rename your file, typically it is best to add the name of the robot it is for, (or team), name of the part, and the year. Make sure to export the file as a STEP file, all other settings may remain as the same. After this you can hit export at the bottom of the page, the file will be put in your downloads folder.
Open up FreeCAD and click "Create New". This will open a new document. From here you have to import your part. You can do this by hitting Ctrl + O or by bringing up the "File" drop down in the top left and clicking "Import". Then find your step file in your downloads folder.
After importing check if it is laying flat in 3d space. Do this return to the default view by hitting "0". If your part is not laying flat you need to rotate it. To do this right click on the part in the left side bar and click "Transform", set the Rotation Increment to 90 degrees using the menu on the left, then rotate the part using the axes that appear on it. Make sure it is laying flat, this will make the later steps much easier.
Once you have done this you are ready to start CAMing!
All Camming takes place within "Jobs" to start one make sure your tool bar is set to "Path" instead of the default "Start". The tool bar selector is found in the top left of the screen, highlighted in red below.
Next open a job, by clicking the button above highlighted in blue. Make sure your part is selected, along with the "polycarb" template (which was the json you downloaded earlier).
Next you need to set the origin, to do this click the point on the bounding box shown in the image, right, and down, then click "Set Origin". This point is shown to the right with the standard "0" view. You can imagine the bounding box as an outline of the polycarb you are cutting the piece out of. The origin is the place on the polycarbonate sheet where the tip of the bit will start.
Before you add cut operations to the job, you have to make sure you're seeing the correct piece, as the one you want is currently hidden. To fix this, find your part in the side left bar and hit the space bar, then below that open the "Model" folder and hit space on "Model-Part X" and "Stock". When you're done it should look like this.
To drill holes in in your part you must first select all the holes in your part, do this quickly use the "SmartSelect" tool, which should be in your tool bar. Using the cube in the upper right corner, or by pressing 5 on your keyboard, set your view to the BOTTOM view, then select one of your holes. Use smart select to find all instances of "Same Object", "Same Length/Area" and "Same Z". These can be selected on the left side of the screen.
After you have done this, hit OK. The immediately open a drilling operation by clicking the button in the image highlighted in red. Select the bit for the size of hole you are drilling. Then open the base geometry page and hit "Add". As a precaution go back to the operation page and make sure you have the correct bit selected, then hit "Apply" followed by "OK".
Some holes (most commonly bearing holes) are larger than a quarter inch in diameter, these holes have to be cut using profile operations. Profile operation take the drill bit and tell it to follow an edge in the part. To start a profile, click the button shown below, it can be found on the tool bar.
Next, add select the interior edges you want to cut and add them in the base geometry page, use SmartSelect if there are many of the same size. Since these are interior edges, go to the operations page and make sure that the cut side is set to "Inside", this is so the holes are drilled to the correct size, you can confirm this by hitting "Apply" and seeing the the tool path is on the inside of the edge. Also confirm your bit is set correctly, which ever one makes sense.
Once you're ready, click "Apply" then "OK" to confirm.
Interior and Exterior Edges have to be done in separate Profile Operations as the cutting side is different. Start a new Profile and click any outside edge of your part, then click the "Finish Loop" button, highlighted in red. This will select all other lines on the outer edge, but it is a good idea to check if it has selected them all successfully. Then add these to the base geometry page. Go back to the operations page and make sure your cut side is set to "Outside", confirm this by hitting "Apply" and checking the tool path, once your done hit "OK".
Now that you have all your operations (you may need more than the 3 shown here) you are ready to export.
First make sure your operations are in a suitable order. The order shown in your operations folder is the order they will be routed. So make sure your drilling and interior profile operations come before your outer profile. THE OUTER PROFILE IS ALWAYS LAST! This is so that the piece does not shift on the router table during cutting. It is a good idea to simulate what the router will do by using the simulation tool. Highlighted in red.
To export, click your job in the side bar and then find the "Post Process" button on your tool bar. Click it and save to your computer, if you have the router's flash drive, feel free to save directly to that.
After saving a pop up will appear with the Gcode you have just created. Expand this pop up and remove the first "M6 T1" line, make sure to not leave a space between the first and new second line.
You just successfully CAM and exported you first part for the CNC router, if you have further questions consult a mentor or upper classmen. There is also a visual companion for this process if you would like. For instructions on how to use the router, go to the CNC router page.