CAD CAM tutorial

CAD CAM tutorial
by D.  Scott Williamson

This tutorial will show you how to use Computer Aided Design and Computer Aided Manufacturing or CAD CAM tools to create and preview a Gcode file of the Workshop 88 logo that can be run in a 3 axis CNC Mill.

Background

There are 5 main types of machine operations

  1. Engrave (follow path): The tool tip will follow the 3D path provided.
  2. Profile: The tool edge will follow either the inside or outside contour of a path down to the specified depth.
  3. Pocket: The tool will remove all the material within a contour down to the specified depth.
  4. Drill: A drill routine will be executed at each point location.  Drill routines come in 2 flavors:
    1. “Peck” used with drill bits, drills to successively deeper depths liftig the bit out of the work regularly to clear chips from the flutes.
    2. “Spiral” used with endmills that are a smaller diameter than the finished hole.
  5. 3D relief: The tool tip will remove material above a 3D surface usually specified in a 3D model or a 2D height map image.  There are two main modes:
    1. “Waterline” similar to inverted pocket operations where bulk material is efficiently removed outside the 3D model to a number of stepped depths resembling waterline in a topological map.  Typically used in a first pass with a large roughing bit to remove the bulk of the material.
    2. “Raster” moves the tip of the bit smoothly over the model in a raster pattern.

Gcode is a “numerically controlled programming language” which is why a Gcode file extension is typically .nc.  It is a human and machine readable text file.  You will rarely if ever need to look at or edit the Gcode.

Overview

This tutorial will demonstrate Engrave, Profile, and Pocket operations, which are the most popular.

There are 4 steps to this tutorial:

  1. Create a .svg file containing paths needed for machine operations
  2. Create machine operations
  3. Export Gcode
  4. Simulate, visualize and validate

Create an .svg file containing paths needed for machine operations

Let’s start by finding some artwork for this demo.

I’ll go to one of my favorite websites, blog.workshop88.com and find an image to use
screenshot-from-2016-10-05-10_50_27

I’d like to get the Workshop 88 shield logo in the upper right corner. To view the image, you can right click on it and click view image
screenshot-from-2016-10-05-10_51_32

The image includes the entire banner, but that’s OK.  I right clicked on the image again and click Save Image As…
screenshot-from-2016-10-05-10_51_59

Alternately, you can select Save Image As… from the right click on the main web page.
screenshot-from-2016-10-05-10_52_15

The outlines in the bitmap image need to be converted to vector paths in an .svg file.  There are many ways to do this: it can be done in InkScape, there are raster to vector tools, and there are other online raster to vector tools.  We are going to use http://online.rapidresizer.com/tracer.php, a free online raster to vector converter.

screenshot-from-2016-10-05-11_17_49

  1. Browse for the bitmap file saved earlier
  2. Be sure Outline is selected (not Centerline)
  3. Select SVG from the drop down menu of output formats
  4. Adjust the Smoothness slider and click Trace to preview the resulting paths.  This will likely need to be done several times to achieve the desired results.

Smoothness slider all the way to the left.  This is too smooth, note the rounded corners and distortions.
screenshot-from-2016-10-05-11_16_33

Smoothness slider all the way to the right.  This is not smooth enough, notice the jaggedness of the shield logo.
screenshot-from-2016-10-05-11_16_52

Smoothness slider adjusted to my liking (at the location in the picture of the website above item #1).  The jaggedness is gone from the shield logo without adding too much distortion.  This is about the best we can get with an image at this resolution.  Higher resolution images will require less smoothing and will yield the best results.
screenshot-from-2016-10-05-11_18_23

5. Save the image

When you are satisfied, save the page.
In the File menu select Save Page As…
screenshot-from-2016-10-05-11_20_41
Navigate to where you’d like to save the file and feel free to replace Traced with an appropriate filename, but I suggest keeping the .svg.html extension.
screenshot-from-2016-10-05-11_22_41

6. Convert the .svg.html into a .svg file
(this is only needed when using the rapidsizer free online tracer).

A. Open the .svg.html file in a text editor.
B. Select all the text before <svg> and delete it.
screenshot-from-2016-10-05-11_23_33
C. Go the end of the file and select all the text after </svg> and delete it.
screenshot-from-2016-10-05-11_23_51
D. Select Save As… from the File menu
screenshot-from-2016-10-05-11_24_33
E. Remove .html from the file extension and save the file as .svg
screenshot-from-2016-10-05-11_25_05

You now have an .svg file created from a bitmap that contains outlines you can use to define machine operations.  Technically this has been part of Computer Aided Design (CAD)

Create machine operations

In this section of the tutorial we import an .svg file into the free online CAD CAM tool www.makercam.com and create pocket, profile, and engrave machine operations.

  1. Load your .svg file into www.makercam.com
    screenshot-from-2016-10-05-11_26_09
    screenshot-from-2016-10-05-11_26_16
  2. The paths may be off screen.  Use the little hand in the upper left corner to move the view around and/or use the mouse-wheel to zoom in and out around centered on the cursor.  The mouse-wheel method takes some getting used to but is a powerful way to navigate around the work area without switching tools
    screenshot-from-2016-10-05-11_26_23
  3. Now that the view is appropriately zoomed in on the artwork, unwanted parts can be deleted.
    screenshot-from-2016-10-05-11_26_41
    Left click and drag to make a selection, anything the selection touches will be selected.  Select the banner to the left of the shield.
    screenshot-from-2016-10-05-11_27_16
    Press Delete key to delete selected objects.
    screenshot-from-2016-10-05-11_27_23
    Select banner to the right of the shield and delete it.
    screenshot-from-2016-10-05-11_27_41
  4. Scale and position artwork.
    Start by selecting the artwork, then clicking on a thin selected line (this can be challenging at times) and dragging to the origin.  Some prefer the origin to be to below and to the left of the work, some prefer it be in the center, sometimes the origin will need to be in other places for more involved machine operations like working both sides of workpiece.  The important thing to remember is that the origin is where the CNC machine will be zeroed (typically in the lower left).
    screenshot-from-2016-10-05-11_27_52
    The grid is configured in inches (see upper right corner of screen).  The default .svg import resolution is 72 pixels per inch (you can change this in Edit Preferences from the Edit menu.
    screenshot-from-2016-10-05-11_29_30
    The artwork is a little over 1 1/2″ inches wide, we’d like it bigger so let’s scale it.
    With the artwork still selected, click Scale Selected from the Edit menu
    screenshot-from-2016-10-05-11_30_12
    Scale the artwork by 200% in X and Y.  Note it scaled around the center of the artwork so it needs to be moved again.
    screenshot-from-2016-10-05-11_30_51
    Artwork scaled and placed above and to the right of the origin (0,0).
    screenshot-from-2016-10-05-11_31_02
  5. Time to create machine operations.
    Select only the top of the shape and click Pocket Operation from the CAM menu, this will remove all the material within the outline path down to the specified depth.
    screenshot-from-2016-10-05-16_09_41
    Enter parameters for a pocket:
    screenshot-from-2016-10-05-16_10_45
    name: enter name of the machine operation
    tool diameter (in): enter 0.25 for a quarter inch bit
    target depth (in): enter -0.125 to cut a 1/8″ deep pocket, typically Z=0 is the top surface of the stock (material to be cut)  and downward values are negative.
    safety height (in): enter 0.25, this is the height above the surface the bit will raise to when moving from one area to another without cutting (also known as “rapid height”)
    stock surface (in): enter 0, this is the Z value of the top of the material, most of the time this is zero.
    step over (%): enter 40, the toolpath to remove all the material from a pocket looks like a collection of nested shapes (see below).  The distance between neighboring shapes equals (step over) * (tool diameter).  This allows the shapes to better cover interior corners and the cutter works best when removing less than half it’s diameter’s worth of material while moving.
    step down (in): enter 0.1, the material is removed in layers, each the depth specified here.  Choosing step down depends on a number of parameters: the bit diameter, material being cut, feedrate, rigidity of the mill.  When milling woods I typically remove no more than 1/3 and 1/2 the diameter of the bit per pass.
    roughing clearance: enter 0, this is used to either leave a little material on all the vertical surfaces (positive values) or remove a little extra material (negative values).  If you’d like a nice finish you would use this value to leave a thin layer of material along the edges that would be removed in a finishing pass, probably a inside profile with a clockwise (climb milling) at a slower rate to leave fewer tool marks.
    feedrate (in/minute): enter 30, this is the rate the cutter will move when cutting the material.  Selecting the correct feedrate will depend on the material being cut, the depth of cut, bit diameter, number of flutes (see speeds and feeds), the power and rigidity of the mill.
    plunge rate (in/minute): enter 30, this is the rate the mill will move vertically when entering the stock.
    direction: select Counter Clockwise, this is the direction the mill will follow the contours of the shape.  Assuming the cutter is rotating clockwise when viewed from the top, cutting a pocket Clockwise is referred to as “conventional milling” and is used generally, cutting the pocket Counter Clockwise is referred to as “climb milling” used for finishing passes (see milling cutter). A shape will be shaded when there is a a machine operation associated with it, this is what a pocket looks like.
    screenshot-from-2016-10-05-16_10_50
    Select the outline of the body of the shield and select Profile Operation from the CAM menu, this will cut along the side of a path down to the specified depth.
    screenshot-from-2016-10-05-16_11_25
    name: enter name of the machine operation
    tool diameter (in): enter 0.25 for a quarter inch bit
    target depth (in): enter -0.125 to cut a 1/8″ deep pocket, typically Z=0 is the top surface of the stock (material to be cut)  and downward values are negative.
    inside/outside: select inside, the tool will follow the inside edge of the shape
    safety height (in): enter 0.25, this is the height above the surface the bit will raise to when moving from one area to another without cutting (also known as “rapid height”)
    stock surface (in): enter 0, this is the Z value of the top of the material, most of the time this is zero.
    step down (in): enter 0.1, the material is removed in layers, each the depth specified here.  Choosing depth of cut depends on a number of parameters: the bit diameter, material being cut, feedrate, rigidity of the mill.  When milling woods I typically remove between 1/3 and 1/2 the diameter of the bit.
    feedrate (in/minute): enter 30, this is the rate the cutter will move when cutting the material.  Selecting the correct feedrate will depend on the material being cut, the depth of cut, bit diameter, number of flutes (see speeds and feeds), the power and rigidity of the mill.
    plunge rate (in/minute): enter 30, this is the rate the mill will move vertically when entering the stock.
    direction: select Counter Clockwise, this is the direction the mill will follow the contours of the shape.  Assuming the cutter is rotating clockwise when viewed from the top, cutting a pocket Clockwise is referred to as “conventional milling” and is used generally, cutting the pocket Counter Clockwise is referred to as “climb milling” used for finishing passes (see milling cutter).  Shapes associated with profile operations appear shaded light blue.
    screenshot-from-2016-10-05-16_11_33
    Select the outline of the “88” digits and select Follow Path from the CAM menu, this will cause the tip of the bit to follow the 3D path of the selected shape(s)screenshot-from-2016-10-07-153529
    name: enter name of the machine operation
    tool diameter (in): enter 0.25 for a quarter inch bit
    target depth (in): enter -0.05 to cut a shallow engraving, Z=0 is the top surface of the stock (material to be cut) and downward values are negative.
    safety height (in): enter 0.25, this is the height above the surface the bit will raise to when moving from one area to another without cutting (also known as “rapid height”)
    stock surface (in): enter 0, this is the Z value of the top of the material, most of the time this is zero.
    step down (in): enter 0.1, the material is removed in layers, each the depth specified here.  Choosing depth of cut depends on a number of parameters: the bit diameter, material being cut, feedrate, rigidity of the mill.  When milling woods I typically remove between 1/3 and 1/2 the diameter of the bit.
    feedrate (in/minute): enter 30, this is the rate the cutter will move when cutting the material.  Selecting the correct feedrate will depend on the material being cut, the depth of cut, bit diameter, number of flutes (see speeds and feeds), the power and rigidity of the mill.
    plunge rate (in/minute): enter 30, this is the rate the mill will move vertically when entering the stock.Shapes associated with follow path will display with yellow outline matching the diameter of the bit.
    screenshot-from-2016-10-05-16_12_35
  6. Generate toolpaths
    Select Calculate All from the CAM menu, this will cause the tool paths for the machine operations to be created.
    screenshot-from-2016-10-05-16_12_41
    When view cuts check box is checked in the upper right corner of the screen, the paths of the full tool width are displayed.
    screenshot-from-2016-10-05-16_12_58
    When view cuts check box is unchecked the paths and direction of the center of the bit are displayed.
    screenshot-from-2016-10-05-16_12_53
    If you would like to edit the parameters of any machine operation you can open the dialog from the Toolpaths menu.
    screenshot-from-2016-10-07-155358
    It is not obvious, but you can delete a machine operation by highlighting it in the list and pressing delete.
  7. Save your machine operations!
    screenshot-from-2016-10-05-16_14_48
    The machine operations are stored in the .svg file, when you reopen it they will still be there.

Export Gcode

When you are satisfied with your toolpaths (after the last calculate all) you can export Gcode by selecting export gcode from the CAM menu.
screenshot-from-2016-10-07-160003
The toolpaths will be listed along with the cutter diameter for each one.
screenshot-from-2016-10-07-160928
There are a few controls for how the machine operations are ordered.
+ – will move selected toolpaths up or down in the list respectively.
sort by tool will allow you to group operations that use the same tool allowing you to manually reduce the number of tool changes needed for complex designs.
profiles last will order profile machine operations last, this is presumably to make doing a finishing pass easier (see “roughing clearance” above).

You can select individual, groups, or all machine operations and export as many Gcode files as you need.

For this tutorial, select all the toolpaths and click Export Selected Toolpaths
Save the file as WS88.nc
screenshot-from-2016-10-05-16_16_20
(remember that Gcode typically has the .nc extension for “numerical control”)

Simulate, visualize and validate

There are several ways to visualize toolpaths in 3D.  We are going to use the free online G-Code Q’n’ dirty toolpath simulator https://nraynaud.github.io/webgcode/

  1. Open your WS88.nc in your favorite text editor
    screenshot-from-2016-10-05-16_17_14
  2. Select all and copy the text (we’ll paste it in a minute)screenshot-from-2016-10-05-16_17_26
  3. Open G-Code Q’n’ dirty toolpath simulator in your favorite browser
    https://nraynaud.github.io/webgcode/
    screenshot-from-2016-10-05-16_17_34
  4. Select all the Gcode in the window on the left and paste our Gcode over it
  5. Click Simulate
    screenshot-from-2016-10-05-16_17_51
  6. It will display the Total Duration of the machine operations, the extents of the toolpath operations, and views of the tool paths in 3D which is useful for making sure you have a reasonable number of passes in your operations (see “cut depth)
    screenshot-from-2016-10-05-16_18_51

Another option is to use cut viewer software like CAMotics (http://camotics.org/)
It’s open source and cross platform but a little rough.  It has several UI defects and required me to edit the stock tools and modify the GCode to use tool #1 (“T0” replaced with “T1”) but, as you can see, with a little tlc it can deliver good results.

screenshot-from-2016-10-05-16_44_09

Another free, but untested Windows only option is NCSim

If you like what you see, you can load your Gcode file into your CNC controller software (Machine Kit, Linux CNC, Mach 3…) and cut something!

D. Scott Williamson
Compulsively Creative

Dedicated to my good friend Terry Surma who helped and encouraged me to make my CNC machines.

Please post any questions or comments to the Workshop 88 Google Group or Slack.