I spent this past 4th of July getting my machine controller back in motion. It’s been awhile and wanted to test it our on some really minute features. I spotted a few problems, and decided the troubleshooting session would be good to relay to you. Today I will discuss how InventorCAM deals with certain G-Code tool movements, including tool changes.

Coordinate Space

Every machine that is running on G-Code uses both Machine coordinates (absolute area of the machine) and Work coordinates (relative to the part). Each CAM application deals with these differently. InventorCAM has a Coordinate System Manager that keeps track of how your part is related to a machine’s coordinates.

With that said, I’d like to stop the discussion about the two systems, and simply say that the more integration of your machine’s characteristics you want in your G-Code, the more I recommend going beyond this article to study how to integrate your machine’s behavior into InventorCAM.  The topic can become lengthy, and I can add some more information about this later.

Generate G-Code

InventorCAM G-Code GenerationIn the interest of a consistent timeline, I’ll show easy process of generating the G-Code for any or all the operations.  Highlight all the operation that you want to output, right click and pick GCode, then Generate. Additionally you can do the same to the Operations header, and GCode All.  This will post the entire process into one file. I was troubleshooting so I split mine into two.

InventorCAM stores each file in a folder specified in the settings, and associates this file to open whenever a List request is made. Generate on the other hand, re-writes the file and opens it in Notepad (or whatever default application you choose). .

InventorCAM G-Code Templates

Every code that is output is built from a template that pulls data entered into the InventorCAM dialogs, and formats the G-Code accordingly. When you start working with your part, you are prompted to indicate to InventorCAM what machine template to use for the code output. My controller uses a standard that is quite close to the Fanuc 3-axis generic code.

InventorCAM G-Code TemplateThe actual templates are easy to copy and edit, and making your own template is just that simple. The templates are stored in the following Win 7 (64 bit) path:

C:\Program Files (x86)\InventorCAM2010\Gpptool\

Each template is divided into sections related to Operation start, Rapid Move, and Tool Change to name a few. Once you study these, troubleshooting sessions will become much easier.

Editing the Template

We can add or remove as much as we need in order to accommodate any particular machine we are using. Before I get to the code comparison, I want to point a problem and how it was resolved through a quick edit. The Fanuc Generic code used in InventorCAM ends each operation with a safe-z height, and then the tool change calls a home code before doing anything else (see the image below).

The G28 Home code on the Fanuc is a wonderful piece of ingenuity, that sends the tool to Machine Home coordinates, by way of optional Part coordinate first. So if I call G28 X0 Y0 Z15, the machine will travel to X0 Y0 Z15 related to the Part being machined, and then travel to the Machine home coordinates last.

The InventorCAM Fanuc template goes one step further by simultaneously putting the machine in incremental coordinate  mode: G91 G28 Z0.

This puts the controller in incremental mode (G91), and tells the tool to go home (G28) through coordinate Z0. Since it’s incremental, this tells the tool to move 0 units along the part vertical plane (No Vertical Travel), which is good because the tool has already been raised to a safe height, and is just waiting there. Then it is sent home.

My controller sees G28 optional coordinates as Machine coordinates, and ignores the incremental call when G28 is in use. So the controller sends the tool to Machine Z0 (the vise), through the part, and then home. Since tool is already to travel height, and my machine has a tool change macro assigned, it is easier to configure the operation at the machine controller. So I simply remarked the 2 calls that are killing parts using a semicolon, and some flashy text to help me remember what are my remarks and what are InventorCAM’s. The second call remarked (G90) puts the controller back into absolute coordinate mode, which I will not need now.

Look at Template Tool Changes

So let’s skip past my edits, and InventorCAM’s remarks, and look at the Tool Change request. It formats the string of characters one piece at a time, and then posts the information line by line. I’ve divided these up into groups for each completed line of code.

InventorCAM Template Fanuc.GPP

M01 (Optional Stop) – This stops the machine if it is selected to pause on ‘Optional Stops’. This provides an optional break in operations should the user desire to employ them. I like it just so I can be fully focused when the tool change operation goes down.

N_ M6 T_ (Tool Change Order) – N is an optional line number. M6 refers to Mill Macro 6, which is universally understood as Change Tool. T and the number immediately following refers to the tool index number to be used.

G90 G00 G40 G(54-59) (Sets the next operation run) – G90 is the Absolute Coordinate mode. The machine is then set to Rapid traverse (G00), Turns off tool radius compensation (G40), and tells the machine which of 6 stored Part Coordinate spaces to use.

G43 H5 D35 G0 X__ Y__ Z__  S__ M3 (Move back to Part Space with tool height compensation) – The next line tells the machine to compensate for predetermined tool lengths (G43) for height of tool #5 (H5), radius compensation for tool #5 (D35), and move the tool to Part coordinates X Y Z, sets the spindle speed in SFM (S__), and Turns the Spindle on clockwise (M3).

M8 – the switch to turn coolant on

Tool Heights

One important thing I’d like to point out is that the Tool Change move to part (G43 H5 D35 G0 X__ Y__ Z__  S__ M3 ) previously mentioned sets the Z coordinate at the ‘Tool Start Level’ specified in the part coordinate system defined in the ‘CoordSys Data’ Dialog (See Below). Think of Tool Changes as a separate operation. The template cares for this.

After the tool change is completed and the operation has started, the levels defined in that specific operations setup are used. Some of these are automatically defaulted from the CoordSys Data when each operation is created. All of them are easily configurable during the operation setup.

InventorCAM Operation in G-Code


InventorCAM Tool LibraryThere are a LOT of settings in InventorCAM related to machine coordination. The information I covered here is a good place to jump off from when looking to learn how to get InventorCAM to integrate more closely with your machine. Another good place to study is the tool library configuration. Holder heights and tool height compensations are very important when integrating better control over the Machine’s space.

InventorCAM also has a machine simulator, a good thing to look into for conflict analysis, which might just be a good article to write in the near future.