CAM: Made empty spindle at the end optional in Fanuc CAM post processing script
Some Fanuc machines do not understand the 'M6 T0' instructions in the preamble. Move it out of the preamble and controlled by a new command line argument --no-end-spindle-empty for the machines where running to cause a "Tool Number Alarm" and the program to crash as tool zero is not a valid tool. Fixes: #25677
This commit is contained in:
@@ -67,7 +67,7 @@ parser.add_argument(
|
||||
)
|
||||
parser.add_argument(
|
||||
"--postamble",
|
||||
help='set commands to be issued after the last command, default="M05\\nG17 G54 G90 G80 G40\\nM6 T0\\nM2\\n"',
|
||||
help='set commands to be issued after the last command, default="M05\\nG17 G54 G90 G80 G40\\nM2\\n"',
|
||||
)
|
||||
parser.add_argument(
|
||||
"--inches", action="store_true", help="Convert output for US imperial mode (G20)"
|
||||
@@ -85,6 +85,11 @@ parser.add_argument(
|
||||
action="store_true",
|
||||
help="suppress tool length offset (G43) following tool changes",
|
||||
)
|
||||
parser.add_argument(
|
||||
"--no-end-spindle-empty",
|
||||
action="store_true",
|
||||
help="suppress putting last tool in tool change carousel before postamble",
|
||||
)
|
||||
|
||||
TOOLTIP_ARGS = parser.format_help()
|
||||
|
||||
@@ -101,6 +106,8 @@ OUTPUT_DOUBLES = (
|
||||
COMMAND_SPACE = " "
|
||||
LINENR = 100 # line number starting value
|
||||
|
||||
END_SPINDLE_EMPTY = True
|
||||
|
||||
# These globals will be reflected in the Machine configuration of the project
|
||||
UNITS = "G21" # G21 for metric, G20 for us standard
|
||||
UNIT_SPEED_FORMAT = "mm/min"
|
||||
@@ -122,7 +129,6 @@ DEFAULT_PREAMBLE = """G17 G54 G40 G49 G80 G90
|
||||
# Postamble text will appear following the last operation.
|
||||
DEFAULT_POSTAMBLE = """M05
|
||||
G17 G54 G90 G80 G40
|
||||
M6 T0
|
||||
M2
|
||||
"""
|
||||
|
||||
@@ -149,6 +155,7 @@ def processArguments(argstring):
|
||||
global UNIT_FORMAT
|
||||
global MODAL
|
||||
global USE_TLO
|
||||
global END_SPINDLE_EMPTY
|
||||
global OUTPUT_DOUBLES
|
||||
global LINENR
|
||||
|
||||
@@ -204,6 +211,10 @@ def processArguments(argstring):
|
||||
OUTPUT_DOUBLES = True
|
||||
else:
|
||||
OUTPUT_DOUBLES = False
|
||||
if args.no_end_spindle_empty:
|
||||
END_SPINDLE_EMPTY = False
|
||||
else:
|
||||
END_SPINDLE_EMPTY = True
|
||||
|
||||
except Exception:
|
||||
return False
|
||||
@@ -294,6 +305,10 @@ def export(objectslist, filename, argstring):
|
||||
gcode += linenumber() + "(COOLANT OFF:" + coolantMode.upper() + ")\n"
|
||||
gcode += linenumber() + "M9" + "\n"
|
||||
|
||||
if END_SPINDLE_EMPTY:
|
||||
if OUTPUT_COMMENTS:
|
||||
gcode += "(BEGIN MAKING SPINDLE EMPTY)\n"
|
||||
gcode += "M05\nM6 T0\n"
|
||||
# do the post_amble
|
||||
if OUTPUT_COMMENTS:
|
||||
gcode += "(BEGIN POSTAMBLE)\n"
|
||||
|
||||
Reference in New Issue
Block a user