3D part design with Inkscape and OpenSCAD # 98: STL to CNC part 1.

4 min read
By Bob
3D part design with Inkscape and OpenSCAD # 98:  STL to CNC part 1.

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.

GitHub - cnc-club/gcodetools: CAM extension for Inkscape to export paths to Gcode
CAM extension for Inkscape to export paths to Gcode - GitHub - cnc-club/gcodetools: CAM extension for Inkscape to export paths to Gcode

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:

Open Image in a new tab for a larger size

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

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:

Next you need to set the default tool, Go to Extensions>Gcodetools>Tools Library:

I set mine to the default tool, you can make separate svg files for each tool type following the same process if you want:

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:

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:

Make sure to convert your object and stroke to a path:

To save the gcode file make sure the object you want to cut is selected and go to Extensions>Gcodetools>Path to Gcode

Set the desired path, units  and file name  in the preferences tab, then open the path to gcode tab and click apply.

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.

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:

CAMotics
CAMotics is an Open-Source GCode simulator which simulates 3-axis CNC. Fast, flexible and user friendly, CAMotics runs on Linux, macOS and Windows.
GitHub - vlachoudis/bCNC: GRBL CNC command sender, autoleveler and g-code editor
GRBL CNC command sender, autoleveler and g-code editor - vlachoudis/bCNC

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:

Then you can import the svg file into your Inkscape template and use Gcode tools to output gcode for it:

open in new tab for a larger image

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.