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
- Engrave (follow path): The tool tip will follow the 3D path provided.
- Profile: The tool edge will follow either the inside or outside contour of a path down to the specified depth.
- Pocket: The tool will remove all the material within a contour down to the specified depth.
- Drill: A drill routine will be executed at each point location. Drill routines come in 2 flavors:
- “Peck” used with drill bits, drills to successively deeper depths liftig the bit out of the work regularly to clear chips from the flutes.
- “Spiral” used with endmills that are a smaller diameter than the finished hole.
- 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:
- “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.
- “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:
- Create a .svg file containing paths needed for machine operations
- Create machine operations
- Export Gcode
- 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
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
The image includes the entire banner, but that’s OK. I right clicked on the image again and click Save Image As…
Alternately, you can select Save Image As… from the right click on the main web page.
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.
- Browse for the bitmap file saved earlier
- Be sure Outline is selected (not Centerline)
- Select SVG from the drop down menu of output formats
- 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.
Smoothness slider all the way to the right. This is not smooth enough, notice the jaggedness of the shield logo.
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.
5. Save the image
When you are satisfied, save the page.
In the File menu select Save Page As…
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.
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.
C. Go the end of the file and select all the text after </svg> and delete it.
D. Select Save As… from the File menu
E. Remove .html from the file extension and save the file as .svg
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.
- Load your .svg file into www.makercam.com
- 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
- Now that the view is appropriately zoomed in on the artwork, unwanted parts can be deleted.
Left click and drag to make a selection, anything the selection touches will be selected. Select the banner to the left of the shield.
Press Delete key to delete selected objects.
Select banner to the right of the shield and delete it.
- 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).
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.
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
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.
Artwork scaled and placed above and to the right of the origin (0,0).
- 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.
Enter parameters for a pocket:
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.
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.
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.
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)
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.
- Generate toolpaths
Select Calculate All from the CAM menu, this will cause the tool paths for the machine operations to be created.
When view cuts check box is checked in the upper right corner of the screen, the paths of the full tool width are displayed.
When view cuts check box is unchecked the paths and direction of the center of the bit are displayed.
If you would like to edit the parameters of any machine operation you can open the dialog from the Toolpaths menu.
It is not obvious, but you can delete a machine operation by highlighting it in the list and pressing delete. - Save your machine operations!
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.
The toolpaths will be listed along with the cutter diameter for each one.
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
(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/
- Open your WS88.nc in your favorite text editor
- Select all and copy the text (we’ll paste it in a minute)
- Open G-Code Q’n’ dirty toolpath simulator in your favorite browser
https://nraynaud.github.io/webgcode/
- Select all the Gcode in the window on the left and paste our Gcode over it
- Click Simulate
- 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)
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.
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.