- fixed all the laser preprocessors to work correctly and the resulting GCode to be plotted

- made sure that when drilling and milling with a `laser` preprocessor the first move is not done with the laser on
This commit is contained in:
Marius Stanciu
2022-01-31 00:04:49 +02:00
committed by Marius
parent 262e795f2e
commit 7420ac9fd5
9 changed files with 76 additions and 62 deletions

View File

@@ -58,7 +58,8 @@ class GRBL_laser(PreProc):
def lift_code(self, p):
if float(p.laser_min_power) > 0.0:
return 'M03 S%s' % str(p.laser_min_power)
# the formatted text: laser OFF must always be like this else the plotting will not be done correctly
return 'M3 S%s (laser OFF)\n' % str(p.laser_min_power)
else:
return 'M5'
@@ -66,19 +67,13 @@ class GRBL_laser(PreProc):
if p.spindlespeed:
return '%s S%s' % ('M3', str(p.spindlespeed))
else:
if float(p.laser_min_power) > 0.0:
return 'M03 S%s' % str(p.laser_min_power)
else:
return 'M5'
return 'M3'
def toolchange_code(self, p):
return ''
def up_to_zero_code(self, p):
if float(p.laser_min_power) > 0.0:
return 'M03 S%s' % str(p.laser_min_power)
else:
return 'M5'
return ''
def position_code(self, p):
# formula for skewing on x for example is:
@@ -128,6 +123,7 @@ class GRBL_laser(PreProc):
def spindle_stop_code(self, p):
if float(p.laser_min_power) > 0.0:
return 'M03 S%s' % str(p.laser_min_power)
# the formatted text: laser OFF must always be like this else the plotting will not be done correctly
return 'M3 S%s (laser OFF)\n' % str(p.laser_min_power)
else:
return 'M5'

View File

@@ -79,7 +79,8 @@ class GRBL_laser_z(PreProc):
def lift_code(self, p):
if float(p.laser_min_power) > 0.0:
return 'M03 S%s' % str(p.laser_min_power)
# the formatted text: laser OFF must always be like this else the plotting will not be done correctly
return 'M3 S%s (laser OFF)\n' % str(p.laser_min_power)
else:
return 'M5'
@@ -87,19 +88,13 @@ class GRBL_laser_z(PreProc):
if p.spindlespeed:
return '%s S%s' % ('M3', str(p.spindlespeed))
else:
if float(p.laser_min_power) > 0.0:
return 'M03 S%s' % str(p.laser_min_power)
else:
return 'M5'
return 'M3'
def toolchange_code(self, p):
return 'G0 Z' + self.coordinate_format % (p.coords_decimals, p.z_move)
def up_to_zero_code(self, p):
if float(p.laser_min_power) > 0.0:
return 'M03 S%s' % str(p.laser_min_power)
else:
return 'M5'
return ''
def position_code(self, p):
# formula for skewing on x for example is:
@@ -149,6 +144,7 @@ class GRBL_laser_z(PreProc):
def spindle_stop_code(self, p):
if float(p.laser_min_power) > 0.0:
return 'M03 S%s' % str(p.laser_min_power)
# the formatted text: laser OFF must always be like this else the plotting will not be done correctly
return 'M3 S%s (laser OFF)\n' % str(p.laser_min_power)
else:
return 'M5'

View File

@@ -64,7 +64,8 @@ class Marlin_laser_FAN_pin(PreProc):
def lift_code(self, p):
if float(p.laser_min_power) > 0.0:
return 'M106 S%s' % str(p.laser_min_power)
# the formatted text: laser OFF must always be like this else the plotting will not be done correctly
return 'M106 S%s ;laser OFF\n' % str(p.laser_min_power)
else:
gcode = 'M400\n'
gcode += 'M106 S0'
@@ -80,12 +81,7 @@ class Marlin_laser_FAN_pin(PreProc):
return ''
def up_to_zero_code(self, p):
if float(p.laser_min_power) > 0.0:
return 'M106 S%s' % str(p.laser_min_power)
else:
gcode = 'M400\n'
gcode += 'M106 S0'
return gcode
return ''
def position_code(self, p):
# formula for skewing on x for example is:
@@ -140,7 +136,8 @@ class Marlin_laser_FAN_pin(PreProc):
def spindle_stop_code(self, p):
if float(p.laser_min_power) > 0.0:
return 'M106 S%s' % str(p.laser_min_power)
# the formatted text: laser OFF must always be like this else the plotting will not be done correctly
return 'M106 S%s ;laser OFF\n' % str(p.laser_min_power)
else:
gcode = 'M400\n'
gcode += 'M106 S0'

View File

@@ -63,14 +63,12 @@ class Marlin_laser_Spindle_pin(PreProc):
def lift_code(self, p):
if float(p.laser_min_power) > 0.0:
return 'M3 S%s' % str(p.laser_min_power)
# the formatted text: laser OFF must always be like this else the plotting will not be done correctly
return 'M3 S%s ;laser OFF\n' % str(p.laser_min_power)
else:
if float(p.laser_min_power) > 0.0:
return 'M3 S%s' % str(p.laser_min_power)
else:
gcode = 'M400\n'
gcode += 'M5'
return gcode
gcode = 'M400\n'
gcode += 'M5'
return gcode
def down_code(self, p):
if p.spindlespeed:
@@ -82,12 +80,7 @@ class Marlin_laser_Spindle_pin(PreProc):
return ''
def up_to_zero_code(self, p):
if float(p.laser_min_power) > 0.0:
return 'M3 S%s' % str(p.laser_min_power)
else:
gcode = 'M400\n'
gcode += 'M5'
return gcode
return ''
def position_code(self, p):
# formula for skewing on x for example is:
@@ -143,7 +136,8 @@ class Marlin_laser_Spindle_pin(PreProc):
def spindle_stop_code(self, p):
if float(p.laser_min_power) > 0.0:
return 'M3 S%s' % str(p.laser_min_power)
# the formatted text: laser OFF must always be like this else the plotting will not be done correctly
return 'M3 S%s ;laser OFF\n' % str(p.laser_min_power)
else:
gcode = 'M400\n'
gcode += 'M5'

View File

@@ -99,7 +99,8 @@ class Marlin_laser_z(PreProc):
def lift_code(self, p):
if float(p.laser_min_power) > 0.0:
return 'M3 S%s' % str(p.laser_min_power)
# the formatted text: laser OFF must always be like this else the plotting will not be done correctly
return 'M3 S%s ;laser OFF\n' % str(p.laser_min_power)
else:
gcode = 'M400\n'
gcode += 'M5'
@@ -176,7 +177,8 @@ class Marlin_laser_z(PreProc):
def spindle_stop_code(self, p):
if float(p.laser_min_power) > 0.0:
return 'M3 S%s' % str(p.laser_min_power)
# the formatted text: laser OFF must always be like this else the plotting will not be done correctly
return 'M3 S%s ;laser OFF\n' % str(p.laser_min_power)
else:
gcode = 'M400\n'
gcode += 'M5'