Tech Support: 888-223-3334

CADD Edge Engineering & Design Blog
Tips, Tricks & News from CADD Edge

The Language of CAM G-Code Tutorial Part 1

Posted by Gabe Enright on August 10, 2012 at 2:12 PM

A G what?

One of the problems with using CAM is that people either forget or never knew how to read the program running their machine. While it’s not a bad thing to trust your CAM, when you’re trying to figure out why something isn’t working as planned at the machine it can be quite helpful to understand the instructions it's being feed. So I have decided to do a blog series on G-Code.

There are bout as many different languages as there are controls. In an effort to keep this as simple and clear as possible, I will be using the most commonly used one and that’s G-Code. In an effort to standardize even more I will be using the base of just about every G-code standard and that’s the FANUC 6M.  By the time I am done any one reading these blogs should be able to program the part below by hand.

That’s my goal anyway.

Simple machined block

There are a few different letters used in G-Code ranging from A-Z, and the meanings of some of them change depending on where it’s used. Don’t worry I will be covering most of them.  So to start here are the G-codes I will be covering.

G00 - Rapid Positioning
G01 - Linear Interpolation
G02 - Arc Clockwise
G03 - Arc Counterclockwise

G04 - Feeding Dwell for some time

G17 - X - Y Plane selection
G18 - X - Z Plane selection
G19 - Y - Z Plane selection

G20 (G70) - Inch Units
G21 (G71)- Metric Units

G28 - Automatic Zero Return

G40 - Tool Compensation Cancel
G41 - Tool Compensation Left
G42 - Tool Compensation Right

G53 - Machine Coordinate System Setting
G54 – Work piece Coordinate Setting #1
G55 – Work piece Coordinate Setting #2
G56 – Work piece Coordinate Setting #3
G57 – Work piece Coordinate Setting #4
G58 – Work piece Coordinate Setting #5
G59 – Work piece Coordinate Setting #6
G73_ High Speed Peck Drilling Cycle


G74_ Left Hand Tapping Cycle

G76_ Fine Boring Cycle

G80_ Canned Cycle Cancel

G81_ Drilling Cycle (Canned)

G82_ Counter Boring Cycle (Canned)

G83_ Peck Drilling Cycle (Canned)

G84_ Right Hand Tapping Cycle (Canned)

G85_ Boring Cycle (Canned)

G87_ Back Boring Cycle (Canned)


G90 - Absolute Positioning
G91 - Incremental Positioning

G98 - Feedrate Per minute
G99 - Feedrate Per Revolution


The top of the list is G00. The format is the G followed by 2 digits. That is the standard but with all standards there are exceptions. You may also see the G00 written as G0. Not all controls require the leading 0. In this case the 00 means to position the tool at a rapid traverse. In other words move as fast as the machine can. Simple right?

Well there is a little more to understand and that’s how the machines actually move. There dogleg rapid traverseare three different ways a machine will position in rapid. The first one is it will move directly from point A to point B. the other two are referred to as doing a dogleg move. But what some machines do is move both axes at the same rate making a 45° move, then finish the longest leg move. The third will move just the opposite as method two. It will make a straight line move and when the distance left is equal it will move both axes. Why is this important? Well Cam systems don’t know how YOUR machine moves so it is up to you to understand it.


The next code I will talk about is G01 along with G40-42 and the F command. So until my next blog happy programming.



How to Model an Epicycloid Curve in SolidWorks

Posted by Gabe Enright on November 30, 2011 at 10:06 AM

Disclaimer:  This is probably my geekiest post to date.  There is a lot of math and my explanation of the theory is not likely to be entirely accurate.  You have been warned.

A question came up on the support line recently from a customer who was looking to model an

Epicycloid Curve.  We first had to learn what one was.  Wikipedia of course was there with the answer.  Basically its the curve produced when a point on one circle rolls along another circle. Think Spirograph.Spirograph via Wikipedia

Epicycloid Curve


The next challenge is creating the curve in SolidWorks.  Modelling a curve driven by an equation is actually quite easy.  Just start a new sketch and insert an equation driven curve.SolidWorks Equation Driven Curve

I chose to use the form of the equation.

Epicycloid Equation

Epicycloid equation

Which looked something like this where r =2 and k =1.  And we solve for the parameter t from 0 to 6.25 (approximately 2Pi)

blog epicyloid equationSolidWorks Epicycloid Curve

So that was easy now lets make some of the other cool shapes described on the wiki page.  I'd rather not dig through the equation each time I want to change a parameter and find each location, I'd rather make it parametric.  Currently it isn't possible to link an equation to a SolidWorks global variable, but I can link the variable to a sketch dimension.  So I added a couple sketch points and dimensioned between them and then linked them to my equation.

SolidWorks Parametric Equation

I have two dimensions in my sketch now, one called r, and the other called k.  By swapping "r@sketch1" and "k@sketch1" for the numbers representing those parameters I can now control the equation by modifying them or even linking them to SolidWorks Global Variables.

Its time to change k to 4 hit rebuild and get a cool shape like this one4 lobed epicycloid. My geometry didn't update at this point, how come?  The reason is that SolidWorks creates Equation Driven curves as splines.  A spline has to be continuous and smooth and the cusps or sharp corners cannot be drawn as a spline.  That is why I in my first exampe I stopped short of evaluating T all the way to 2Pi, I was cheating.  If we zoom in on my curve you'd see the shape isn't complete. If I want to depict the entire shape I can copy the curve four times and evaluate it for a segment representing each node.  Which looks like this. (Download here in 2011 format.)

What about all the other crazy ones?  Like this?   Can we do them?  Yes but we'll need Simulation Motion, Sketch Blocks, and Trace Paths.  I'll show you that in a future post.  For now here is a teaser video.




How to Represent a Knurled Surface in SolidWorks

Posted by Jess Levasseur on August 18, 2011 at 4:52 PM

The question comes up all the time "How can I model a knurled surface in SolidWorks?"Knurl image from Wikipedia

My answer to that is, "You don't want to model a knurled surface."

  When my Jedi Mind Trick fails and they press me on why, I explain that a knurled surface would create thousands of extra faces in their model which would increase file size, bog down their graphical performance, and make the folks at NVIDIA really happy because they have an excuse to market a Graphics Card with a Terabyte of RAM. If you really want to model a knurled surface, and there are reasons to do it, like you are making a plastic part and the mold will be made from your model, it can be done.  Our Advanced part modeling class will teach you the skills needed to model a knurl. (Hint:You'll need to use SWEEPS, and CIRCULAR PATTERNS)

It is however, important to be able to represent a knurl, and that is what we are going to focus on now. Depicting a knurl is a simple process of Defining the Region to be knurled, Apply a Texture to be knurled, and Calling out the Knurl on your detail drawing.  Here are the steps.

  1. Create a sketch on a plane that you can project the region onto your surfaces.  In my case I used a plane along the axis of my cylinder.

describe the image

2. Sketch two lines that intersect the edges of the cylinder and dimension them as required to define the region to be knurled.

describe the image

3. Choose Insert>Curve>Split Line... Use the Projection option and select your sketch and the face to split.  Now you have a face that you can change the appearance of to represent the knurl. 

describe the image

4. Select that face and then the Edit Appearance "Beach Balldescribe the image".  You can select on of the predefined knurl patterns that ship with SolidWorks, or simply select a knurled image.  Note: The SolidWorks knurl appearances are texture maps and require realview graphics to display.

    describe the image

    When it comes to detailing the knurl Your texture from the 3D model will not appear but we don't need it to.  A knurl is commonly depicted with a callout and hatching of the area to be knurled.

    describe the image

    You will find that you cannot attach an area hatch to a cylindrical face however.  Simly sketch a rectangle and attach it to the corners of your knurl region, and hatch the rectangle.  The more I researched this the less convinced I became that the hatching was necessary.  But now you know how to do it. 

    Keep an eye out for a YouTube version of this tutorial as well.


    Thanks to Stefanie for the suggestion of this article


    SolidWorks Save, Save-As, Save-As Copy???

    Posted by Jess Levasseur on July 29, 2011 at 12:25 PM

    Because of the relationships between files in SolidWorks saving a copy of a file can be an adventure for some, and an act of faith for others.  This is another case of describe the imageSolidWorks doing exactly what you tell it to do, not what you want it to do.  With just a little bit of practice and understanding  you can master your references and start copying files in no time.  Stefanie wrote up a great little exercise that will guide you through the differences between Save, Save As, and Save As Copy. Use this link to download the instructions.

    Download it and give it whirl it shouldn't take you more than 10 minutes or so.  To learn even more about file referencing in SolidWorks she'll be teaching the File Management course in October.  Check out the schedule and register here.


    SolidWorks Electrical Routing Tutorial

    Posted by Jess Levasseur on February 11, 2011 at 2:57 PM

    I led a Hands On session down at SolidWorks World 2011 in San Antonio last month.  In it I led about 30 attendees through a basic Electrical Routing exercise.  Despite being the last session of the conference we had a full house and some folks just stuck around even though they didn't have a computer available.

    Apologies to those whose computers did not function properly.  I tested two machines and assumed they were all set up the same way. describe the image  

    I figured I would share the materials here as Routing Tutorials are few and far between.  In order to run it you'll need a SolidWorks 2011 Premium license.  Once you've downloaded the PowerPoint, open it up and you will find a zip folder on the first slide. Unzip the folder to your desktop and inside you'll find a docs folder with Word document you can print out for instructions.  Let me know what you think in the comments section or email me with questions.  If you think it would be helpful I could capture a video version and slap it up on our YouTube channel.

    -Update-  The zip file in the power point doesn't work.  So I'd reccomend using the download from the SolidWorks World proceedings site.

    World Presentations

    Zip file with presentation.



    Subscribe to Blog