Maslow Home Maslow Community Garden Newsletter

Generating GCODE with Inkscape instead of CAM software

This is a walk-through of how to generate gcode using Inkscape. There is simplicity in being able to design and svg file and generate GCODE in the same package. Freecad, Blender and Inkscape can all apparently do it.

  1. Open Inkscape.
  2. Open svg file or new file. NOTE: If importing from Corel Draw exporting as SVG version 1.0 with units in mm works, but you may need to ungroup the imported item and then assign it to a layer before proceeding. it is important that the object you are manipulating is a path for this to work.
  3. Click Extensions on the menu and see if the gcodetools menu item is included. It should be included in inkscape more recent than version 0.90 or 0.91. This was written using 0.92.4.
If gcodetools is not included in your inkscape installation, you will need to install it (click arrow at left to see instructions

-option A. download gcodetools extension from github here or the direct link for the windows zip file here.

Windows
Unpack and copy all the files to the following directory Program Files\Inkscape\share\extensions\ and restart inkscape.
Execute python create_inx.py to create all inx-files. (will work without doing this)
Linux
Unpack and copy all the files to the following directory /usr/share/inkscape/extensions/ and restart inkscape.
Execute python create_inx.py to create all inx-files.

  1. Set document to mm and size of cutout in mm (12" =~ 300 mm). Please make the display units match the custom size units (match your maslow units) and the scale x is set to 1.

File->document properties

  1. Create your cutout shape
    After some editing, the shape is an outline only with the thickness of the line the same size as the cutting bit so it is easier to see what it will look like in real life.
    For any object if you just want to do an outline cutout, change fill to none, set stroke paint to black and stroke style to 3 mm (3.175 mm if you want to be precise) for 1/8" bit or 6 mm (6.35 mm) for 1/4" bit. This only matters because it helps you see the cuts that will overlap and where to put in tabs later.
    Move the letters together so they overlap, convert object to path, cut path, then ungroup and then union it so it removes the extra lines.
  2. Create a new layer
    -in the right side bar, select layers if you can’t see the current layer in use or use the shortcut shown in the image below.
    -Right click on the layer currently in the drawing and select add new layer

    -rename it “tabs” by using the right click menu. Move the tab layer below the first layer as a matter of convention because it is intuitive that the top layer gets cut first, then the tabs at the bottom get cut last. In the layer viewer on the right, you can select which layer is visible by clicking on the eye. If the eye is black with eyelashes this is viewable, if greyed and looks closed, then it is hidden. Don’t mess with the lock or you won’t be able to edit or select anything in that layer. If you can’t select anything on the layer, you can right click on the layer and select unlock all and then unhide all to see everything.
  3. Copy Artwork to New Layer.
    -Select the top layer
    -Select all (CTRL+A) or draw a box around everything
  • CTRL+C will copy everything that is selected
    -Select the tab layer and paste it. With both layers visible, you should not be able to tell them apart, but you can toggle which one you see hiding or viewing it in the layer viewer. If you paste it in and it isn’t lined up, you can move it and it will snap to the other layer so it will be lined up perfectly.

after pasting, they may not line up, so move it if you need to.

  1. GCODE setup of “CUT” layer:
    A. Create a tool for each layer: select each layer and do this step for each layer. It is sometimes easiest to hide all layers, unhide only the layer to set up, and then proceed. When finished, hide it, unhide the next one and do it again until complete.

Extensions->gcodetools->Tools library


select your cutting bit (cylinder or cone both work depending on the bit you are using) click apply. You will see a dialog box pop up while it works and then you can close the box. A new green box will be visible and associated with the layer you have selected. The second layer you do will have a blue box, the third will be red.
-Within that green box, change the settings for your cut:

-You will need to edit the numbers. Do this by double clicking on them and then when you get the text cursor you can edit them. If your attempts to edit add numbers over the top, then undo and retry. or just click to select the text and then click on the text tool bar on the left or the right side of the page.
-change diameter to 6.35 if you are using a 1/4" bit or 3.175 if you are using a 1/8th inch bit.
-Set your feed rate based on your material in mm/min (between 300 and 800). You can cut at 750, but it may not be good quality and your tool will dull faster if it gets hot. This picture for this example was cut at 550 with a 1/4" bit.
-Penetration angle is always 90 for maslow because the router on the sled is flat on the work surface.
-Penetration feed is 800 for the z insertion for a first gen z axis.
-Depth step is the depth your tool will cut in 1 pass in mm. Maslow should 3 mm step pretty easily. Cutting successfully at 4 mm can be done and even 5 mm, but there is a proportional speed drop that must accompany it to generate fine dust and the bit cool so it doesn’t overheat.
-Leave tool change as none.
B. Set up origin points with the same layer selected
Extensions->gcodetools->orientation points

orientation points tell your maslow where to cut with respect to home. Wherever you place the first orientation point on the left, that will be the home point from which the drawing is referenced in webcontrol or groundcontrol. The second set of numbers represents your workpiece total cut depth that maslow will cut (in x passes of step depth defined in the colored box previously made). With 3/4" ply, the total depth will be 19.1 mm. If you chose a step of 4 mm, Maslow will cut 4 passes at a z plunge depth of -4, -8, -12, -16 from the top layer that is labeled “cut” in this example and the “tab” layer will cut at 19.1 mm. If you want to cut on the left side of home, you would select the orientation point group and move them to the right. The points should always move as a pair and do not try to change them with respect to each other. You can edit the right group of numbers if your material thickness changes if you are reusing this design and regenerating the gcode. To be precise in moving the orientation point group, use the X and Y location boxes up near the help menu to place the orientation points and make it easier to know the distance from maslow home to your cutout.

You can also do more than 2 layers if you want:


The critical thing is to get the orientation points exactly on top of each other so there is no offset one layer to the next. Use the “hide layer” function and click on the orientation points for each layer and manually adjust them in the position boxes at the top of the screen so they are exactly the same.
image
9. Edit the tabs.
-First Hide the cut layer, make the tabs layer visible. Your green box and orientation points should disappear when you hide the cut layer.

  • Select the cutout, then choose the node tool (second one down below the select arrow.
    image
    -NOTE ON TABS: put a tab in on any completely cut out part. such as the center of the O, the piece between the M and E, and the little pieces between the O-H and O-M and of course between the larger cutout and the sheet it is cut from. I don’t have a good feel yet for how large the tabs should be. These ones will be 3 mm thick because the last cut will be from 16-19.1 mm. Simply edit the drawing and cut pieces out of the outline that maslow will skip over. Start with the little one between H and O and and try to make it about 5 mm, so it needs to be 11 mm for a 1/4" bit or 8 mm for a 1/8" bit.

TIP: The center of your cutting tool will go the spot of the node. If you are using a 1/4" bit and have a 5 mm gap, the 6.35 mm bit will overlap 3.175 mm when it stops, then when it moves over, it will overlap another 3.175 mm, so you MUST make your breaks your bit diameter + your desired tab size.

to cut the tabs,
a. zoom in and select the cutout where you want to insert
b. select the two nodes where you want to remove the segment
c. click the break node button above on the toolbar. If the nodes are spaced too far apart, double click to add a new node where you want to make your tab. If you are on a curve you might need to break the path first and then delete the segment. Path break is 2 buttons to the left of the segment delete button




Do this at all places where tabs are desired.
TIP: TABS placement
Tabs in the example are shown below

  1. Add GCODE to “TAB” layer
  • keeping the tab layer visible, add a tool and orientation points as in step 8. It should look like this.

    the Orientation point start depth will be -16 because that is where the last layer cut stopped and where this will begin, so the tabs will be 3 mm thick and 5 mm wide.
    with both layers visible, it will look like this with the orientation points on top of each other
  1. GCODE Header file required for webcontrol
    Make a header file in folder where you will save the gcode (only need to do this once)
    text file name is “header”
    Must have this one line and any others you desire

G90 (absolute)
M3
G90 (absolute positioning)
G21 (All units in mm)

  1. Generate Gcode:
    -First make both layers visible and select everything.

Extensions -> gcodetools ->path to gcode
-click on preferences:


Enter the file name with extension
enter the file path (only need to do this the first time as all these values are persistent)
Enter the height your Z axis is safe to move over a blank (5 mm works)
units are in mm.
UPDATE: To avoid grbl crashing R codes in your gcode output file, put Post-processor setting to NONE.

-click on path to gcode tab

  • depth function is d, (don’t change this)
  • cutting order is pass by pass (cuts entire job at each depth), if you do path by path, it cuts each path segment layer by layer, so it will cut part of the H 4 times and then move to the next piece completing all of the “cut” layer first, then go back and do the tab layer.
    -If the preferences tab is selected, it will not generate gcode, so make sure the path to gcode tab is selected then click “apply”
    Early versions always had an error/warning that would pop up, that didn’t really mean anything, but the latest version works very quickly compared to the old and doesn’t have the error popup.
    image
    click ok then you will see this if it is working:
    image
    It may take a while depending on how complicated the cut is and how many segments there are.
    when the working dialog closes, it is finished. Close the “path to gcode” window and go upload the gcode file to webcontrol or use it in groundcontrol.

This was generated in inkscape, gcode came from inkscape, and it was cut today to show this actually works.

That’s it. If no gcode is generated, then there is a problem. Double check the numbers and try again.
Good luck!

One last point of frustration: between each segment, the generated gcode raises and lowers the z axis. Extra z-axis movement can be manually edited out of the file if desired. CTRL+L will simplify and remove unneeded nodes, but it may also oversimplify and mess up your design: CTRL+Z for undo.

5 Likes

Wow! Thank you so much! I’ve been out of the game for a while and tried MakerCam only to find it’s dead. This is exactly what I needed!

1 Like

Thank you so very much for posting this. I can tell it must have taken a few hours to create and I really appreciate your time and effort. I’m a long-time Inkscpae user (estimating 15 year on and off). I use it to design a lot of different things and send some of them to a 3D printer using another piece of software like slic3r or Prusa edition. I’ve also used a laser cutter at my local maker space that used Inkscpae but also relied on a second software to run the machine. I’m really looking forward to going directly from Inkscape to gcode and skipping the middle-man, so to speak.
I have a couple of newb questions:

  1. How does the Gcode generator handle speed? Do you just set the speed manually for the entire cut?
  2. Does the Gcode generator have any documentation?
  3. have you seen any other add-ons for CNC? I’m thinking about one that might let you auto-generate tabs.
    thanks again for the write-up, you’re the man!
1 Like

@izaklast : Thanks for the positive feedback.

  1. In the colored box, you manually enter the feed rate as speed. There are several options for gcodetools output and I’ve only worked with the one for CNC. There are specific options for area fill, lathe, graffiti and a couple others that I cannot speak to because I have yet to use them. I think area will likely be my next investigation after I get the pendant thing figured out and working right.

  2. cnc-club.ru has the “documentation” on this. If you translate the page, I believe nick, (the creator) has posted several items you can read about, but it isn’t super easy to follow, but enough is there to get going.

  3. I have seen a gcode viewer, but an autogeneration tab option would be amazing. It is out of scope for me right now though.

Please share what you learn if you discover an easier way.

This is a great tutorial!

I followed all these instructions, but when I open my output in groundcontrol, it is at more than double the size! Something that is supposed to be about 600mm (24") wide is almost 3000mm (96") wide.

Any thoughts?—see edit below.

i figured it out.
so for future reference so that others may not have the same error I did…

When you set up your document in “document properties”, pay attention to what is in the “scale” section, which is right below the “custom size” portion where you tell inkscape how large of an area you are working in.
it should say “scale x: 1.000000”
if it says anything else, it will take your output, and before creating g-code, it will scale it up or down (depending on what’s in the Scale x input) then put that out (larger or smaller).

-km

2 Likes

@mrgnstrn good point on the scaling factor. Keep that at 1 so your cut matches your file dimensions.

FYI: I found a hiccup in the gcode generated with gcodetools. In a recent gcode file generated, there was an R command for radius and maslow does not read them, so every layer faulted and to continue, it had to restart at the next line to continue. The reason why gcodetools generates gcode with the R command instead of i and j when it generates is unclear. There is a discussion about it here. Perhaps a script could search and see if any of those are in there or the open source gcodetools could be modified to not use the R command for maslow.

Another option is to draw in Inkscape, export as DXF, then do the GCode conversion with DXF2GCODE. I did this recently and it worked well.

Who has had luck with the “engraving” option in inkscape?

My attempt for some plaques had odd results.

the graphic part came out fine using the above instructions.

When I tried to use the “engraving” for the lettering, the gcode makes the font five times taller, and moves it way off the the right and down on the canvas. most of the gcode is off the plywood.

groundcontrol shows the same.

thoughs anyone?

1 Like

I have not used the “engraving option.” In the example I showed above, it started with text, but was converted to path before doing the gcode step. I have done gcode for both cone and cylindrical shapes though and it works well… most of the time. I found that the G02 or G03 with XY and then R values will crash maslow, so when you generate your gcode, make sure your postprocessor is set to none. Wiki modified above to reflect this.

Alright everybody, I think I found the solution for “text not engraving correctly”.

As previously shown above, text would turn into gcode that was larger and in the lower right corner.

The trick seems to be this:

  1. Write the text
  2. turn the “object into a path”
  3. –>UNGROUP the text.
  4. –> REGROUP the text
  5. do all the normal tool selection, orientation points, etc.
  6. click engraving.

it’s almost as if ungrouping is a required step to convince gcodetools to treat the lines and segments like any other line and segment, instead of treating it special (ie. like text?).

I don’t know why it works, but it seems to solve the glitch.

1 Like