4949fanuc_post.export(object,"/path/to/file.ncc","")
5050"""
5151
52+ # Preamble text will appear at the beginning of the GCODE output file.
53+ DEFAULT_PREAMBLE = """G17 G54 G40 G49 G80 G90
54+ """
55+
56+ # Postamble text will appear following the last operation.
57+ DEFAULT_POSTAMBLE = """M05
58+ G17 G54 G90 G80 G40
59+ M30
60+ """
61+
5262now = datetime .datetime .now ()
5363
5464parser = argparse .ArgumentParser (prog = "fanuc" , add_help = False )
6373parser .add_argument ("--precision" , help = "number of digits of precision, default=3 (mm) or 4 (in)" )
6474parser .add_argument (
6575 "--preamble" ,
66- help = 'set commands to be issued before the first command, default="G17 G54 G40 G49 G80 G90\\ n"' ,
76+ help = 'set commands to be issued before the first command, default="'
77+ + DEFAULT_PREAMBLE .replace ("\n " , "\\ n" )
78+ + '"' ,
6779)
6880parser .add_argument (
6981 "--postamble" ,
70- help = 'set commands to be issued after the last command, default="M05\\ nG17 G54 G90 G80 G40\\ nM30\\ n"' ,
82+ help = 'set commands to be issued after the last command, default="'
83+ + DEFAULT_POSTAMBLE .replace ("\n " , "\\ n" )
84+ + '"' ,
7185)
7286parser .add_argument (
7387 "--inches" , action = "store_true" , help = "Convert output for US imperial mode (G20)"
122136# rigid tapping.
123137tapSpeed = 0
124138
125- # Preamble text will appear at the beginning of the GCODE output file.
126- DEFAULT_PREAMBLE = """G17 G54 G40 G49 G80 G90
127- """
128-
129- # Postamble text will appear following the last operation.
130- DEFAULT_POSTAMBLE = """M05
131- G17 G54 G90 G80 G40
132- M30
133- """
139+ PREAMBLE = DEFAULT_PREAMBLE
140+ POSTAMBLE = DEFAULT_POSTAMBLE
134141
135142# Pre operation text will be inserted before every operation
136143PRE_OPERATION = """"""
@@ -150,6 +157,8 @@ def processArguments(argstring):
150157 global OUTPUT_LINE_NUMBERS
151158 global SHOW_EDITOR
152159 global PRECISION
160+ global DEFAULT_PREAMBLE
161+ global DEFAULT_POSTAMBLE
153162 global PREAMBLE
154163 global POSTAMBLE
155164 global UNITS
0 commit comments