User:BHSPitMonkey/Inkscape and Gcodetools Tutorial

From ShapeOko
Jump to: navigation, search

Inkscape and Gcodetools Tutorial: Cut Out a Shape

A tutorial by BHSPitMonkey

Overview

Once you've finished building your ShapeOko, you'll probably want to do an easy project to take it for a spin. My first few jobs involved simply cutting out a few shapes. This is fairly easy to do without any CAD/CAM software thanks to Gcodetools, an extension for Inkscape (a free/open-source vector drawing application).

Despite how easy it is to do, Gcodetools is a bit hard to figure out how to properly use. In this tutorial, I'll walk you through each and every microstep. (See what I did there?)

In this tutorial, we'll be doing what CNC operators call a "profile" operation. This is where the tool simply moves around the outline of a shape. Profile operations are ideal when you plan on cutting all the way through the material (like a cookie cutter), or if you just want to etch a simple outline.

Software Setup

We'll need to install Inkscape and Gcodetools. The next version of Inkscape (0.49) will include Gcodetools by default, but I'm going to walk us through using the current stable version (0.48).

Inkscape

Inkscape is available at no cost for Windows, Linux, and OSX. Visit the Inkscape download page to find the appropriate installer for your OS and install the program.

Gcodetools

Gcodetools is available from this forum post and the installation instructions are available here. Basically, you'll want to download the archive and extract its files to the appropriate location for your OS:

  • Windows: C:\Program Files\Inkscape\share\extensions\
  • Linux: /usr/share/inkscape/extensions/
  • Mac OS X: /Applications/Inkscape.app/Contents/Resources/extensions

Open Inkscape (restart it if it's already running) and ensure that under the "Extensions" menu, there is now a "Gcodetools" submenu. If it's not there, your Gcodetools installation did not go successfully.

Project: Cut Out a Shape

Now that the software is ready, we can begin!

Document Setup

Document Setup
  1. If Inkscape is not already running, open it. You should see a white canvas with a page border and some toolbars on the screen. (If Inkscape is already running, create a new document from the File menu.)
  2. (This step is optional, but I recommend doing it so that the page resembles your CNC work area.) Change the document size by doing the following:
    1. Click the File menu and choose Properties. The "Document Properties" window will appear.
    2. In the Page Size portion of the window, choose inches or centimeters for Units (whichever you're accustomed to).
    3. Set the Width and Height values to the approximate size of your usable cutting area. For a standard ShapeOko, this is around 7.5" wide by 6.5" high.
    4. Close the window.

Create Orientation Points

Create Orientation Points
Create Orientation Points (Finished)
  1. Click on the Extensions menu and choose Gcodetools > Orientation points.... A window will appear.
  2. Leave "Orientation type" set as "2-points mode".
  3. Leave "Z surface" set to 0.0. This tells the software that the top of your material will be at Z=0 (which we will achieve by homing the machine right on top of the material prior to cutting).
  4. Set "Z depth" to the thickness of your material (the default unit for this value is mm, but you can change this to inches on this screen as well). This will determine how far down the tool will go before the job finishes. For a clean cut, it's best to slightly overshoot the thickness of your material here (by a millimeter or so), which is why it's important to have a waste board underneath your material that can handle the extra cutting (unless you want to ruin the table your machine is on!).
  5. Make sure you still have the "Orientation" tab selected, and then click the Apply button. The window should disappear, and some arrows and numbers will be added to your drawing.

These arrows help you to know where the machine's home position is in relation to your drawing. The left arrow points to the home position (0, 0, 0) in the lower-left corner of the page, and another arrow to the right of it points out (0, 100, -depth) where depth is the Z depth you chose in step 4. If you change your mind about this depth later on, you can simply change the value here using Inkscape's Text Tool.

Add a Tool

Add a Tool
Add a Tool (Added)
Add a Tool (Editing)
  1. Click on the Extensions menu and choose Gcodetools > Tools library.. A window will appear.
  2. Choose "Cylinder" as the Tool type.
  3. Make sure you still have the "Tools library" tab selected, and then click the Apply button. The window should disappear, and a green box with some text will be added to your drawing.
  4. Activate the Text Tool by clicking the button on the toolbar that looks like a bold capital A with a text cursor beside it.
  5. Set the numeric value beside "diameter" to your cutting tool bit's diameter in millimeters.
  6. Set the numeric value beside "feed" to the feed rate (in mm per second) that you would like to use. This refers to how fast the tool will move while cutting through the material. I currently use 400 for cutting MDF and other soft woods, but your mileage may vary. More details below.
  7. Set the numeric value beside "penetration feed" to the rate (in mm per second) that you would like the tool to move at while plunging down into the material. I currently use 100. This is a critical moment in the cut, so be careful not to use too fast a value here.
  8. Set the numeric value beside "depth step" to the height (in mm) of each step you want the tool to descend into the material at a time. For instance, if your final Z depth is -7mm, and you use 1mm depth steps, the tool will have to make 7 trips around your path (shaving off only 1mm of material each trip). The appropriate step value depends on the tool, endmill, material, and feed rates. (A DW660 with a carbide endmill is plenty capable of cutting a 7mm (1/4") sheet of MDF in one step, as an example.)

A note about feed rates: Finding the best feed rates to use is tricky, as it depends on a lot of factors (the RPM and torque of your cutting tool, the size and strength of your endmill (bit), the resistance/hardness of the material, and so on). The example values I've given work well for me (I use a DW660 tool with a 3mm carbide endmill, and I cut 1/2-to-1/4" sheets of soft wood such as MDF and small plywood sheets), but the general cause-and-effect to keep in mind is this:

  • Is the material scorching during cutting, or do you smell burning? Your feed rate is too slow; The tool needs to move faster (or at a lower RPM if possible) so heat does not accumulate around the bit.
  • Is the tool struggling to move around through the material (the endmill is visible dragging, or the shape is deformed because the tool had a hard time moving around)? Your feed rate is too fast; The tool needs to move slower so that the endmill can take smaller nibbles (or you should increase your RPM if possible).

A note about depth steps: You should aim to take the largest steps your tool/material combination can tolerate. Small steps means more passes, which means the total cutting time gets multiplied. Large steps mean your job gets done quicker, but it can also cause the tool to struggle if the material is challenging for the tool and endmill to cut through.

Design a Shape

(If you're already comfortable drawing in Inkscape, feel free to import or paste a path from another illustration, or use your creativity here. Our goal in this section is to end up with a single path to cut.)

  1. Activate the "Stars and Polygons" tool by clicking the toolbar button that looks like a yellow star with a yellow pentagon behind it.
  2. On the toolbar at the top of the window, you should now see two buttons: One with a yellow pentagon, and another with a yellow star. Click the star button.
  3. Next to the star button you just clicked, set the value for "Corners" to "5".
  4. Click somewhere on the page, hold the mouse button down, drag the mouse up some amount, and release the button. This will draw a 5-point star on the page.
  5. If you're happy with the shape, activate the "Select" tool by clicking the toolbar icon that looks like a mouse cursor arrow.
  6. The shape should still be selected (it should appear outlined and have resizing handles on its edges and corners). If it isn't, click somewhere on its outline.
  7. On the toolbar at the top of the window, look for some controls labelled "W" and "H" (width and height).
  8. Click the "Lock" button between these controls to lock the shape's proportions.
  9. To the right of these controls, change the units from "px" to "in", "mm", or "cm" (whichever you prefer to work in).
  10. Change the width or height of the shape to your desired dimensions for the cut (2 or 3 inches will work fine for this tutorial). Changing either dimension will update the other one proportionately.

Compensate for Bit Size

Gcodetools does not account for the diameter of the bit you are cutting with (even if you provided it with your tool description earlier), so we will need to adjust our shape before moving on. Fortunately, there are a few easy ways to do this in Inkscape. Here is the way I usually do it:

  1. Make sure the shape is selected (it should still be selected from the previous step). If it isn't, use the Select tool to select it by clicking somewhere on its outline.
  2. From the Object menu, select Fill and Stroke. A new pane will appear on the right side of the window.
  3. In the new "Fill and Stroke" pane, click the Stroke style tab.
  4. Change the unit next to the "Width" control to "mm" or "in", depending on how your cutting bit diameter is measured. (My bit has ".1181" printed on it, which is 3mm in inches. I use the 3mm measurement here.)
  5. Enter the diameter of your bit in the "Width" field. You should see the outline of your shape change in thickness.
  6. Close the "Fill and Stroke" pane by clicking the "x" symbol in its top-right corner.
  7. From the Path menu, select Stroke to Path.
  8. From the Path menu, select Break Apart.
  9. From the Path menu, select Union.

Generate the Toolpath

We are finally ready to convert our shape into G-code.

  1. Make sure the shape is selected (it should still be selected from the previous step). If it isn't, use the Select tool to select it by clicking somewhere on its outline.
  2. From the Extensions menu, select Path to Gcode.... A window will appear.
  3. Click the Preferences tab.
  4. Choose a name for the G-code file that will be generated, and enter it into the "File" field. The default is "output.ngc".
  5. Choose the directory where the file should be created, and enter its path into the "Directory" field. For example, "C:\Users\Edward\Desktop" (Windows) or "/Users/edward/Desktop" (OSX).
  6. The "Z safe height for G00 move over blank" field decides how many millimeters above the surface the tool will rise between cuts. A good value to use here is "5.0".
  7. For the "Units (mm or in)" selector, leave the value as "mm". GRBL will be working in millimeters.
  8. For the "Post-processor" selector, choose "Round all values to 4 digits". If you don't do this, GRBL will most likely mess up your shapes!
  9. Click the Path to Gcode tab.
  10. Click the Apply button at the bottom of the window. A progress dialog will briefly appear.
  11. If any error messages appear, pay attention before dismissing them. If you followed all the steps in this tutorial, there should be no errors.
  12. Click the Close button once the progress dialog has gone away. You should now see a preview of the toolpath overlayed on top of your shape, and the G-code file should now exist in the directory you chose in step 5.
  13. Save your work!

Verify the G-Code

Before sending any G-code to my machine, I do a few things to make sure everything's looking good:

  1. Load the G-code into OpenSCAM, a handy free application that simulates the cut in 3D. This lets you make sure everything looks correct before running the job for real.
  2. Manually verify that none of the lines in the .ngc file are longer than 60 characters. Most versions of GRBL ignore everything after the 60th character in a line, and sometimes some manual rounding of long decimal coordinates is necessary to keep things under this limit.
  3. Test the cut on the actual machine, but with the tool turned off and a few inches above the material. This lets you see what the real movements will look like in the air. (Note: Don't forget to reset coordinates after jogging the Z-axis upward into the air, or else the tool will move right back where it started when you begin!)

Run the Job

todo

To be continued...