- updated the header of the postprocessos with 'laser' to show essential informations like some of them do not move on the Z axis
- make sure that the laser postprocessor that do move on the Z axis (like 'GRBL_laser_Z') accept negative values for the Z focus - fixed issue in highlighter such that the keywords that have an underscore included are highlighted - rearranged the default keywords - fixed the generatecncjob() method default parameters to reflect new data structure names - in Geometry object the default self.options dictionary is updated with keys that reflect new data structure
This commit is contained in:
@@ -21,7 +21,11 @@ class GRBL_laser(PreProc):
|
||||
def start_code(self, p):
|
||||
units = ' ' + str(p['units']).lower()
|
||||
gcode = '(This preprocessor is used with a motion controller loaded with GRBL firmware. )\n'
|
||||
gcode += '(It is for the case when it is used together with a LASER connected on the SPINDLE connector.)\n\n'
|
||||
gcode += '(It is for the case when it is used together with a LASER connected on the SPINDLE connector.)\n' \
|
||||
'(This preprocessor makes no moves on the Z axis it will only move horizontally.)\n' \
|
||||
'(The horizontal move is done with G0 - highest possible speed set in the GRBL controller.)\n' \
|
||||
'(It assumes a manually focused laser.)\n' \
|
||||
'(The laser is started with M3 command and stopped with the M5 command.)\n\n'
|
||||
|
||||
xmin = '%.*f' % (p.coords_decimals, p['options']['xmin'])
|
||||
xmax = '%.*f' % (p.coords_decimals, p['options']['xmax'])
|
||||
@@ -29,10 +33,6 @@ class GRBL_laser(PreProc):
|
||||
ymax = '%.*f' % (p.coords_decimals, p['options']['ymax'])
|
||||
|
||||
gcode += '(Feedrate: ' + str(p['feedrate']) + units + '/min' + ')\n'
|
||||
gcode += '(Feedrate rapids: ' + str(p['feedrate_rapid']) + units + '/min' + ')\n' + '\n'
|
||||
|
||||
gcode += '(Z Focus: ' + str(p['z_move']) + units + ')\n'
|
||||
|
||||
gcode += '(Steps per circle: ' + str(p['steps_per_circle']) + ')\n'
|
||||
|
||||
if str(p['options']['type']) == 'Excellon' or str(p['options']['type']) == 'Excellon Geometry':
|
||||
@@ -59,11 +59,10 @@ class GRBL_laser(PreProc):
|
||||
return 'M5'
|
||||
|
||||
def down_code(self, p):
|
||||
sdir = {'CW': 'M03', 'CCW': 'M04'}[p.spindledir]
|
||||
if p.spindlespeed:
|
||||
return '%s S%s' % (sdir, str(p.spindlespeed))
|
||||
return '%s S%s' % ('M3', str(p.spindlespeed))
|
||||
else:
|
||||
return sdir
|
||||
return 'M3'
|
||||
|
||||
def toolchange_code(self, p):
|
||||
return ''
|
||||
@@ -88,32 +87,31 @@ class GRBL_laser(PreProc):
|
||||
(p.coords_decimals, x_pos, p.coords_decimals, y_pos)
|
||||
|
||||
def rapid_code(self, p):
|
||||
return ('G00 ' + self.position_code(p)).format(**p)
|
||||
return ('G0 ' + self.position_code(p)).format(**p)
|
||||
|
||||
def linear_code(self, p):
|
||||
return ('G01 ' + self.position_code(p)).format(**p) + \
|
||||
return ('G1 ' + self.position_code(p)).format(**p) + \
|
||||
' F' + str(self.feedrate_format % (p.fr_decimals, p.feedrate))
|
||||
|
||||
def end_code(self, p):
|
||||
coords_xy = p['xy_end']
|
||||
gcode = ('G00 Z' + self.feedrate_format % (p.fr_decimals, p.z_end) + "\n")
|
||||
gcode = ('G0 Z' + self.feedrate_format % (p.fr_decimals, p.z_end) + "\n")
|
||||
|
||||
if coords_xy and coords_xy != '':
|
||||
gcode += 'G00 X{x} Y{y}'.format(x=coords_xy[0], y=coords_xy[1]) + "\n"
|
||||
gcode += 'G0 X{x} Y{y}'.format(x=coords_xy[0], y=coords_xy[1]) + "\n"
|
||||
return gcode
|
||||
|
||||
def feedrate_code(self, p):
|
||||
return 'G01 F' + str(self.feedrate_format % (p.fr_decimals, p.feedrate))
|
||||
return 'G1 F' + str(self.feedrate_format % (p.fr_decimals, p.feedrate))
|
||||
|
||||
def z_feedrate_code(self, p):
|
||||
return 'G01 F' + str(self.feedrate_format % (p.fr_decimals, p.z_feedrate))
|
||||
return 'G1 F' + str(self.feedrate_format % (p.fr_decimals, p.z_feedrate))
|
||||
|
||||
def spindle_code(self, p):
|
||||
sdir = {'CW': 'M03', 'CCW': 'M04'}[p.spindledir]
|
||||
if p.spindlespeed:
|
||||
return '%s S%s' % (sdir, str(p.spindlespeed))
|
||||
return '%s S%s' % ('M3', str(p.spindlespeed))
|
||||
else:
|
||||
return sdir
|
||||
return 'M3'
|
||||
|
||||
def dwell_code(self, p):
|
||||
return ''
|
||||
|
||||
@@ -3,6 +3,8 @@
|
||||
# http://flatcam.org #
|
||||
# File Author: Matthieu Berthomé #
|
||||
# Date: 5/26/2017 #
|
||||
# Modified: Marius Stanciu #
|
||||
# Date: 01/19/2022 #
|
||||
# MIT Licence #
|
||||
# ##########################################################
|
||||
|
||||
@@ -12,7 +14,7 @@ from appPreProcessor import *
|
||||
# is compatible with almost any version of Grbl.
|
||||
|
||||
|
||||
class Z_laser(PreProc):
|
||||
class GRBL_laser_Z(PreProc):
|
||||
|
||||
include_header = True
|
||||
coordinate_format = "%.*f"
|
||||
@@ -30,10 +32,7 @@ class Z_laser(PreProc):
|
||||
ymax = '%.*f' % (p.coords_decimals, p['options']['ymax'])
|
||||
|
||||
gcode += '(Feedrate: ' + str(p['feedrate']) + units + '/min' + ')\n'
|
||||
gcode += '(Feedrate rapids: ' + str(p['feedrate_rapid']) + units + '/min' + ')\n' + '\n'
|
||||
|
||||
gcode += '(Z Focus: ' + str(p['z_move']) + units + ')\n'
|
||||
|
||||
gcode += '(Steps per circle: ' + str(p['steps_per_circle']) + ')\n'
|
||||
|
||||
if str(p['options']['type']) == 'Excellon' or str(p['options']['type']) == 'Excellon Geometry':
|
||||
@@ -54,20 +53,20 @@ class Z_laser(PreProc):
|
||||
return gcode
|
||||
|
||||
def startz_code(self, p):
|
||||
return ''
|
||||
gcode = 'G0 Z' + self.coordinate_format % (p.coords_decimals, p.z_move)
|
||||
return gcode
|
||||
|
||||
def lift_code(self, p):
|
||||
return 'M5'
|
||||
|
||||
def down_code(self, p):
|
||||
sdir = {'CW': 'M03', 'CCW': 'M04'}[p.spindledir]
|
||||
if p.spindlespeed:
|
||||
return '%s S%s' % (sdir, str(p.spindlespeed))
|
||||
return '%s S%s' % ('M3', str(p.spindlespeed))
|
||||
else:
|
||||
return sdir
|
||||
return 'M3'
|
||||
|
||||
def toolchange_code(self, p):
|
||||
return 'G00 Z' + self.coordinate_format % (p.coords_decimals, p.z_move)
|
||||
return 'G0 Z' + self.coordinate_format % (p.coords_decimals, p.z_move)
|
||||
|
||||
def up_to_zero_code(self, p):
|
||||
return 'M5'
|
||||
@@ -89,32 +88,31 @@ class Z_laser(PreProc):
|
||||
(p.coords_decimals, x_pos, p.coords_decimals, y_pos)
|
||||
|
||||
def rapid_code(self, p):
|
||||
return ('G00 ' + self.position_code(p)).format(**p)
|
||||
return ('G0 ' + self.position_code(p)).format(**p)
|
||||
|
||||
def linear_code(self, p):
|
||||
return ('G01 ' + self.position_code(p)).format(**p) + \
|
||||
return ('G1 ' + self.position_code(p)).format(**p) + \
|
||||
' F' + str(self.feedrate_format % (p.fr_decimals, p.feedrate))
|
||||
|
||||
def end_code(self, p):
|
||||
coords_xy = p['xy_end']
|
||||
gcode = ('G00 Z' + self.feedrate_format % (p.fr_decimals, p.z_end) + "\n")
|
||||
gcode = ('G0 Z' + self.feedrate_format % (p.fr_decimals, p.z_end) + "\n")
|
||||
|
||||
if coords_xy and coords_xy != '':
|
||||
gcode += 'G00 X{x} Y{y}'.format(x=coords_xy[0], y=coords_xy[1]) + "\n"
|
||||
gcode += 'G0 X{x} Y{y}'.format(x=coords_xy[0], y=coords_xy[1]) + "\n"
|
||||
return gcode
|
||||
|
||||
def feedrate_code(self, p):
|
||||
return 'G01 F' + str(self.feedrate_format % (p.fr_decimals, p.feedrate))
|
||||
return 'G1 F' + str(self.feedrate_format % (p.fr_decimals, p.feedrate))
|
||||
|
||||
def z_feedrate_code(self, p):
|
||||
return 'G01 F' + str(self.feedrate_format % (p.fr_decimals, p.z_feedrate))
|
||||
return 'G1 F' + str(self.feedrate_format % (p.fr_decimals, p.z_feedrate))
|
||||
|
||||
def spindle_code(self, p):
|
||||
sdir = {'CW': 'M03', 'CCW': 'M04'}[p.spindledir]
|
||||
if p.spindlespeed:
|
||||
return '%s S%s' % (sdir, str(p.spindlespeed))
|
||||
return '%s S%s' % ('M3', str(p.spindlespeed))
|
||||
else:
|
||||
return sdir
|
||||
return 'M3'
|
||||
|
||||
def dwell_code(self, p):
|
||||
return ''
|
||||
@@ -23,7 +23,13 @@ class grbl_laser_eleks_drd(PreProc):
|
||||
def start_code(self, p):
|
||||
units = ' ' + str(p['units']).lower()
|
||||
gcode = '(This preprocessor is made to work with Laser cutters.)\n'
|
||||
gcode += '(It allows movement on the Z axis.)\n\n'
|
||||
gcode += '(This post processor is configured to output code for)\n'
|
||||
gcode += '(lasers without Z Axis and to convert excellon drillcodes into arcs.)\n'
|
||||
gcode += '(Therefore after etching we have small holes in the copper plane)\n'
|
||||
gcode += '(which helps for centering the drill bit for manual drilling)\n'
|
||||
gcode += '(The GRBL Controller has to support G2 commands)\n'
|
||||
gcode += '(The moves are only on horizontal plane X-Y. There are no Z moves.)\n'
|
||||
gcode += '(Assumes manual laser focussing.)\n\n'
|
||||
|
||||
xmin = '%.*f' % (p.coords_decimals, p['options']['xmin'])
|
||||
xmax = '%.*f' % (p.coords_decimals, p['options']['xmax'])
|
||||
@@ -101,7 +107,7 @@ class grbl_laser_eleks_drd(PreProc):
|
||||
def toolchange_code(self, p):
|
||||
return ';toolchange'
|
||||
|
||||
def up_to_zero_code(self, p): # Only use for drilling, so no essentialy need for Laser
|
||||
def up_to_zero_code(self, p): # Only use for drilling, so no essential need for Laser
|
||||
return ';up_to_zero'
|
||||
|
||||
def position_code(self, p):
|
||||
|
||||
Reference in New Issue
Block a user