The machine control needs to see different cutcom codes when the workplane changes. For example, when in G17 mode, cutcom is the normal G41. For G18 or G19 planes, the cutcom code needs to be G141 instead.
Solution
The post can contain a small test to determine what workplane is in use in the linear move event where the cutcom code is to be output so that desired code format can be triggered.
A custom command is added at the beginning of the linear move event. This
will reset the system cutcom codes depending on the workplane in use.
#=============================================================
proc PB_CMD_planecheck { } {
#=============================================================
global mom_cutcom_plane
global mom_sys_cutcom_code
if { $mom_cutcom_plane == "XY" } {
# do nothing. cutcom codes are left unchanged
# but the logical test is in place
}
if { $mom_cutcom_plane == "YZ" } {
# override the standard left/right cutcom codes
set mom_sys_cutcom_code(LEFT) 141
set mom_sys_cutcom_code(RIGHT) 142
}
if { $mom_cutcom_plane == "ZX" } {
# override the standard left/right cutcom codes
set mom_sys_cutcom_code(LEFT) 141
set mom_sys_cutcom_code(RIGHT) 142
}
}
Note that any new values for the cutcom codes will remain in place from this point on. At the end of the operation, these have to be restored back to the way they were originally so the post is ready for the next operation if it is on a different workplane. The following is added in another custom command in
the end of path event:
#=============================================================
proc PB_CMD_reset_cutcom_codes { } {
#=============================================================
global mom_sys_cutcom_code
set mom_sys_cutcom_code(LEFT) 41
set mom_sys_cutcom_code(RIGHT) 42
}
Notes