It's pretty easy to use Inkscape and OpenSCAD to turn an STL file into a gcode file for a cnc machine. In this first part I'm going to set up a template in Inkscape so gcode tools is ready to go so you don't have to configure it every time.
Gcode tools is an extension for Inkscape that takes a path and outputs a gcode file for a cnc, it can be a bit confusing to use at first but in a few minutes I will show you a simple way to set it up, I won't go into details of installing it because it should already be added to the default extensions in Inkscape.
First off open a blank page in Inkscape and goto the document properties dialog to set up a page that is the size of your cnc machine:
![](https://infinityplays.com/content/images/2024/06/106-1.png)
After you have the page set to the cutting size of your cnc machine then you need to set up gcode tools with the default settings you want it to use, starting with the orientation points:
Go to Extensions>Gcodetools>Orientation Points
![](https://infinityplays.com/content/images/2024/06/106-2.png)
![](https://infinityplays.com/content/images/2024/06/106-3.png)
After changing the setting click apply and the orientation points will be shown on the page, these are text objects, select them and make sure they are set at 0,0:
![](https://infinityplays.com/content/images/2024/06/106-4.png)
Next you need to set the default tool, Go to Extensions>Gcodetools>Tools Library:
![](https://infinityplays.com/content/images/2024/06/106-5.png)
I set mine to the default tool, you can make separate svg files for each tool type following the same process if you want:
![](https://infinityplays.com/content/images/2024/06/106-6.png)
A new box will appear that is green, I set it to the side of my cut area so I can make changes easily later on, just select one of the options and edit it for your cnc, I made a drill diameter of 1mm just for testing:
![](https://infinityplays.com/content/images/2024/06/106-7.png)
Now you can save this file in a working folder and every time you open it up Gcode tools is ready to go, you can just make or import a design to cut out:
![](https://infinityplays.com/content/images/2024/06/106-8.png)
Make sure to convert your object and stroke to a path:
![](https://infinityplays.com/content/images/2024/06/106-9.png)
To save the gcode file make sure the object you want to cut is selected and go to Extensions>Gcodetools>Path to Gcode
![](https://infinityplays.com/content/images/2024/06/106-10.png)
Set the desired path, units and file name in the preferences tab, then open the path to gcode tab and click apply.
![](https://infinityplays.com/content/images/2024/06/106-11.png)
![](https://infinityplays.com/content/images/2024/06/106-12.png)
A message will pop up and this normal, once you learn more about gcode tools you will not have error messages because it will be properly configured for your cnc and the file you want to cut.
![](https://infinityplays.com/content/images/2024/06/106-13.png)
Now the gcode file will be in the folder you saved it to and you can open it up with a gcode viewer, I use Camotics and Bcnc:
![](https://camotics.org/images/banner.png)
![](https://infinityplays.com/content/images/2024/06/106-18-1.png)
![](https://infinityplays.com/content/images/2024/06/106-14.png)
If you have an STL file you want to cut out just import it into OpenSCAD and use projection() to convert it to an svg file:
![](https://infinityplays.com/content/images/2024/06/106-15.png)
Then you can import the svg file into your Inkscape template and use Gcode tools to output gcode for it:
![](https://infinityplays.com/content/images/2024/06/106-17-2.png)
![](https://infinityplays.com/content/images/2024/06/106-16-1.png)
Gcode tools is an excellent feature in Inkscape and there are a lot more things I will be going over in future posts, stay tuned.