The APT post-processor is a Windows console application.  The command line syntax is:

          postp[.exe] path_to_folder_containing_cl.tap

where [.exe] is optional.  The result of the post-processing is sent to STDOUT, so to redirect the output to a file use the following syntax:

          postp[.exe] path_to_folder_containing_cl.tap > output_file_path

For example, to post-process cl.tap when it is in the current folder and redirect the output to endplate.tap:

          postp . > endplate.tap


AUXFUN
CLEARP
CLRSRF
COOLNT
CUTCOM
CYCLE
DELAY
DELETE
DWELL
END
FEDRAT
GOHOME
INSERT
LETTER
LOADTL
MACHIN
MODE
OPSKIP

OPSTOP
ORIGIN
PARTNO
PPRINT
PREFUN
RAPID
RESET
RETRCT
REWIND
ROTABL
SELCTL
SEQNO
SPINDL
STOP
THREAD
TMARK
TOOLNO
TRANS
TURRET


AUXFUN
AUXFUN/m        Outputs an M-code with the value m in a new block.
AUXFUN/m,NOW    Outputs an M-code with the value m in a new block.
AUXFUN/m,NEXT   Places an M-code with the value m in the next block.

Example: AUXFUN/99,NOW

Use this command only when a post-processor command is not available for this M-code.  The post-processor does not verify the validity of the M-code.


CLEARP
CLEARP/(PLANE/a,b,c,d)    Plane by coefficients a, b, c and d.  Example: CLEARP/(PLANE/0,0,1,3.5)
CLEARP/name               Previously defined and named plane.  Example: CLEARP/PL1
CLEARP/XYPLAN,d           Plane parallel with the XY plane at distance d.  Example: CLEARP/XYPLAN,3.5
CLEARP/YZPLAN,d           Not valid for this implementation.
CLEARP/ZXPLAN,d           Not valid for this implementation.
CLEARP/x,y,z,d
            Plane by coefficients a, b, c and d.  Example: CLEARP/0,0,1,3.5
CLEARP/OFF                Cancels the current clearance plane.
                                        

This is used in conjunction with RETRCT.  When RETRCT is called the Z-axis is positioned on the plane specified by CLEARP in rapid mode.  If no clearance plane is defined then, by default, the Z-axis retracts to the home position (see RETRCT).

Note: For this implementation the clearance plane must be parallel to the XY plane.


CLRSRF
CLRSRF/(PLANE/a,b,c,d)   
Plane by coefficients a, b, c and d.  Example: CLRSRF/(PLANE/0,0,1,3.5)
CLRSRF/name               Previously defined and named plane.  Example: CLRSRF/PL1
CLRSRF/XYPLAN,d           Plane parallel with the XY plane at distance d.  Example: CLRSRF/XYPLAN,3.5
CLRSRF/YZPLAN,d           Plane parallel with the YZ plane at distance d.  Example: CLRSRF/YZPLAN,3.5
CLRSRF/ZXPLAN,d           Plane parallel with the ZX plane at distance d.  Example: CLRSRF/ZXPLAN,3.5
CLRSRF/a,b,c,d            Plane by coefficients a, b, c and d.  Example: CLRSRF/0,0,1,3.5
CLRSRF/NOW           

This command has two purposes:  1) Define a plane onto which the tool tip will be moved when 2) the NOW parameter is invoked.  The tool tip takes the shortest distance and direction, which follows the vector normal to the plane.

Note: CLRSRF/NOW motion is calculated by the post-processor and is not reflected in the CL file.


COOLNT
COOLNT/MIST          Places an M07 into the next block that contains a Z command.
COOLNT/MIST,NOW      Outputs an M07 in a new block.
COOLNT/MIST,NEXT     Places an M07 into the next block.
COOLNT/FLOOD         Places an M08 into the next block that contains a Z command.
COOLNT/FLOOD,NOW     Outputs an M08 in a new block.
COOLNT/FLOOD,NEXT    Places an M08 into the next block.
COOLNT/ON            Places an M08 into the next block that contains a Z command.
COOLNT/ON,NOW        Outputs an M08 in a new block.
COOLNT/ON,NEXT       Places an M08 into the next block.
COOLNT/OFF           Places an M09 into the next block.
COOLNT/OFF,NOW       Outputs an M09 in a new block.
COOLNT/OFF,NEXT      Places an M09 into the next block.


CUTCOM

CUTCOM/LEFT-RIGHT
CUTCOM/LEFT-RIGHT,n
CUTCOM/OFF

Places the given cutter compensation command into the next block.  LEFT generates G41 and RIGHT generates G42.  OFF cancels cutter compensation and generates G40.  If the numeric offset value "n" is given a D-code (mill) or T-code (lathe) is also included in the block.


DELAY
DELAY/n              Ceases axes motion for "n" seconds.
DELAY/REV,n          Ceases axes motion for "n" revolutions of the spindle.

DELAY and DWELL are synonyms.


DELETE
DELETE/ON-OFF

When DELETE is ON the post-processor places the block skip character "/" at the beginning of each block until DELETE/OFF is called.  DELETE and OPSKIP are synonyms.


DWELL
DWELL/n              Ceases axes motion for "n" seconds.
DWELL/REV,n          Ceases axes motion for "n" revolutions of the spindle.

DELAY and DWELL are synonyms.


END
END retrieves the "END" value from the options file for the defined MACHIN.  The post-processor then writes that value as a new block.  This statement should be placed immediately prior to the FINI statement.


FEDRAT
FEDRAT/n

Sets the feedrate to be used for non-rapid axis movements.  The feedrate implementation by the controller may be dependent upon the mode in effect, such as distance per minute or per revolution of the spindle.


GOHOME
GOHOME retrieves the "GOHOME" value from the options file for the defined MACHIN.  The post-processor then writes that value as a new block.  The motions generated by the GOHOME command
are calculated by the post-processor and are not reflected in the CL file.


INSERT
INSERT alphanumeric string of characters

INSERT writes the "alphanumeric string of characters" beginning in column 7 verbatim as a new block.

LETTER (mill only)
LETTER/x,y,z,dx,r,sx,sy,zc,zr,f,zf
x  = starting position (bottom left of a rectangle drawn around the first character)
y  = starting position (bottom left of a rectangle drawn around the first character)
z  = z height (z position of XY milling plane)
dx = distance between characters
r  = rotation angle; rotation occurs around the starting position of the first character
s  = scaling factor; the default height of letter characters is 1"
zc = z clearance height used in positioning between characters
zr = z rapid position where z plunge at feedrate will begin
f  = milling feedrate
zf = z plunge feedrate
Note: The maximum number of characters (66) in the string to be milled is a limitation of the APT compiler and the PPRINT command.  The motions generated by the LETTER command
are calculated by the post-processor and are not reflected in the CL file.

The LETTER command is used to mill/engrave alphanumeric characters (the letters, numbers and punctuation characters on a standard QWERTY keyboard).  When the LETTER command is processed the string in the next PPRINT command encountered is milled.


LOADTL (mill only)
LOADTL/t            Load tool "t" into the spindle.
LOADTL/t,h          Load tool "t" into the spindle and set the tool height offset to "h".
LOADTL/t,h,d        Load tool "t" into the spindle, set the tool height offset to "h", and set the diameter offset number to "d".

LOADTL generates a new block that contains 1) the tool change command "M06" and 2) the specified tool number.  When "h" and/or "d" are specified they are included in a succeeding tool height offset block which is typically combined with the first Z-axis command following the tool change.  See the description in the options file for further information concerning setting the tool height offset.


MACHIN
MACHIN/name[,0|1|2|3|4|5|6]

The MACHIN statement must be the first statement in the APT program.  It specifies the name of the target controller.  The optional numeric parameters specify 4 or 5 axis types (see below).  Valid names are "ACORNM" (mill), "ACORNL" (lathe), "FANUCM" (mill), "FANUCL" (lathe), "HAASM" (mill), "HAASL" (lathe), "TORMM" (mill), and "TORML" (lathe).

4 and 5 axis types (mill only):
0 = None (this is the default if the axis parameter is not specified)
1 = 4 axis (A)
2 = 4 axis (B)
3 = 5 axis tilting/profiling head (A and B axes)
4 =
5 axis dual rotary (A and B axes)
5 =
5 axis dual rotary (A and C axes)
6 =
5 axis dual rotary (B and C axes)

Note:  5 axis type 3 requires that all CUTTER statements contain the height component while MULTAX is in effect.  The height component is the sum of the spindle pivot distance plus the tool gauge length.


MODE
MODE/n              Sets the given positioning mode "n" in a new block (see note).
MODE/n,NOW          Sets the given positioning mode "n" in a new block (see note).
MODE/n,NEXT         Places the given positioning mode "n" into the next block (see note).

MODE sets the axis positioning mode to absolute (G90) or incremental (G91).  Valid values for "n" are 90 for absolute and 91 for incremental.

Note:  When supported, for lathes no G-code is output and the axis commands are converted from X to U and from Z to W.


OPSKIP
OPSKIP/ON-OFF

When OPSKIP is ON the post-processor places the block skip character "/" at the beginning of each block until OPSKIP/OFF is called.  DELETE and OPSKIP are synonyms.


OPSTOP
Outputs an M01 in a new block.


ORIGIN
ORIGIN/n         Places a work coordinate system command in the next block that contains an X or Y command.
ORIGIN/n,NOW     Outputs 
a work coordinate system command in a new block.
ORIGIN/n,NEXT    Places 
a work coordinate system command in the next block.

The parameter "n" specifies the work coordinate system (WCS) G-code command to be used.  Typically machine controllers support 6 WCS commands: G54 through G59.  For machine controllers that optionally support more than 6, use a decimal value for "n".  For example, for ORIGIN/54.3 the post-processor will output a WCS command using the "P" syntax: G54P3 in this example.


PARTNO
PARTNO alphanumeric string of characters

PARTNO writes the "alphanumeric string of characters" verbatim as a comment in a new block.  PPRINT is a synonym for PARTNO.


PPRINT
PPRINT alphanumeric string of characters

PPRINT writes the "alphanumeric string of characters" verbatim as a comment in a new block.  PARTNO is a synonym for PPRINT.


PREFUN
PREFUN/g        Outputs a G-code with the value g in a new block.
PREFUN/g,NOW    Outputs a G-code with the value g in a new block.
PREFUN/g,NEXT   Places a G-code with the value g in the next block.

Example: PREFUN/99,NOW

Use this command only when a post-processor command is not available for this G-code.  The post-processor does not verify the validity of the G-code.


RAPID
RAPID moves the axes at the maximum rate by outputting a "G00" G-code.  In an APT program RAPID is only in effect for the next positioning statement.  That is, it is not a modal command like in the machine controller so RAPID must be specified for each APT positioning statement as needed.


RESET
RESET outputs the safe startup string
specified by the "startup" property in the options file for the defined MACHIN.


RETRCT (mill only)
RETRCT is used in conjunction with CLEARP.  When RETRCT is called the Z-axis is positioned on the plane specified by CLEARP in rapid mode.  
If no clearance plane is defined then, by default, the Z-axis retracts to the home position.  The default action can be overridden via the "retractz" value in the options file for the defined MACHIN.  
The motions generated by the RETRCT command are calculated by the post-processor and are not reflected in the CL file.


REWIND
REWIND retrieves the "REWIND" value from the options file for the defined MACHIN.  The post-processor then writes that value as a new block.
 This statement should be placed immediately prior to the FINI statement.


ROTABL (mill only)
CAUTION!  The implementation of this command is theoretical.  It has not been tested on any machine controller.  The user should assume that unexpected results will probably occur.  Use extreme caution and report any problems.  Be safe and do not crash your machine!

ROTABL/AAXIS-BAXIS-CAXIS,ATANGL-INCR,a[,CLW-CCLW][,NEXT-NOW]    Format 1
ROTABL/LINEAR,AAXIS-BAXIS-NOMORE[,RADIUS,r]                     Format 2

The ROTABL statement has 2 formats.  The first format rotates the specified 4th axis to the given absolute angle or rotates it the given incremental number of degrees.  The second format implements cylindrical mapping which converts linear movements to rotational about the mapped axis.

Format 1:
AAXIS-BAXIS-CAXIS specifies the rotary axis.

ATANGL specifies that the rotary distance is in absolute degrees.

INCR specifies that the rotary distance is in incremental degrees.  The post-processor performs the necessary addition or subtraction to generate the axial command in absolute degrees.
 Note:  All axial commands are generated in absolute degrees.

The angular distance is specified in "a".  The sign of "a" controls the direction of rotation.  Positive rotation is defined as a clockwise (CLW) rotation when looking parallel along the rotational centerline from the positive axis towards the negative axis.

CLW-CCLW controls the direction of rotation:  clockwise or counter-clockwise.  If CLW or CCLW is specified then the sign of "a" will be ignored and the rotation will be in the direction specified.

NEXT specifies that the axial command is to be merged into the next block.
NOW specifies that the axial command is to be output in a new block.

Format 2:
LINEAR specifies that cylindrical mapping is to be done.  By default, using the current Z position of the tool tip the post-processor converts linear movements to rotational.  This is done by calculating the circumference of a cylinder whose radius is equal to the current Z height and then converting linear distances to rotational degrees.  It is assumed that Z zero is the centerline of the rotary axis.  The tool must be positioned on the X centerline (AAXIS) or Y centerline (BAXIS) as appropriate.

AAXIS-BAXIS-NOMORE controls the axis to be mapped.  AAXIS specifies that X-axis commands are to be mapped to A-axis rotations.  BAXIS specifies that Y-axis commands are to be mapped to B-axis rotations.  NOMORE cancels cylindrical mapping.

RADIUS specifies that the current Z position of the tool tip is not to be used and instead the cylindrical radius is to be "r".  If RADIUS is not specified then the current Z value is used as the radius of the cylinder.

Note:  
The motions generated by the ROTABL command are calculated by the post-processor and are not reflected in the CL file.


SELCTL
SELCTL/t            Outputs a T-code with the value t in a new block.
SELCTL/t,NOW       
Outputs a T-code with the value t in a new block.
SELCTL/t,NEXT       Places a T-code with the value t in the next block.

TOOLNO is a synonym for SELCTL.


SEQNO
SEQNO/start,INCR,incr,program_number
SEQNO/start,INCR,incr

Example:  SEQNO/1000,INCR,10,9100

The SEQNO statement controls sequence number generation.  Each block that is not a comment, program number or TMARK is prefaced with a sequence number in the form Nn.

The parameter "start" specifies the value of the first sequence number.
The parameter "incr" specifies the amount to increment the sequence numbers from block to block.
The optional parameter "program_number" specifies the program number, i.e. the O-code.


SPINDL
SPINDL/ON        Starts the spindle using the previously specified RPM or SFM, speed and direction.
SPINDL/OFF       Turns the spindle off.
SPINDL/s         Starts the spindle in the clockwise direction at "s" RPM.
SPINDL/s,[RPM-SFM],[CLW-CCLW]    Starts the spindle using the specified speed "s", direction, and RPM or SFM.
SPINDL/s,[RPM-SFM],[CLW-CCLW],MAXRPM,n   
Starts the spindle using the specified speed "s", direction, RPM or SFM, and maximum RPM (lathe only).

Note 1: Constant surface speed (SFM) and maximum RPM apply to lathes only.

Note 2:  The options file contains a "maxspeed" value for lathes.  This option will cause a maximum RPM G-code (G50) and S-code to automatically be output each time the spindle is turned on using constant surface speed.


STOP
STOP outputs a program stop (M00) in a new block.



THREAD (lathe only)
THREAD/pitch,fd,z,dfc,mdc,dlp,pocd,taper,ia,sp

    pitch = thread pitch (1 / threads per unit)
    fd    = finish diameter (minor diameter of external thread, major diameter of internal thread)
    z     = ending Z location
    dfc   = depth of first cut
    mdc   = minimum depth of cut (not used by all implementations but a value must be provided)
    dlp   = depth of last pass (not used by all implementations
but a value must be provided)
    pocd  = pull out chamfer distance (not used by all implementations
but a value must be provided)
    taper = thread taper (signed radius measure, i.e. X start point - X end point)
    ia    = infeed angle (typically 30 or 60; refer to your controller's documentation)
    sp    = number of spring passes (not used by all implementations
but a value must be provided)

Note:  One possible starting point for calculating the finish diameter is: (major diameter) +/- (2 * pitch * .6).

Example for an external 1/2-20:  THREAD/.05,(.5-2*.05*.6),-1.2,.010,.001,.001,0,0,60,3


TMARK
TMARK            Outputs the character specified by the "tmark" property in the options file for the defined MACHIN.
TMARK/n          Outputs the ASCII character specified by the integer parameter "n" (e.g. % is 37, = is 61).


TOOLNO
TOOLNO/t            Outputs a T-code with the value t in a new block.
TOOLNO/t,NOW       
Outputs a T-code with the value t in a new block.
TOOLNO/t,NEXT       Places a T-code with the value t in the next block.

SELCTL is a synonym for TOOLNO.


TRANS
TRANS/dx,dy,dz

Translate all following X, Y and Z coordinates by the specified distances.  Successive TRANS statements are not additive and cancel any translations currently in process.  Note that the translations are done via the post-processor and have no effect on APT compilation.


TURRET (lathe only)
TURRET/t            Rotate the turret to position t using offset number t.
TURRET/t,o          Rotate the turret to position t using offset number o.