Skip to main content
Skip table of contents

Macro Programming

Background

Pathpilot is able to use parameterized and expression based programming in place of or with common G code commands. Two recommended resources on use of macro programming in Pathpilot are: the LinuxCNC documentation on G code syntax (http://linuxcnc.org/documents/ ) and the operator’s manual for your machine. Tormach makes every effort to maintain compatibility with LinuxCNC operation and the significant majority of our changes only add new functionality, however compatibility cannot be guaranteed and is at the sole discretion of Tormach.

This article is intended to detail a number of the additions to macro programming that Tormach has made from that of LinuxCNC.

Parameters

Tormach has created new named parameters that can be used in G code programs, their name and functions are listed here.

Parameter Name

Function

Read/Write

#<_epochtime>

Returns the number of seconds that have elapsed since 00:00:00 UTC Jan 1 1970 as a floating point value

R

#<_motion_mode>

Returns the G value multiplied by 10 of G1/G2/G3/G5.2/G73/G80/G82/G83/G86/G87/G88/G89 (eg, G83 equals 830)

R

#<_plane>

Returns the G value multiplied by 10 of G17/G18/G19/G17.1/G18.1/G19.1 (eg, G18.1 equals 181)

R

#<_ccomp>

Returns the G value multiplied by 10 of G40/G41/G42 (eg, G40 equals 400)

R

#<_ccomp_diameter>

Returns the diameter applied by cutter compensation, equivalent to parameter #5410

R

#<_metric>

Returns 1 if G21 is on

R

#<_imperial>

Returns 1 if G20 is on

R

#<_absolute>

Returns 1 if G90 is on

R

#<_incremental>

Returns 1 if G91 is on

R

#<_inverse_time>

Returns 1 if G93 is on

R

#<_units_per_minute>

Returns 1 if G94 is on

R

#<_units_per_rev>

Returns 1 if G95 is on

R

#<_work_offset_number>

Returns 1-500 for the currently active work offset equivalent to G54.1 P#

R

#<_tool_offset>

Returns 1 if G43 is on

R

#<_retract_r_plane>

Returns 1 if G98 is set

R

#<_retract_old_z>

Returns 1 if G99 is set

R

#<_work_offset_x>

Returns the G53 X axis offset for the current work coordinate

R

#<_work_offset_y>

Returns the G53 Y axis offset for the current work coordinate

R

#<_work_offset_z>

Returns the G53 Z axis offset for the current work coordinate

R

#<_work_offset_a>

Returns the G53 A axis offset for the current work coordinate

R

#<_work_offset_b>

Returns the G53 B axis offset for the current work coordinate

R

#<_work_offset_c>

Returns the G53 C axis offset for the current work coordinate

R

#<_work_offset_u>

Returns the G53 U axis offset for the current work coordinate

R

#<_work_offset_v>

Returns the G53 V axis offset for the current work coordinate

R

#<_work_offset_w>

Returns the G53 W axis offset for the current work coordinate

R

#<_tool_offset_x>

Returns the X axis offset for the currently active tool (on lathes the returned value will be half of what is shown in the tool table)

R

#<_tool_offset_y>

Returns the Y axis offset for the currently active tool

R

#<_tool_offset_z>

Returns the Z axis offset for the currently active tool

R

#<_tool_offset_a>

Returns the A axis offset for the currently active tool

R

#<_tool_offset_b>

Returns the B axis offset for the currently active tool

R

#<_tool_offset_c>

Returns the C axis offset for the currently active tool

R

#<_tool_offset_u>

Returns the U axis offset for the currently active tool

R

#<_tool_offset_v>

Returns the V axis offset for the currently active tool

R

#<_tool_offset_w>

Returns the W axis offset for the currently active tool

R

#<_axis_offset_x>

Returns the value of an external offset applied to the X axis

R

#<_axis_offset_y>

Returns the value of an external offset applied to the Y axis

R

#<_axis_offset_z>

Returns the value of an external offset applied to the Z axis

R

#<_axis_offset_a>

Returns the value of an external offset applied to the A axis

R

#<_axis_offset_b>

Returns the value of an external offset applied to the B axis

R

#<_axis_offset_c>

Returns the value of an external offset applied to the C axis

R

#<_axis_offset_u>

Returns the value of an external offset applied to the U axis

R

#<_axis_offset_v>

Returns the value of an external offset applied to the V axis

R

#<_axis_offset_w>

Returns the value of an external offset applied to the W axis

R

#<_x_machine>

Current G53 machine coordinates of the X axis

R

#<_y_machine>

Current G53 machine coordinates of the Y axis

R

#<_z_machine>

Current G53 machine coordinates of the Z axis

R

#<_a_machine>

Current G53 machine coordinates of the A axis

R

#<_b_machine>

Current G53 machine coordinates of the B axis

R

#<_c_machine>

Current G53 machine coordinates of the C axis

R

#<_u_machine>

Current G53 machine coordinates of the U axis

R

#<_v_machine>

Current G53 machine coordinates of the V axis

R

#<_w_machine>

Current G53 machine coordinates of the W axis

R

#<_probe_result>

Returns the result of a G38 probe result, equivalent to parameter #5070

R

#<_probe_x>

Returns the coordinates of a G38 probe trip, equivalent to parameter #5061

R

#<_probe_y>

Returns the coordinates of a G38 probe trip, equivalent to parameter #5062

R

#<_probe_z>

Returns the coordinates of a G38 probe trip, equivalent to parameter #5063

R

#<_probe_a>

Returns the coordinates of a G38 probe trip, equivalent to parameter #5064

R

Lathe Specific Parameters

When using G10 on the 15L/8L P values of 1-99 will modify the wear offset values.

When using G10 on the 15L/8L P values of 10001-10099 will modify the geometry offset values.

Calling External Programs

When calling an external program an o*** call should be used in the calling program and o*** sub/o*** endsub commands at the in the called program. The called program’s name should be ***.nc (not o***.nc) and it should be placed in the “subroutines” folder of the machine directory.

If any change is made to the called program, the calling program must be cleared from being the active program and then reloaded. This is because when any program is made to the active program, it (including any called programs) is written to internal memory and the program is run from that internal memory.

JavaScript errors detected

Please note, these errors can depend on your browser setup.

If this problem persists, please contact our support.