Adjust main file to support homing at the end

This commit is contained in:
Mario Voigt 2022-04-25 17:48:24 +02:00
parent baaf41342e
commit 4c20024cf7

View File

@ -1,5 +1,6 @@
#!/usr/bin/env python #!/usr/bin/env python
""" """
Modified by Mario Voigt 2022, Stadtfabrikanten e.V.
Modified by Mario Voigt 2016, Stoutwind, stoutwind.de Modified by Mario Voigt 2016, Stoutwind, stoutwind.de
Modified by Marcus Littwin 2015, Hot-World GmbH & Co. KG, repetier.com Modified by Marcus Littwin 2015, Hot-World GmbH & Co. KG, repetier.com
Modified by Jay Johnson 2015, J Tech Photonics, Inc., jtechphotonics.com Modified by Jay Johnson 2015, J Tech Photonics, Inc., jtechphotonics.com
@ -2448,10 +2449,15 @@ class plotter_gcode(inkex.Effect):
for footer_command_line in footer_command_lines: for footer_command_line in footer_command_lines:
gcode_custom_footer += footer_command_line + "\n" gcode_custom_footer += footer_command_line + "\n"
#Auto-Homing #Auto-Homing Start
option_autohoming = "" option_autohoming_start = ""
if self.options.auto_homing: if self.options.auto_homing_start:
option_autohoming = "G28 XY;homing\n" option_autohoming_start = "G28 XY;homing\n"
#Auto-Homing End
option_auto_homing_end = ""
if self.options.auto_homing_end:
option_auto_homing_end = "G28 XY;homing\n"
#Disable tool at the end #Disable tool at the end
option_auto_disable_tool = "" option_auto_disable_tool = ""
@ -2481,7 +2487,7 @@ class plotter_gcode(inkex.Effect):
"\n;BEGIN OF CUSTOM HEADER\n" +\ "\n;BEGIN OF CUSTOM HEADER\n" +\
gcode_custom_header +\ gcode_custom_header +\
";END OF CUSTOM HEADER\n\n" +\ ";END OF CUSTOM HEADER\n\n" +\
option_autohoming +\ option_autohoming_start +\
"\nG0 F" +\ "\nG0 F" +\
self.options.travel_speed +\ self.options.travel_speed +\
";init feedrate\n" +\ ";init feedrate\n" +\
@ -2491,6 +2497,7 @@ class plotter_gcode(inkex.Effect):
gcode_custom_footer +\ gcode_custom_footer +\
";END OF CUSTOM FOOTER\n\n" + \ ";END OF CUSTOM FOOTER\n\n" + \
option_auto_disable_tool +\ option_auto_disable_tool +\
option_auto_homing_end +\
";END OF GCODE\n" ";END OF GCODE\n"
gcode_pass = finalgcode gcode_pass = finalgcode
if self.options.repeatings_mode == "full" : if self.options.repeatings_mode == "full" :
@ -2535,7 +2542,8 @@ class plotter_gcode(inkex.Effect):
self.OptionParser.add_option("", "--laserpower-increment", action="store", type="float", dest="laserpower_increment", default="0.0", help="Laser power increment/decrement") self.OptionParser.add_option("", "--laserpower-increment", action="store", type="float", dest="laserpower_increment", default="0.0", help="Laser power increment/decrement")
self.OptionParser.add_option("", "--scale-uniform", action="store", type="float", dest="scale_uniform", default="100.0", help="Scale") self.OptionParser.add_option("", "--scale-uniform", action="store", type="float", dest="scale_uniform", default="100.0", help="Scale")
self.OptionParser.add_option("", "--scale-increment", action="store", type="float", dest="scale_increment", default="0.0", help="Scale increment") self.OptionParser.add_option("", "--scale-increment", action="store", type="float", dest="scale_increment", default="0.0", help="Scale increment")
self.OptionParser.add_option("", "--auto-homing", action="store", type="inkbool", dest="auto_homing", default=True, help="Auto homing XY") self.OptionParser.add_option("", "--auto-homing-start", action="store", type="inkbool", dest="auto_homing_start", default=True, help="Auto homing XY at start")
self.OptionParser.add_option("", "--auto-homing-end", action="store", type="inkbool", dest="auto_homing_end", default=True, help="Auto homing XY at end")
self.OptionParser.add_option("", "--auto-disable-tool", action="store", type="inkbool", dest="auto_disable_tool", default=True, help="Auto disable servo motor") self.OptionParser.add_option("", "--auto-disable-tool", action="store", type="inkbool", dest="auto_disable_tool", default=True, help="Auto disable servo motor")
self.OptionParser.add_option("", "--randomize-speed", action="store", type="inkbool", dest="randomize_speed", default=False, help="Randomize speed") self.OptionParser.add_option("", "--randomize-speed", action="store", type="inkbool", dest="randomize_speed", default=False, help="Randomize speed")
self.OptionParser.add_option("", "--randomize-speed-lowerval", action="store", type="float", dest="randomize_speed_lowerval", default="0.0", help="Randomize speed, lower value") self.OptionParser.add_option("", "--randomize-speed-lowerval", action="store", type="float", dest="randomize_speed_lowerval", default="0.0", help="Randomize speed, lower value")