Top  Previous  Next

Overview of the Post Processor




The post processor is responsible for converting the toolpath within MeshCAM to a text file description of it.  Because different machine controllers require different formats and parameters it is useful to have a configurable way to convert the toolpath to the correct format.  The post processor in MeshCAM is capable of producing any common format.  It is also mostly compatible with the post processor in MillWizard and ArtCAM.


The post processor requires a configuration file to describe the format of the output.  These configuration files are located in the "Posts" directory under the main program directory.  The configuration files must end with ".con".


The configuration files are plain ASCII files.  They can be edited with Notepad, UltraEdit, or another equivalent editor.  They should not be edited using Word or another word processing program since extra formatting codes are likely to be added to the file. It is best to start with one of the basic configurations and modify it if necessary to suit your needs.  It is not normally necessary to start a new file from scratch.



File Structure

Global Parameters

Global parameters include the output file extension, the description, output units and line numbering information.  In the current implementation only line numbering information is used; the rest is ignored but allowed for compatibility with ArtCAM.


Variable Formats

The format statements instruct MeshCAM how the many variables used should be represented in the output format.


Start and End

These sections define the code to be inserted at the beginning and end of the output file.  These are multi-line statements that can contain several lines of output data to specify parameters such and spindle, coolant, and program start/end codes.


Tool Changes

These statements define what code is inserted into the final file when a tool change is required.


Linear Moves

The linear move statements define how moves with tool engagement should be represented in the output file.  Two lines define this behavior, FIRST_FEED_RATE_MOVE and FEED_RATE_MOVE.  FIRST_FEED_RATE_MOVE is optional and can be omitted if not required for the target machine.  FEED_RATE_MOVE is a required statement and must be present in a valid configuration file.


Rapid Moves

Like linear moves, rapid moves are based on two statements, FIRST_RAPID_RATE_MOVE and RAPID_RATE_MOVE.  Unlike linear move statements, both are optional and can be omitted.  If they are not present then rapid moves will be formatted as linear moves.  In most cases this is not the desired behavior because there is no way to specify a different gcode (G00) for the output.


Variable Format

The FORMAT statement defines variable output.  The syntax is flexible enough to allow just about any output when combined with the linear and rapid statements.  The format is as follows:


FORMAT = [V|O|S|F|m]

V = Variable name

O = Output condition.  If # the variable is only written when changed, if @ the variable is always written.

S = String written before the numeric value.

F = Numeric format string.

m = Scaling factor for the numeric output.  (Optional)


Variable Format Examples


FORMAT = [X|#|X|1.2]

Anywhere [X] appears in the other statements the X coordinate value is inserted.  The value is only written when it changes because of the # condition.  The 1.2 format string causes the numeric values to be written with two decimal places of precision, e.g. if X is 12.345 the output is X12.34.



Anywhere [X] appears in other statements the X coordinate value is inserted.  Because the @ condition is used it is always written even when the value has not changed.  In this case a scaling factor of 25.4 is used.  This causes the numeric value to be multiplied by 25.4 before writing.  If the X value is 12.345 the output is X313.563. The use of a scaling factor can be used to convert from inch to metric or to convert unit to thousandths for machines that require it.


Real world examples can be seen in the configuration files supplied with the program.



Lines beginning with a semicolon are ignored as comments.



The following variables are valid in a configuration file





Current feedrate


Rapid feedrate


Plunge feedrate        


Standard feedrate


Current line number


Tool home position (X)


Tool home position (Y)


Tool home position (Z)        


Tool home position (Rotary angle)


Current line number


Spindle speed        


Safe Z height


Current tool number


Previous tool number


Tool position (X)


Tool position (Y)


Tool position (Z)


Coordinate of arc center (X)


Coordinate of arc center (Y)


Rotary axis angle


Minimum X value


Minimum Y value


Minimum Z value


Maximum X value


Maximum Y value


Maximum Z value


Tool description string        


Output path


Output filename


Machine units (MM or INCH)



Many of the allowed variables are not used in MeshCAM.  They are, however, allowed in the configuration file to maintain compatibility with ArtCAM.  As the post processor matures more of these variables will be supported.



To put all of the above into a complete example, the following is a minimal configuration file:


; This config is the basis for the minimum

; gcode output. If you're looking for

; the shortest file then this is the config

; to start with.


DESCRIPTION = "GCode (*.nc)"



; Feed Rate

FORMAT = [F|#|F|1.1]

; Tool moves in x,y and z

FORMAT = [X|#|X|1.3]

FORMAT = [Y|#|Y|1.3]

FORMAT = [Z|#|Z|1.3]


START = "%"


RAPID_RATE_MOVE        = "G0[X][Y][Z][F]"



FEED_RATE_MOVE         = "[X][Y][Z]"


END = "M30"