Skip to content

How‐To Generate G‐code from an OnShape CAD model using Fusion 360 CAM

Mohan Kartha edited this page Jan 29, 2024 · 3 revisions

How-To Generate G-Code from an OnShape CAD design using Fusion 360

Why are we doing this

Many of the CAD designs we do are for parts or components of the FRC robot. This year (2024) we are using OnShape as our online CAD design tool.

These CAD designs can be manufactured by 3D-printing, laser cutting, or CNC milling, if they are converted into the proper type of file to be used by the specific manufacturing machine, but of course every manufacturing machine needs different customized instructions for each specific device.

Some years ago, the FRC Team 830 RatPack purchased its own CNC milling machine, an OmioCNC machine with a Mach3 controller.

Additionally, by being hosted by and working in the Huron PLTW classroom, the RatPack team has access to use the laser cutter, a number of 3D-printers (Stratasys, MakerBot), and other power tools that aid in the construction and manufacture of robots and FRC game pieces.

What is G-code and why do we need it?

Most automated Computer-Aided Manufacturing (CAM) devices will accept files containing manufacturing instructions in a format called G-code (the G is short for Geometry).

We cannot (yet) generate G-Code directly from OnShape ... so ...

  • We currently generate the CAM CNC toolpath and G-code for the Mach-3/OmioCNC using AutoDesk Fusion 360 CAM features

These 2 links provide some reasonably verbose instructions (with screenshots), about how to generate a milling toolpath and G-code from Fusion 360:

FRC Team Steps to generate G-code

Import your design file

  • export part/assembly from OnShape to .DXF or .STEP file so it can be imported into Fusion 360
  • import/open your .DXF/.STEP file into Fusion 360

Setup the CNC tool templates for use

  • switch from DESIGN mode to MANUFACTURE mode
  • import the CNC tool/materials template into the Template Library (if not already there)
    • select one or more of the materials template .xml files from Google Drive [RatPack Robotics 830] shared folder
    • download the .xml files to a local folder and then rename the file to remove the .xml extension so it is importable by Fusion 360
      • if you do not remove the .xml suffix, Fusion 360 will refuse to find/see the file as a compatible/usable template
    • import the downloaded template file using the Manage tab to access the Template Library
      • scroll down to Template Library > My Templates > Local
      • navigate to the folder containing the downloaded template file and select it to import it

Setup a new CNC toolpath to make the part

Create a new CAM Setup for your part design, using the correct template that matches your material and CNC milling tool

  • this opens a pop-up box where you can set the Work Coordinate System (WCS), Stock Size and Model Orientation for the new CNC setup
  • it is important to set the work coordinate system to match your CNC milling machine, so figure out what directions are X,Y, & Z on the machine

Select the proper orientation for the CNC milling bed and part to be milled

  • Z-axis oriented UP in the same direction of the milling tool
  • Y-axis oriented lengthwise along the milling table surface starting from the furthest right edge and running to the left edge
  • X-axis oriented laterally back into the image/screen matching the milling table surface from the front edge to the back edge

Once you have the coordinate properly set, set up the stock size and orient your model to match the stock

  • Set your Stock size:

    • measure the material you are cutting (and that you will screw down onto the MDF board on the CNC mill bed)
    • add those measurements into the Setup | Stock tab - this should show a sheet/box that resembles the material you will be milling
  • Move your model to match the material orientation

    • Use the Move option to reorient your material so that it fits into the Stock material outline