Creating GCode

The basic work flow for creating Gcode files is:

Generating and Inspecting Toolpaths

Toolpaths are generated by selecting the Machining - Generate Toopaths menu item, Pressing CTRL+T, or by right clicking on individual machining operations in the drawing tree and selecting Generate Toolpath from the context menu.

Viewing Toolpaths

CamBam provides a 3D drawing view. Rotate the view (using ALT+Drag) to see more detail of the toolpaths including the different depth levels.

The toolpaths indicate the path that will be travelled by the central tip of the cutting tool. Different colors are used to differentiate straight line moves and arc moves. Small arrows indicate the cutting directions. Rapids are displayed using dotted red lines.

There are a number of settings which control the appearance of the toolpaths.

By selecting the Machining folder in the drawing tree a number of options are available under the Toolpath Visibility group of the machining properties.

Note: These options are stored within the drawing file. Default settings for new drawings can be set in the DrawingTemplate file.

Toolpaths can be shown or hidden using the View - Show Toolpaths top menu and context menu options.

Showing cut widths

Setting the machining option ShowCutWidths=True is a useful way of seeing the areas of stock that will cleared.
Note: This option currently is only accurate when viewed in the XY plane.

Creating Destination Gcode File

Once the machining operations have been correctly defined and inspected, a Gcode file can be produced to send to the CNC controller. This is done by selecting the Machining - Produce Gcode menu option.

If a gcode file has not been previously created, a destination file location prompt is displayed.

The gcode filename is stored and can be changed by selecting the machining object in the drawing tree and changing the OutFile property under the Destination group of the machining properties. Selecting the OutFile value will cause a [...] button to appear which can be used to open a file browser.

A default filename is suggested by appending the default Gcode file extension to the current filename. Under Tools - Options, Gcode Generation there is a setting called DefaultGCodeExtension which is used to set the file extension.

Often it is useful to be able to create Gcode from a single machining operation. This is particularly useful for new designs, where each machining step can be exported and tested separately. To do this, right click a specific machining operation in the drawing tree and select Create Gcode File from the context menu.

Machining Options

Each CamBam drawing can define a number of machining options that control how toolpaths are generated and displayed, as well as how gcode output is produced.

ArcCenterMode

Incremental | Absolute

This property controls whether the I and J parameters for arc moves (G2, G3) use absolute coordinates or relative to the X,Y parameters. If this setting is different to the way the CNC controller interprets arc moves, the resulting toolpath may look a mess of random arcs in the controller.

ArcOutput

Normal | ConvertToLines

If set to Normal, toolpath arcs are output using G2 and G3 moves. Some CNC controllers may not recognise the way these moves are formatted, so setting this to ConvertToLines will output a sequence of line moves G1.

A better solution is to now use the post processor system to define arc moves to be compatible with the target system as rapid sequences of small line moves can cause problems with some CNC controllers.

ArcOutputAllAxis

True | False

If False, the arc X,Y,Z parameters are treated as modal. That is they may be omitted if the coordinate are unchanged from the previous arc move. True will always output these parameters.

This property is overridden by the arc definitions in the selected post processor.

CustomFileFooter

This text is inserted at the end of the gcode output. It can contain multiple text lines or pipe characters '|' to denote new lines. It can also contain $macros. Common available macros are described in the post processor section.

CustomFileHeader

This text is inserted at the beginning of the gcode output. It can contain multiple text lines or pipe characters '|' to denote new lines. It can also contain $macros. Common available macros are described in the post processor section.

DistanceMode

Absolute | Incrememental

This value is currently only used when interpreting gcode. Gcode generated by CamBam will currently always use Absolute (G90) distance mode for X,Y and Z coordinates.

FastPlungeHeight

This value is used when moving down to the stock surface or next cutting level. If set to 0 (the default), the current machining operation's PlungeFeedrate is used (which can be painfully slow). If a non zero FastPlungeHeight is specified, a rapid move is used (G0) to the specified height above the stock. This can significantly improved cutting times in some files. A typical example might be 0.1 or Metric or 0.004 for Inches.

NumberFormat

Controls how decimal numbers are output to the gcode file. This property is overridden by the NumberFormat specified in the selected post processor. See the Post Processor section for more information.

OutFile

This is location of the desintation gcode file. Clicking the [...] button to the right of this property will open a file browser.

PostProcessor

A selection from a drop down list which contains a list of all the post processors available. The post processor controls how the gcode files are formatted and are user configurable using XML based post processor files.

PostProcessorMacros

This is a text field containing multiple macro definitions (one per line), of the format $macro=value. These macros can be used by the selected post processor and are a handy way of passing parameters from the drawing to the post processor.

ShowCutWidths

True | False.

Show cut widths will shade the areas that will be cut. This feature currently only works when the drawing view has not been rotated. It should be easy to spot any areas that are not shaded and will therefore have stock remaining.

ShowDirectionVector

True | False.

Controls the visibility of a small arrow at the start point of each toolpath that indications the direction of machining.

ShowRapids

True | False.

Controls the visibility of a dashed line that indicates rapid moves from one toolpath to the next.

NOTE: Rapids are currently only displayed within each machining operation. Rapids from one machining operation to the next are not yet shown but should be in the next release.

ShowToolpaths

True | False.

Shows or hides the toolpaths. This is the same as using the View - Show Toolpaths menu option.

ToolpathLayerShow

Top | All

This is a legacy option that will be removed in coming releases.

ToolpathVisibility

All | SelectedOnly

When there are a lot of machining operations, it can get visually confusing as to which toolpath belongs to which machining operation. By setting ToolpathVisibility to SelectedOnly, only the toolpaths for the machining operation selected in the drawing tree are visible.

VelocityMode

ConstantVelocity | Default | ExactStop

Controls the use of G61 and G64 commands in gcode output.

This global velocity mode setting can be overridden by individual machine operations. For example it may be useful to have a global value of ConstantVelocity set for the drawing and use ExactStop for finishing machine operations.

If Default is used, no velocity mode gcode is written (or the global velocity mode is used for machining operations).

Constant velocity, sometimes referred to as 'Look Ahead', is a useful feature implemented in some CNC controllers so that motion is smoothed between control points. This is particularly useful with geometry that involves a sequence of many small movements, often trying to approximate a natural shape. The downside is a potential loss of accuracy.

Copyright (c) 2017 HexRay Ltd