Post Processor System
The format of generated gcode files can be controlled using post processor definitions. These definitions can be created, copied and modified within the Post Processors section of the System tab.
The post processor used for a specific drawing is set under the machining options. Select the machining folder in the drawing tree and look in the Post Processor group of the machining properties. If no post processor is specified, the default post processor will be used.
[New! 0.9.8N]
To set the default post processor, right click the definition in the Post Processors section of the System tab,
then select Set As Default. The default definition will be marked with a green arrow.
Machining Properties
|
This option is a drop down list that contains all the custom post processors defined in the system folder. Leave this blank to use the default post processor. |
|
This option is used to pass user defined macros from the drawing to the post processor. This is a multi-line text field containing multiple macro definitions in the format $macro=value.
Example: |
Post Processor Management
The list of available post processors is accessed from the Post Processor folder of the system tab. Here, post processor definitions can be created, modified, copied, renamed and deleted.
New post processors can be created via the context menu visible when right clicking the post processor folder. Alternatively, existing definitions can be copied, pasted then modified. This is a good way of creating variations of a working post processor.
If post processor files are modified or new ones created outside of CamBam or in another CamBam instance, the post processor list should be refreshed using the Tools - Reload Post Processors menu option.
Post processors are XML files with a .cbpp file extension, stored in the \post sub folder of the system folder.
Install a post processor downloaded from the Internet
- If necessary, unzip the file to obtain a xxx.cbpp file
- In CamBam, menu Tools/Browse System Folder to open the location of the “system” of CamBam.
- Copy your .cbpp file into the post folder of the “system” of camBam
- Use the Tools/Reload Post Processors menu to add it to the list of available post processors (or restart CamBam)
Post Processor sections
The post processor definition contains a number of sections. Each section can contain a mixture of literal text, which is output to the destination gcode file directly, and text macros of the format {$macro}.
The macro definitions are defined within other sections of the post processor, or by defining user macros in the
Note: If any of the following sections are not visible in the property editor, make sure the Advanced property view button is selected.
(Main) - Post File
This section defines the general structure of the gcode file. It typically includes three macros that are evaluated internally based on rules defined in further sections of the post processor.
{$header} - This macro is evaluated using the
{$mops} - This macro is evaluated to a list of blocks of text, one block per each machining operation. Each block is formatted using the rules in the
{$footer} - This macro is evaluated using the
Example:
%
O{$o}
( MY FANUC POST )
{$header}
G0 X10Y10Z0
{$mops}
{$footer}
%
Note: The value of {$o} macro is passed to the post processor using the drawing’s
Post Processor Macros property which may contain a value such as ‘$o=1234’.
The % characters are output literally and would be omitted if not using an RS232 file transfer program.
(Main) - Header
Defines the text rules used by the {$header} macro.
Example:
{$comment} {$cbfile.name} {$date} {$endcomment}
{$tooltable}
{$comment} CUTVIEWER {$endcomment}
{$comment} FROM/0,0,5 {$endcomment}
{$comment} TOOL/MILL,1,0,20.0,0 {$endcomment}
{$comment}STOCK/BLOCK,{$stock_width},{$stock_length},
{$stock_height},{$stock_x},{$stock_y},{$stock_z} {$endcomment}
{$cbfile.header}
{$units} {$distancemode} {$velocitymode} {$cuttercomp(off)}
{$toolchange(first)}
G54 ( Use fixture 1 )
{$clearance}
Once again, the
$stock_length=150
$stock_width=150
$stock_height=12.7
$stock_x=75
$stock_y=75
$stock_z=12.7
(Main) - Footer
Defines the text rules used by the {$footer} macro.
Example:
{$clearance}
G28 G91 Z0
G90 G53 X-15.0 Y0.0
M09
{$spindle(off)}
{$endrewind}
(Main) - MOP
Defines how each item of the {$mops} macro is formatted. This information will be repeated in the gcode output for each active machining operation.
Example:
{$comment} {$mop.name} {$endcomment}
{$toolchange}
{$velocitymode} {$workplane}
{$mop.header}
{$spindle} {$s}
{$blocks}
{$mop.footer}
(Main) Start Cut
[New! 0.9.8L]
Macro to use when about to feed cut. This may be used for plasma or laser cutters to power on the cutting tool.
The start of cutting is determined when a feed move is detected where Z is below the stock surface.
(Main) End Cut
[New! 0.9.8L]
Macro to use when finished a feed cut. This may be used for plasma or laser cutters to power off the cutting tool.
The end of cutting is determined when a rapid is detected or a feed move where Z is at or above the stock surface.
For example, to power off a laser to avoid holding tabs, use square holding tabs and set the holding tab height so that the
top part of the tab move is above the stock surface. The
(Main) Post Processor Macros
[New! 0.9.8N]
This property can be used to set default values for any custom macros used in the post processor.
Custom macro values will be overridden by the values set in the
Tools - Tool Table Item
Defines how each item of the {$tooltable} macro is produced. Tool tables are typically inserted in the header of a file and contain commented text describing the list of tools that will be used in the gcode file.
Example:
{$comment} T{$tool.index} : {$tool.diameter} {$endcomment}
Tools - Tool Change
Defines how the {$toolchange} macro is formatted.
Example:
{$clearance}
{$comment} T{$tool.index} : {$tool.diameter} {$endcomment}
{$comment} Tool Radius and Taper coming soon {$endcomment}
{$comment} TOOL/MILL, {$tool.diameter}, {$tool.radius},
{$tool.length}, 0 {$endcomment}
T{$tool.index} M6
G Codes - G0, G1, G2, G3, G81, G82, G83
These sections define how the commonly used gcode operators are output.
G Codes - Arc Center Absolute
Used in the {$mop.header} macro to specify that ArcCenterMode is set to Absolute. Mach3 recognizes G90.1
G Codes - Arc Center Incremental
Used in the {$mop.header} macro to specify that ArcCenterMode is set to Absolute. Mach3 recognizes G91.1
G Codes - Canned Cycle Start
[New! 0.9.8h]
Code sequence used at the start of a group of canned cycle blocks. Typically G98 for initial level return after canned cycles.
G Codes - Canned Cycle End
[New! 0.9.8h]
Code sequence used at the end of a group of canned cycle blocks. Typically G80.
G Codes - Cutter Comp Off, Cutter Comp Left, Cutter Comp Right
[New! 0.9.8h]
Used in the {$cuttercomp(off|L|R)} macros. Typically Off=G40, Left=G41, Right=G42.
G Codes - Distance Absolute, Distance Incremental
[New! 0.9.8h]
Typically absolute=G90, incremental=G91. NOTE! Incremental distance mode is not currently supported.
G Codes - Units (Inches), Units (Metric)
[New! 0.9.8h]
Typically inches=G20, millimeters=G21.
G Codes - Velocity Mode - ExactStop, Velocity Mode - Constant Velocity
[New! 0.9.8h]
Typically exact stop=G61, constant velocity=G64.
G Codes - Workplane XY, Workplane XZ, Workplane YZ
[New! 0.9.8h]
Typically XY=G17, XZ=G18, YZ=G19.
G Codes - X Mode Diameter
Used in the {$lathexmode} macro to specify that X values are in diameter mode. For example; EMC2 recognizes G7.
G Codes - X Mode Radius
[New! 0.9.8h]
Used in the {$lathexmode} macro to specify that X values are in radius mode. For example; EMC2 recognizes G8.
M Codes - End Rewind
Typically M30.
M Codes - Repeat
[New! 0.9.8h]
Typically M47.
M Codes - Spindle CW, Spindle CCW, Spindle Off
[New! 0.9.8h]
Typically CW=M3, CCW=M4, Off=M5.
M Codes - Stop
[New! 0.9.8h]
Typically M0.
Moves - Rapid, Feed Move, Arc CW, Arc CCW
These sections define how the commonly used gcode move instructions are formatted.
Example:
{$g0} {$_f} {$_x} {$_y} {$_z} {$_a} {$_b} {$_c}
{$_g1} {$_f} {$_x} {$_y} {$_z} {$_a} {$_b} {$_c}
{$g2} {$_f} {$_x} {$_y} {$_z} {$i} {$j}
{$g3} {$_f} {$_x} {$_y} {$_z} {$i} {$j}
Note: The gcode operators {$g…} and their parameters can specified using an underscore ( _ ) prefix. This is to show values that are modal (or sticky). That is, they will only be output if the current value has changed. Omitting the underscore will force the parameter to be always output.
Canned Cycles - Drill, Drill Dwell, Drill Peck
These sections define how the commonly used canned cycle instructions are formatted.
{$g81} {$_x} {$_y} {$_z} {$_r} {$_f}
{$g82} {$_x} {$_y} {$_z} {$p} {$_r} {$_f}
{$g83} {$_x} {$_y} {$_z} {$p} {$_q} {$_r} {$_f}
Lathe - Lathe Tool Radius Offset
If
If
The direction of the Z tool radius offset is determined by the cut direction.
For right hand cuts the toolpath Z will be offset by a negative tool radius. For left hand cuts, a positive tool radius Z offset is used.
In the diagram above, the red cross represents the toolpath reference point when
Lathe - Lathe X Mode
For lathe operations, specifies whether X values are radius or diameter mode.
Line Numbering
[New! 0.9.8N]
Line Numbering - Add Line Numbers
If
Line Numbering - Line Number Format
Controls how the line number values are presented. ‘0’ characters denote a place holder that will contain either a significant digit or a 0. A ‘#’ character will output a significant digit or space character where there is no significant digit at that position.
Line Numbering - Line Number Increment
Line numbers will be incremented by this amount each time a line number is added.
Line Numbering - Line Number Prefix
This text (typically an ‘N’ character) will be written before the line number value.
Line Numbering - Line Number Skip
Lines where the first non space character is in this list will not receive a line number.
Line Numbering - Line Number Space After
If
Line Numbering - Line Number Start
The initial for the first line number used.
Options - Arc Output
Controls how arcs are output to gcode.
If
Helix Convert To Lines is similar to
Options - Arc Center Mode
[New! 0.9.8N]
This property controls whether the I and J parameters for arc moves (G2, G3) use absolute coordinates or incremental, relative to the arc end points.
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.
Default When default is set in the drawing’s machining properties, the post processor Arc Center Mode will be used.
A default value in the post processor will use
Absolute I & J are absolute coordinates of the arc center point.
Incremental (C-P1) I & J are coordinates of the arc center, offset from the first arc point. This is the typical incremental mode.
In previous versions this option was just called
Incremental (P1-C) I & J are offsets of the first arc point from the arc center.
Incremental (C-P2) I & J are arc center offsets from the second arc point.
Incremental (P2-C) I & J are offsets of the second arc point from the arc center.
Options - Arc To Lines Tolerance
If
Options - Clearance Plane Axis
Used to specify which direction clearance moves are made. Usually Z, but may be set to X or Z for lathe operations.
Options - Comment, End Comment
Defines the text to be used at the beginning and end of a comment.
Example 1:
Comment: (
End Comment: )
Example 2:
Comment: ;
End Comment:
Options - End Of Line
[New! 0.9.8h]
Character sequence used at the end of a line. Escape code \r and \n can be used.
Options - Invert Arcs
Controls the behaviour of XZ (G18) arcs only.
For milling operations, this should be set
For lathe operations, this should usually be set
Note: Coordinate handedness can be determined by pointing your thumb in the direction of positive X, second finger in the positive Y axis and third (middle) finger in the positive Z axis direction.
Options - Minimum Arc Length
A numerical value that controls the precision limits used for outputting arc moves (G2, G3). If the length of an arc is less than the
This is useful for TurboCNC users where very small arcs can cause glitches that may appear as dimples in the toolpath.
Example:
Minimum Arc Length: 1e-4
Options - Maximum Arc Radius
A numerical value that controls the maximum radius allowed for arc moves. If an arcs radius exceeds this value, a straight line move (G1) is used.
Example:
Maximum Arc Radius: 1e6
Options - Number Format
This is a string formatting pattern that controls how floating point numbers are displayed.
A hash character (#) denotes an optional digit place holder and a 0 character denotes a digit that is always displayed, adding padding zeros if required.
It can also change the gcode instructions that are required. For example, if a toolpath contains a move from X=1.234 to X=1.233 and a number format of #.#0 is used, no move instruction will be written to the gcode as the coordinates are identical when formatted to 2 decimal places.
Options - Rapid Down To Clearance
[New! 0.9.8i]
If set
If
Options - Suppress Parser Errors
[New! 0.9.8L]
The post processor will parse gcode as it is created to update internal values such as registers. This can produce error messages for post processors that produce
non-standard gcode. In many cases the gcode will still be correctly generated and the error messages can be ignored.
Setting
Options - Upper Case
If set to
Post Build - Post-Build Command and Post-Build Command Args
[New! 0.9.8j]
Post-Build Command can be used to specify an external application to modify the gcode produced from the post processor.
Post-Build Command Args contains any arguments to pass to the application.
The following macros are recognised:
{$outfile} is the filename of the raw gcode output.
{$cbfile.name} is the short name of the current CamBam document.
Note: Double quotes should be used in command arguments to avoid problems with spaces in filenames.
Example:
Post-Build Command: C:\bin\gcodelinenums.exe
Post-Build Command Args: "{$outfile}" "{$outfile}.out"
Rotary
[New! 1.0]
Rotary - Axis Of Spin
The axis about which the stock is rotated.
Rotary - Rotary Axis
The rotary (4th) axis letter.
Rotary - Rotary Wrap
If True, allow Gcode to be ‘wrapped’ about a rotary axis.
If Rotary Wrap is set to True, the post processor will convert all toolpaths to lines only, then wrap all the toolpaths selected around the rotary axis.
The radius of rotation is taken from each machining operations Stock Surface property. It is up to the user to make sure the toolpath is within a width of 2 x PI x stock surface.
Note: The post-processor should also be modified so as not to output the axis registers for the non rotational axis. For example, if rotating about the Y axis, the X{$x} move parameters should not be output.
see post processors RotaryX.cbpp and RotaryY.cbpp in the CamBam post folder
Post Processor Macros
[New! 0.9.8L] |
Outputs the I, J or K register value of the current arc move. The register 'I', 'J' or 'K' prefix is not output. |
[New! 0.9.8L] |
Outputs the radius of the current arc move. Arcs that sweep 0 to 180 degrees will have a positive radius and arc sweeps > 180 to 360 degrees will output a negative radius. |
[New! 0.9.8N] |
Outputs the start, end or sweep angle of the current arc move. Angles are measured in degrees, with 0 degrees along +X axis. CCW arcs will have a positive sweep angle. CW arcs will have a negative sweep angle. |
|
Outputs Arc Center Absolute (typically G90.1) or Arc Center Incremental (typically G91.1) depending of the Arc Center Mode selected |
|
This macro is generated internally and contains all the move instructions required by the current machine operation (MOP)'s. |
|
Inserts the text defined in the |
|
Inserts the drawing’s |
|
Inserts the drawing’s |
|
Inserts the drawing’s |
|
Generated internally, this macro checks the x,y,z coordinate parameters against the current tool location. If different, a sequence of moves will be inserted to move to the new position, using the clearance plane and plunge feed rates where necessary. |
|
Rapids to the clearance plane. |
|
Cutter radius compensation. Note: CamBam does not currently calculate radius compensation codes for toolpaths. Inserts the text defined in the Typically Off=G40, L=G41, R=G42 |
|
Inserts the current date time stamp |
|
Inserts the distance mode in use. The values are defined in the Currently this always equates to |
|
Inserts the text defined in the |
|
Inserts the text defined in the Typically M30. |
|
Evaluates the text in the |
|
These Gcode macros control how the gcodes are output. The format of each code is taken from the If the underscore (_) prefix is used, these instructions are assumed to be modal (or sticky). That is; the first occurrence of the code will be written but omitted if following blocks use the same instruction. |
|
Evaluates the text in the |
[New! 0.9.8L] |
Outputs the |
[New! 0.9.8L] |
Outputs the The 'F' register code prefix is not output. |
[New! 0.9.8L] |
Outputs the |
[New! 0.9.8L] |
Outputs the |
[New! 0.9.8N] |
Insert the X, Y or Z coordinate of the first toolpath point of the current machining operation. This macro may be useful after a tool change command, to move to the next machining X, Y coordinate at the tool change height, before plunging to the clearance plane. |
|
Inserts the current machining operation's |
|
Inserts the current machining operation's |
[New! 0.9.8L] |
Outputs the |
|
Inserts the current machining operation's |
[New! 0.9.8L] |
Outputs the |
[New! 0.9.8L] |
Outputs the The 'F' register code prefix is not output. |
[New! 0.9.8L] |
Outputs the |
[New! 0.9.8L] |
Outputs the |
[New! 0.9.8L] |
Outputs the |
[New! 0.9.8L] |
Outputs the |
[New! 0.9.8L] |
Outputs the X, Y or Z register value of the current move. The register code is not output. |
|
Inserts a list of objects, one item for each enabled machining operation. Each list item is defined using the |
|
Inserts the name of the current part. |
[New! 0.9.8N] |
Inserts the post processor tool change macro. This may be useful to include in the tool definition |
|
Inserts the text defined in the Typically M47. |
|
Inserts the current machining operation's |
[New! 0.9.8L] |
Sets the current value of the specified X, Y or Z register. No gcode will be output. Example:
$set(z,5.5) This may be useful after a custom, controller based tool change macro, to inform the post processor of the controller's new coordinates. The value NaN can also be used to set the register to an undefined state. |
|
Inserts a macro depending on the current machine operation's Nothing will be written to the gcode if the spindle is already in this state. |
|
Inserts the text defined in the Typical values are cw=M3, ccw=M4, off=M5 |
|
The X size of the stock block defined in the Machining or Part object. Example: (For CutViewer STOCK definition) {$comment} STOCK/BLOCK,{$stock_width},{$stock_length},{$stock_height},{$stock_x},{$stock_y},{$stock_z} {$endcomment} |
|
The Y size of the stock block defined in the Machining or Part object. |
|
The Z size of the stock block defined in the Machining or Part object. |
|
The X coordinate of the lower left corner of the stock block (relative to the machine's XY(0,0)), defined in the Machining or Part object. |
|
The minus X coordinate of the lower left corner of the stock block (relative to the machine's XY(0,0)), defined in the Machining or Part object. |
|
The Y coordinate of the lower left corner of the stock block (relative to the machine's XY(0,0)), defined in the Machining or Part object. |
|
The minus Y coordinate of the lower left corner of the stock block (relative to the machine's XY(0,0)), defined in the Machining or Part object. |
|
The minus Z coordinate of the lower left corner of the stock block (relative to the machine's XY(0,0)), defined in the Machining or Part object. |
|
Inserts the text defined in the Typically M0. |
[New! 0.9.8N] |
Inserts the |
|
Inserts the current machining operation's Note: The $tool.diameter macro will not be defined until there has been a tool change command.
If used in the header section, use a tool change such as |
|
Inserts the current machining operation's |
|
Inserts the tool length property from the tool definition in the tool library. |
[New! 0.9.8N] |
Inserts the current tool's |
[New! 0.9.8L] |
Inserts the |
|
Uses the current machining operation's |
[New! 0.9.8N] |
Inserts the current tool's |
|
Inserts a tool change instruction, based on the If the tool number has not changed, no tool change code is inserted. |
|
Inserts a tool change instruction using the first tool in the current drawing's tool table. |
|
Inserts a description for each tool that is referenced in the current drawing. Each item in the list is formatted using the |
|
Outputs the drawing's The codes used are taken from the Typically Inches = G20, Millimeters = G21. |
|
Inserts the current machining operation's The codes used are taken from the For example: Mach3 uses Exact Stop=G61, Constant Velocity=G64. |
|
Inserts the current machining operation's The codes used are taken from the Typically XY=G17, XZ=G18, YZ=G19. |
|
These macros insert the parameters used in common Gcode move operations. These macros will include the register code as well as the value, for example $x = X1.23 |
[New! 0.9.8h] |
The same as the other register macros ($x, $_y etc), but with the value sign reversed. |
[New! 0.9.8h] |
The same as the other register macros ($x, $_y etc), but with the value always positive. |