- added a new preprocessor file for using laser on a Marlin motion controller but with the laser connected to one of the FAN pins, named 'Marlin_laser_use_FAN_pin'
This commit is contained in:
@@ -22,7 +22,7 @@ class Berta_CNC(FlatCAMPostProc):
|
||||
def start_code(self, p):
|
||||
units = ' ' + str(p['units']).lower()
|
||||
coords_xy = p['xy_toolchange']
|
||||
gcode = ''
|
||||
gcode = '(This preprocessor is used with a BERTA CNC router.)\n\n'
|
||||
|
||||
xmin = '%.*f' % (p.coords_decimals, p['options']['xmin'])
|
||||
xmax = '%.*f' % (p.coords_decimals, p['options']['xmax'])
|
||||
@@ -80,7 +80,7 @@ class Berta_CNC(FlatCAMPostProc):
|
||||
gcode += 'G54\n'
|
||||
gcode += 'G0\n'
|
||||
gcode += '(Berta)\n'
|
||||
gcode += 'G94\n'
|
||||
gcode += 'G94'
|
||||
|
||||
return gcode
|
||||
|
||||
|
||||
@@ -12,7 +12,7 @@ from FlatCAMPostProc import *
|
||||
# is compatible with almost any version of Grbl.
|
||||
|
||||
|
||||
class grbl_laser(FlatCAMPostProc):
|
||||
class GRBL_laser(FlatCAMPostProc):
|
||||
|
||||
include_header = True
|
||||
coordinate_format = "%.*f"
|
||||
@@ -20,7 +20,8 @@ class grbl_laser(FlatCAMPostProc):
|
||||
|
||||
def start_code(self, p):
|
||||
units = ' ' + str(p['units']).lower()
|
||||
gcode = ''
|
||||
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'
|
||||
|
||||
xmin = '%.*f' % (p.coords_decimals, p['options']['xmin'])
|
||||
xmax = '%.*f' % (p.coords_decimals, p['options']['xmax'])
|
||||
@@ -55,7 +56,7 @@ class grbl_laser(FlatCAMPostProc):
|
||||
return ''
|
||||
|
||||
def lift_code(self, p):
|
||||
return 'M05 S0'
|
||||
return 'M5'
|
||||
|
||||
def down_code(self, p):
|
||||
sdir = {'CW': 'M03', 'CCW': 'M04'}[p.spindledir]
|
||||
@@ -68,7 +69,7 @@ class grbl_laser(FlatCAMPostProc):
|
||||
return ''
|
||||
|
||||
def up_to_zero_code(self, p):
|
||||
return 'M05'
|
||||
return 'M5'
|
||||
|
||||
def position_code(self, p):
|
||||
return ('X' + self.coordinate_format + ' Y' + self.coordinate_format) % \
|
||||
@@ -106,4 +107,4 @@ class grbl_laser(FlatCAMPostProc):
|
||||
return ''
|
||||
|
||||
def spindle_stop_code(self, p):
|
||||
return 'M05'
|
||||
return 'M5'
|
||||
@@ -17,7 +17,7 @@ class ISEL_CNC(FlatCAMPostProc):
|
||||
def start_code(self, p):
|
||||
units = ' ' + str(p['units']).lower()
|
||||
coords_xy = p['xy_toolchange']
|
||||
gcode = ''
|
||||
gcode = '(This preprocessor is used with a ISEL CNC router.)\n\n'
|
||||
|
||||
xmin = '%.*f' % (p.coords_decimals, p['options']['xmin'])
|
||||
xmax = '%.*f' % (p.coords_decimals, p['options']['xmax'])
|
||||
|
||||
@@ -15,7 +15,7 @@ class ISEL_ICP_CNC(FlatCAMPostProc):
|
||||
def start_code(self, p):
|
||||
units = ' ' + str(p['units']).lower()
|
||||
coords_xy = p['xy_toolchange']
|
||||
gcode = ''
|
||||
gcode = '; This preprocessor is used with a ISEL ICP CNC router.\n\n'
|
||||
|
||||
xmin = '%.*f' % (p.coords_decimals, p['options']['xmin'])
|
||||
xmax = '%.*f' % (p.coords_decimals, p['options']['xmax'])
|
||||
|
||||
@@ -66,8 +66,7 @@ class Marlin(FlatCAMPostProc):
|
||||
gcode += ';Spindle Speed: ' + str(p['spindlespeed']) + ' RPM' + '\n' + '\n'
|
||||
|
||||
gcode += ('G20' if p.units.upper() == 'IN' else 'G21') + "\n"
|
||||
gcode += 'G90\n'
|
||||
gcode += 'G94\n'
|
||||
gcode += 'G90'
|
||||
|
||||
return gcode
|
||||
|
||||
@@ -219,8 +218,11 @@ G0 Z{z_toolchange}
|
||||
return sdir
|
||||
|
||||
def dwell_code(self, p):
|
||||
gcode = 'G4 P' + str(p.dwelltime)
|
||||
if p.dwelltime:
|
||||
return 'G4 P' + str(p.dwelltime)
|
||||
return gcode
|
||||
|
||||
def spindle_stop_code(self, p):
|
||||
return 'M5'
|
||||
gcode = 'M400\n'
|
||||
gcode += 'M5'
|
||||
return gcode
|
||||
|
||||
120
preprocessors/Marlin_laser_use_FAN_pin.py
Normal file
120
preprocessors/Marlin_laser_use_FAN_pin.py
Normal file
@@ -0,0 +1,120 @@
|
||||
# ##########################################################
|
||||
# FlatCAM: 2D Post-processing for Manufacturing #
|
||||
# Website: http://flatcam.org #
|
||||
# File Author: Marius Adrian Stanciu (c) #
|
||||
# Date: 8-Feb-2020 #
|
||||
# License: MIT Licence #
|
||||
# ##########################################################
|
||||
|
||||
from FlatCAMPostProc import *
|
||||
|
||||
|
||||
class Marlin_laser_use_FAN_pin(FlatCAMPostProc):
|
||||
|
||||
include_header = True
|
||||
coordinate_format = "%.*f"
|
||||
feedrate_format = '%.*f'
|
||||
feedrate_rapid_format = feedrate_format
|
||||
|
||||
def start_code(self, p):
|
||||
units = ' ' + str(p['units']).lower()
|
||||
coords_xy = p['xy_toolchange']
|
||||
gcode = ';This preprocessor is used with a motion controller loaded with MARLIN firmware.\n'
|
||||
gcode += ';It is for the case when it is used together with a LASER connected on one of the FAN pins.\n\n'
|
||||
|
||||
xmin = '%.*f' % (p.coords_decimals, p['options']['xmin'])
|
||||
xmax = '%.*f' % (p.coords_decimals, p['options']['xmax'])
|
||||
ymin = '%.*f' % (p.coords_decimals, p['options']['ymin'])
|
||||
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':
|
||||
gcode += ';Preprocessor Excellon: ' + str(p['pp_excellon_name']) + '\n'
|
||||
else:
|
||||
gcode += ';Preprocessor Geometry: ' + str(p['pp_geometry_name']) + '\n' + '\n'
|
||||
|
||||
gcode += ';X range: ' + '{: >9s}'.format(xmin) + ' ... ' + '{: >9s}'.format(xmax) + ' ' + units + '\n'
|
||||
gcode += ';Y range: ' + '{: >9s}'.format(ymin) + ' ... ' + '{: >9s}'.format(ymax) + ' ' + units + '\n\n'
|
||||
|
||||
gcode += ';Laser Power (Spindle Speed): ' + str(p['spindlespeed']) + '\n' + '\n'
|
||||
|
||||
gcode += ('G20' if p.units.upper() == 'IN' else 'G21') + "\n"
|
||||
gcode += 'G90'
|
||||
|
||||
return gcode
|
||||
|
||||
def startz_code(self, p):
|
||||
if p.startz is not None:
|
||||
return 'G0 Z' + self.coordinate_format % (p.coords_decimals, p.z_move)
|
||||
else:
|
||||
return ''
|
||||
|
||||
def lift_code(self, p):
|
||||
gcode = 'M400\n'
|
||||
gcode += 'M107'
|
||||
return gcode
|
||||
|
||||
def down_code(self, p):
|
||||
if p.spindlespeed:
|
||||
return '%s S%s' % ('M106', str(p.spindlespeed))
|
||||
else:
|
||||
return 'M106'
|
||||
|
||||
def toolchange_code(self, p):
|
||||
return ''
|
||||
|
||||
def up_to_zero_code(self, p):
|
||||
gcode = 'M400\n'
|
||||
gcode += 'M107'
|
||||
return gcode
|
||||
|
||||
def position_code(self, p):
|
||||
return ('X' + self.coordinate_format + ' Y' + self.coordinate_format) % \
|
||||
(p.coords_decimals, p.x, p.coords_decimals, p.y)
|
||||
|
||||
def rapid_code(self, p):
|
||||
return ('G0 ' + self.position_code(p)).format(**p) + " " + self.feedrate_rapid_code(p)
|
||||
|
||||
def linear_code(self, p):
|
||||
return ('G1 ' + self.position_code(p)).format(**p) + " " + self.inline_feedrate_code(p)
|
||||
|
||||
def end_code(self, p):
|
||||
coords_xy = p['xy_toolchange']
|
||||
gcode = ('G0 Z' + self.feedrate_format % (p.fr_decimals, p.z_end) + " " + self.feedrate_rapid_code(p) + "\n")
|
||||
|
||||
if coords_xy is not None:
|
||||
gcode += 'G0 X{x} Y{y}'.format(x=coords_xy[0], y=coords_xy[1]) + " " + self.feedrate_rapid_code(p) + "\n"
|
||||
|
||||
return gcode
|
||||
|
||||
def feedrate_code(self, p):
|
||||
return 'G1 F' + str(self.feedrate_format % (p.fr_decimals, p.feedrate))
|
||||
|
||||
def z_feedrate_code(self, p):
|
||||
return 'G1 F' + str(self.feedrate_format % (p.fr_decimals, p.z_feedrate))
|
||||
|
||||
def inline_feedrate_code(self, p):
|
||||
return 'F' + self.feedrate_format % (p.fr_decimals, p.feedrate)
|
||||
|
||||
def feedrate_rapid_code(self, p):
|
||||
return 'F' + self.feedrate_rapid_format % (p.fr_decimals, p.feedrate_rapid)
|
||||
|
||||
def spindle_code(self, p):
|
||||
if p.spindlespeed:
|
||||
return '%s S%s' % ('M106 ', str(p.spindlespeed))
|
||||
else:
|
||||
return 'M106'
|
||||
|
||||
def dwell_code(self, p):
|
||||
return ''
|
||||
|
||||
def spindle_stop_code(self, p):
|
||||
gcode = 'M400\n'
|
||||
gcode += 'M107'
|
||||
return gcode
|
||||
@@ -9,7 +9,7 @@
|
||||
from FlatCAMPostProc import *
|
||||
|
||||
|
||||
class Marlin_laser(FlatCAMPostProc):
|
||||
class Marlin_laser_use_Spindle_pin(FlatCAMPostProc):
|
||||
|
||||
include_header = True
|
||||
coordinate_format = "%.*f"
|
||||
@@ -19,7 +19,8 @@ class Marlin_laser(FlatCAMPostProc):
|
||||
def start_code(self, p):
|
||||
units = ' ' + str(p['units']).lower()
|
||||
coords_xy = p['xy_toolchange']
|
||||
gcode = ''
|
||||
gcode = ';This preprocessor is used with a motion controller loaded with MARLIN firmware.\n'
|
||||
gcode += ';It is for the case when it is used together with a LASER connected on the SPINDLE connector.\n\n'
|
||||
|
||||
xmin = '%.*f' % (p.coords_decimals, p['options']['xmin'])
|
||||
xmax = '%.*f' % (p.coords_decimals, p['options']['xmax'])
|
||||
@@ -44,8 +45,7 @@ class Marlin_laser(FlatCAMPostProc):
|
||||
gcode += ';Laser Power (Spindle Speed): ' + str(p['spindlespeed']) + '\n' + '\n'
|
||||
|
||||
gcode += ('G20' if p.units.upper() == 'IN' else 'G21') + "\n"
|
||||
gcode += 'G90\n'
|
||||
gcode += 'G94'
|
||||
gcode += 'G90'
|
||||
|
||||
return gcode
|
||||
|
||||
@@ -57,7 +57,7 @@ class Marlin_laser(FlatCAMPostProc):
|
||||
|
||||
def lift_code(self, p):
|
||||
gcode = 'M400\n'
|
||||
gcode += 'M5 S0'
|
||||
gcode += 'M5'
|
||||
return gcode
|
||||
|
||||
def down_code(self, p):
|
||||
@@ -19,7 +19,7 @@ class Repetier(FlatCAMPostProc):
|
||||
def start_code(self, p):
|
||||
units = ' ' + str(p['units']).lower()
|
||||
coords_xy = p['xy_toolchange']
|
||||
gcode = ''
|
||||
gcode = ';This preprocessor is used with a motion controller loaded with REPETIER firmware.\n\n'
|
||||
|
||||
xmin = '%.*f' % (p.coords_decimals, p['options']['xmin'])
|
||||
xmax = '%.*f' % (p.coords_decimals, p['options']['xmax'])
|
||||
|
||||
@@ -18,7 +18,7 @@ class Toolchange_Probe_MACH3(FlatCAMPostProc):
|
||||
def start_code(self, p):
|
||||
units = ' ' + str(p['units']).lower()
|
||||
coords_xy = p['xy_toolchange']
|
||||
gcode = ''
|
||||
gcode = '(This preprocessor is used with MACH3 with probing height.)\n\n'
|
||||
|
||||
xmin = '%.*f' % (p.coords_decimals, p['options']['xmin'])
|
||||
xmax = '%.*f' % (p.coords_decimals, p['options']['xmax'])
|
||||
|
||||
@@ -18,7 +18,8 @@ class default(FlatCAMPostProc):
|
||||
def start_code(self, p):
|
||||
units = ' ' + str(p['units']).lower()
|
||||
coords_xy = p['xy_toolchange']
|
||||
gcode = ''
|
||||
gcode = '(This preprocessor is the default preprocessor used by FlatCAM.)\n'
|
||||
gcode += '(It is made to work with MACH3 compatible motion controllers.)\n\n'
|
||||
|
||||
xmin = '%.*f' % (p.coords_decimals, p['options']['xmin'])
|
||||
xmax = '%.*f' % (p.coords_decimals, p['options']['xmax'])
|
||||
@@ -66,7 +67,7 @@ class default(FlatCAMPostProc):
|
||||
|
||||
gcode += ('G20\n' if p.units.upper() == 'IN' else 'G21\n')
|
||||
gcode += 'G90\n'
|
||||
gcode += 'G94\n'
|
||||
gcode += 'G94'
|
||||
|
||||
return gcode
|
||||
|
||||
|
||||
@@ -18,7 +18,8 @@ class grbl_11(FlatCAMPostProc):
|
||||
def start_code(self, p):
|
||||
units = ' ' + str(p['units']).lower()
|
||||
coords_xy = p['xy_toolchange']
|
||||
gcode = ''
|
||||
gcode = '(This preprocessor is used with a motion controller loaded with GRBL firmware.)\n'
|
||||
gcode += '(It is configured to be compatible with almost any version of GRBL firmware.)\n\n'
|
||||
|
||||
xmin = '%.*f' % (p.coords_decimals, p['options']['xmin'])
|
||||
xmax = '%.*f' % (p.coords_decimals, p['options']['xmax'])
|
||||
|
||||
Reference in New Issue
Block a user