How to Generate G-Code For Onshape Models From Anywhere in Minutes

The following article was published by Onshape on September 7 and is reprinted here with permission. Enjoy!

The ability to perform CAM programming from anywhere and on any computer is a reality with VisualCAMc, available soon in the Onshape App Store. This release from MecSoft Corporation builds upon years of product innovation development of its flagship desktop product, VisualCAM. VisualCAMc has been released as a beta and is being readied for final commercial release later in the year.  This beta release is free and available for anyone who has an Onshape account and who is approved by MecSoft.

Click here if you are interested in signing up for the VisualCAMc Beta program!

Manufacturers, furniture designers, prototypers, makers and machining enthusiasts all say they use MecSoft’s CAM products for one very simple reason – it’s fast and easy to use! We hear this every time we sit down and talk with our users.  

To illustrate this point, let’s take a look at the four basic steps required to program G-Code from any Onshape part: Setup, Machining Operations, Verify and Post.  The VisualCAMc Toolbar located across the top of the screen provides easy access to these tools:  

The VisualCAMc Toolbar

The Setup

This step defines the machining environment and answers these questions: How is the part oriented on the machine? Which machine controller are you posting to? What are the stock dimensions? Where is your machine zero point located?


We start with defining the Machine. The Machine dialog allows you to align the XYZ axis of the machine tool with respect to the orientation of the part.


In this step, we tell VisualCAMc which post-processor to use for posting the resulting G-Code. The selected post-processor will correlate with the type of controller that is installed on the CNC machine tool. VisualCAMc provides over 300 pre-configured post-processors to choose from.


In this step, the stock is defined as a box that emcompases the part. You can also add offset values in each axis to increase the size of the stock box.

Work Zero

Once the Stock is defined, you can easily tell VisualCAMc where on the Stock (or on the part) that you want to locate the program zero point. The point selected should be the actual location on the stock or part where you will physically tell the CNC Machine Tool to be its program coordinate zero point.  Once created, the MCS triad is displayed at this location.
Machining setup procedure in VisualCAMc

Let’s Review:

  1. The Setup defines the physical machine environment unique to the part you are machining. It defines the Machine, Post, Stock and Work Zero.
  2. The Machine defines the orientation of the part on the table of the CNC machine. The Machine Tool Coordinate system or MCS is represented as a triad separate from the Onshape World Coordinate System or WCS triad.
  3. The Stock is a box that encompasses the part. It can be set to the XYZ part bounds. You can also add stock in each XYZ direction making the stock larger than the part.
  4. The MCS can be moved to a Work Zero point on either the stock or the part and will represent the program zero point from which all toolpath coordinates are measured.

Machining STRATEGY

In this step, the machining strategy used to machine the part is selected. The operation types you use will largely depend on the geometry of the part being machined. Here the cutting tool is defined as well as the clearance plane, the feed and speeds, the control geometry and most importantly, the cutting parameters. These tasks are represented by separate tabs on the toolpath operation dialog.  

At any time while the toolpath dialog is displayed, you can select Control Geometry in the form of surface edges or curves. These selections will serve to either drive (in the case of 2½ Axis) or contain (in the case of 3 Axis) the tool cutting.  In 3 Axis, the underlying part surface geometry will always drive the cutting tool.

3 Axis Horizontal Roughing in VisualCAMc

Machining Operation Selection

If the part is prismatic with vertical walls, pockets and holes, 2½ Axis operations can be used. These toolpath strategies include FacingPocketingProfiling and Engraving. In 2½ Axis toolpaths, the cutter moves in the X and Y axes simultaneously while maintaining a constant Z depth.

However, if your part has tapered walls or contoured pockets, like our sample part, 3 Axis toolpath strategies will need to be used. In 3 Axis toolpaths, the cutter can vary its position in the three axes (X,Y and Z) simultaneously. These strategies include Z-Level RoughingZ-Level FinishingParallel Finishing, as well as Spiral and Radial Finishing.

For our sample part, we have selected 3 Axis Z-Level Roughing using a Flat End Mill to remove the bulk of the stock material, leaving a thin layer of stock next to the part. This is followed by a 3 Axis Parallel Finishing operation using a Ball Mill that will machine the remainder of the stock down to the part surfaces.

Tool Selection

You can define your cutting tool(s) prior to or while defining the toolpath operation. Prior to the operation, you can select from each of the 12 different tool types available (Ball, Flat, C-Rad, Taper-V, Taper Chamfer, Taper Ball, Face, Dove Tail, Fillet, Lollipop, Drill and Center Drill).  During an operation, only the tool types supported by that operation type are presented.

Feeds and Speeds

These parameters will assign values for Spindle Speed (in rpm) as well as Cut, Engage and Retract Feeds (in units/minute).

Clearance Plane Definition

These define the clearance plane as well as the cut transfer method. The Clearance Plane is the safe Z height at which the tool will position itself prior to beginning its entry and approach motion for cutting. The Cut Transfer Method defines where the tool will retract to when it transfers from one cutting location to another.

Cutting Parameters

These parameters will determine how the cutting tool moves during the operation. In addition to Tolerance and Stock allowance values, these will include the Cut Pattern (such as Offset, Linear or High Speed), where to locate the Start Point of the cut, and the Cut Direction such as Climb (down cut), Conventional (up cut) or mixed. There will also be Step Over and Step Down Distance values that control the cutter movement between cuts and between levels. Also included here are the Entry and Exit motions. For example, how the cutter will approach and engage the material and how it will depart and retract.
3 Axis Parallel Finishing in VisualCAMc

Let’s Review:

  1. You can choose from 2½ Axis, 3 Axis and Hole-Making toolpath operations depending on the type of part you need to machine.
  2. Each operation type is controlled with a single dialog that has tabs for each of the control groups needed to define that toolpath, including Tool Selection, Feeds and Speeds, Clearance Plane and Cut Parameters.

The Verification

Once your toolpaths are generated, you can use this step to perform a cut material simulation. This simulates each toolpath motion including approach, engage, cut, departure and retract, while displaying the in-process stock model. There are Play, Pause and Stop controls that allow you to focus in on each specific motion of the cutting tool.
Toolpath verification in VisualCAMc

The Posted G-Code

The last but most important step is posting the actual G-Code file that you can send to your CNC Machine Tool to cut the part. This is a text file that contains all of the codes specific to your CNC Machine Tool’s controller. Once this step is complete, the actual G-Code file will be downloaded to your desktop where it is displayed in your default text editor, such as Notepad.
Posting G-Code to a Haas Controller in VisualCAMc

If you want to learn more about the VisualCAMc Milling plugin for Onshape, check out our Products PageTech Blog and YouTube Channel playlist for what’s new, specifications, videos, tutorials and more.

For a more personalized overview, join me and Onshape’s Joe Dunne at 1 p.m. (EST) on Tuesday, September 12, for a live demonstration of VisualCAMc. We will demonstrate 2-1/2 & 3 axis milling, drilling, toolpath verification, post-processing and more. Sign up for this free webinar below!

Production Machining in the Cloud
Tuesday, September 12 at 1PM (EST)
In this webinar, you’ll learn how VisualCAMc, the world’s first full-cloud production-level CAM tool, works with Onshape.

Add Your Heading Text Here

Lorem ipsum dolor sit amet, consectetur adipiscing elit. Ut elit tellus, luctus nec ullamcorper mattis, pulvinar dapibus leo.

Add Your Heading Text Here

Lorem ipsum dolor sit amet, consectetur adipiscing elit. Ut elit tellus, luctus nec ullamcorper mattis, pulvinar dapibus leo.

Don LaCourse

Don LaCourse

Don LaCourse is an Application Engineer with MecSoft Corporation. Don brings over 20 years of experience in CAD/CAM operations in both automotive and mold design applications. Don also has extensive experience in documenting CAD/CAM products and is actively involved with writing the on-line help as well as creating training tutorials for MecSoft's products.
Shopping Cart