- 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:
Marius Stanciu 2020-02-08 20:38:51 +02:00 committed by Marius
parent 9911402c95
commit 48029da52b
17 changed files with 256 additions and 91 deletions

View File

@ -1001,7 +1001,7 @@ class App(QtCore.QObject):
'box, center_x, center_y, columns, combine, connect, contour, default, '
'depthperpass, dia, diatol, dist, drilled_dias, drillz, dwelltime, '
'extracut_length, '
'feedrate_z, grbl_11, grbl_laser, gridoffsety, gridx, gridy, has_offset, '
'feedrate_z, grbl_11, GRBL_laser, gridoffsety, gridx, gridy, has_offset, '
'holes, hpgl, iso_type, line_xyz, margin, marlin, method, milled_dias, '
'minoffset, name, offset, opt_type, order, outname, overlap, '
'passes, postamble, pp, ppname_e, ppname_g, preamble, radius, ref, rest, '
@ -1290,7 +1290,7 @@ class App(QtCore.QObject):
# Excellon Options
"excellon_drillz": self.ui.excellon_defaults_form.excellon_opt_group.cutz_entry,
"excellon_travelz": self.ui.excellon_defaults_form.excellon_opt_group.travelz_entry,
"excellon_endz": self.ui.excellon_defaults_form.excellon_opt_group.eendz_entry,
"excellon_endz": self.ui.excellon_defaults_form.excellon_opt_group.endz_entry,
"excellon_feedrate": self.ui.excellon_defaults_form.excellon_opt_group.feedrate_z_entry,
"excellon_spindlespeed": self.ui.excellon_defaults_form.excellon_opt_group.spindlespeed_entry,
"excellon_dwell": self.ui.excellon_defaults_form.excellon_opt_group.dwell_cb,
@ -1368,14 +1368,14 @@ class App(QtCore.QObject):
"geometry_ppname_g": self.ui.geometry_defaults_form.geometry_opt_group.pp_geometry_name_cb,
"geometry_toolchange": self.ui.geometry_defaults_form.geometry_opt_group.toolchange_cb,
"geometry_toolchangez": self.ui.geometry_defaults_form.geometry_opt_group.toolchangez_entry,
"geometry_endz": self.ui.geometry_defaults_form.geometry_opt_group.gendz_entry,
"geometry_endz": self.ui.geometry_defaults_form.geometry_opt_group.endz_entry,
"geometry_depthperpass": self.ui.geometry_defaults_form.geometry_opt_group.depthperpass_entry,
"geometry_multidepth": self.ui.geometry_defaults_form.geometry_opt_group.multidepth_cb,
# Geometry Advanced Options
"geometry_toolchangexy": self.ui.geometry_defaults_form.geometry_adv_opt_group.toolchangexy_entry,
"geometry_startz": self.ui.geometry_defaults_form.geometry_adv_opt_group.gstartz_entry,
"geometry_feedrate_rapid": self.ui.geometry_defaults_form.geometry_adv_opt_group.cncfeedrate_rapid_entry,
"geometry_feedrate_rapid": self.ui.geometry_defaults_form.geometry_adv_opt_group.feedrate_rapid_entry,
"geometry_extracut": self.ui.geometry_defaults_form.geometry_adv_opt_group.extracut_cb,
"geometry_extracut_length": self.ui.geometry_defaults_form.geometry_adv_opt_group.e_cut_entry,
"geometry_z_pdepth": self.ui.geometry_defaults_form.geometry_adv_opt_group.pdepth_entry,
@ -2263,7 +2263,7 @@ class App(QtCore.QObject):
'box', 'center_x', 'center_y', 'columns', 'combine', 'connect', 'contour', 'default',
'depthperpass', 'dia', 'diatol', 'dist', 'drilled_dias', 'drillz',
'dwelltime', 'extracut_length',
'feedrate_z', 'grbl_11', 'grbl_laser', 'gridoffsety', 'gridx', 'gridy',
'feedrate_z', 'grbl_11', 'GRBL_laser', 'gridoffsety', 'gridx', 'gridy',
'has_offset', 'holes', 'hpgl', 'iso_type', 'line_xyz', 'margin', 'marlin', 'method',
'milled_dias', 'minoffset', 'name', 'offset', 'opt_type', 'order',
'outname', 'overlap', 'passes', 'postamble', 'pp', 'ppname_e', 'ppname_g',

View File

@ -2814,7 +2814,7 @@ class FlatCAMExcellon(FlatCAMObj, Excellon):
"dwell": self.ui.dwell_cb,
"dwelltime": self.ui.dwelltime_entry,
"startz": self.ui.estartz_entry,
"endz": self.ui.eendz_entry,
"endz": self.ui.endz_entry,
"ppname_e": self.ui.pp_excellon_name_cb,
"z_pdepth": self.ui.pdepth_entry,
"feedrate_probe": self.ui.feedrate_probe_entry,
@ -3475,13 +3475,23 @@ class FlatCAMExcellon(FlatCAMObj, Excellon):
except AttributeError:
pass
self.ui.travelzlabel.setText('%s:' % _("Focus Z"))
if 'marlin' in current_pp.lower():
self.ui.travelzlabel.setText('%s:' % _("Focus Z"))
self.ui.endz_label.show()
self.ui.endz_entry.show()
else:
self.ui.travelzlabel.hide()
self.ui.travelz_entry.hide()
self.ui.endz_label.hide()
self.ui.endz_entry.hide()
try:
self.ui.frzlabel.hide()
self.ui.feedrate_z_entry.hide()
except AttributeError:
pass
self.ui.dwell_cb.hide()
self.ui.dwelltime_entry.hide()
@ -3503,6 +3513,12 @@ class FlatCAMExcellon(FlatCAMObj, Excellon):
self.ui.travelzlabel.setText('%s:' % _('Travel Z'))
self.ui.travelzlabel.show()
self.ui.travelz_entry.show()
self.ui.endz_label.show()
self.ui.endz_entry.show()
try:
self.ui.frzlabel.show()
self.ui.feedrate_z_entry.show()
@ -4082,7 +4098,7 @@ class FlatCAMGeometry(FlatCAMObj, Geometry):
"travelz": self.ui.travelz_entry,
"feedrate": self.ui.cncfeedrate_entry,
"feedrate_z": self.ui.feedrate_z_entry,
"feedrate_rapid": self.ui.cncfeedrate_rapid_entry,
"feedrate_rapid": self.ui.feedrate_rapid_entry,
"spindlespeed": self.ui.cncspindlespeed_entry,
"dwell": self.ui.dwell_cb,
"dwelltime": self.ui.dwelltime_entry,
@ -4095,7 +4111,7 @@ class FlatCAMGeometry(FlatCAMObj, Geometry):
"extracut_length": self.ui.e_cut_entry,
"toolchange": self.ui.toolchangeg_cb,
"toolchangez": self.ui.toolchangez_entry,
"endz": self.ui.gendz_entry,
"endz": self.ui.endz_entry,
"cnctooldia": self.ui.addtool_entry
})
@ -4225,10 +4241,10 @@ class FlatCAMGeometry(FlatCAMObj, Geometry):
self.ui.addtool_btn.hide()
self.ui.copytool_btn.hide()
self.ui.deltool_btn.hide()
# self.ui.endzlabel.hide()
# self.ui.gendz_entry.hide()
# self.ui.endz_label.hide()
# self.ui.endz_entry.hide()
self.ui.fr_rapidlabel.hide()
self.ui.cncfeedrate_rapid_entry.hide()
self.ui.feedrate_rapid_entry.hide()
self.ui.extracut_cb.hide()
self.ui.e_cut_entry.hide()
self.ui.pdepth_label.hide()
@ -5228,10 +5244,10 @@ class FlatCAMGeometry(FlatCAMObj, Geometry):
if 'marlin' in current_pp.lower() or 'custom' in current_pp.lower():
self.ui.fr_rapidlabel.show()
self.ui.cncfeedrate_rapid_entry.show()
self.ui.feedrate_rapid_entry.show()
else:
self.ui.fr_rapidlabel.hide()
self.ui.cncfeedrate_rapid_entry.hide()
self.ui.feedrate_rapid_entry.hide()
if 'laser' in current_pp.lower():
self.ui.cutzlabel.hide()
@ -5242,13 +5258,23 @@ class FlatCAMGeometry(FlatCAMObj, Geometry):
except AttributeError:
pass
self.ui.travelzlabel.setText('%s:' % _("Focus Z"))
if 'marlin' in current_pp.lower():
self.ui.travelzlabel.setText('%s:' % _("Focus Z"))
self.ui.endz_label.show()
self.ui.endz_entry.show()
else:
self.ui.travelzlabel.hide()
self.ui.travelz_entry.hide()
self.ui.endz_label.hide()
self.ui.endz_entry.hide()
try:
self.ui.frzlabel.hide()
self.ui.feedrate_z_entry.hide()
except AttributeError:
pass
self.ui.dwell_cb.hide()
self.ui.dwelltime_entry.hide()
@ -5270,6 +5296,12 @@ class FlatCAMGeometry(FlatCAMObj, Geometry):
self.ui.travelzlabel.setText('%s:' % _('Travel Z'))
self.ui.travelzlabel.show()
self.ui.travelz_entry.show()
self.ui.endz_label.show()
self.ui.endz_entry.show()
try:
self.ui.frzlabel.show()
self.ui.feedrate_z_entry.show()

View File

@ -11,8 +11,9 @@ CAD program, and create G-Code for Isolation routing.
8.02.2020
- added a new preprocessor for using laser on a Marlin 3D printer named 'Marlin_laser'
- added a new preprocessor for using laser on a Marlin 3D printer named 'Marlin_laser_use_Spindle_pin'
- modified the Geometry UI when using laser preprocessors
- 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'
5.02.2020
@ -2772,7 +2773,7 @@ CAD program, and create G-Code for Isolation routing.
- added options for trace segmentation that can be useful for auto-levelling (code snippet from Lei Zheng from a rejected pull request on FlatCAM https://bitbucket.org/realthunder/ )
- added shortcut key 'L' for creating 'New Excellon'
- added shortcut key combo 'SHIFT+S' for Running a Script.
- modified grbl_laser postprocessor file so it includes a Sxxxx command on the line with M03 (laser active) whenever a value is enter in the Spindlespeed entry field
- modified GRBL_laser postprocessor file so it includes a Sxxxx command on the line with M03 (laser active) whenever a value is enter in the Spindlespeed entry field
- remade the EDIT -> PREFERENCES window, the Excellon and Gerber sections. Created a new section named TOOLS
26.01.2019
@ -2780,7 +2781,7 @@ CAD program, and create G-Code for Isolation routing.
- fixed grbl_11 postprocessor in linear_code() function
- added icons to the Project Tab context menu
- added new entries to the Canvas context menu (Copy, Delete, Edit/Save, Move, New Excellon, New Geometry, New Project)
- fixed grbl_laser postprocessor file
- fixed GRBL_laser postprocessor file
- updated function for copy of an Excellon object for the case when the object has slots
- updated FlatCAMExcellon.merge() function to work in case some (or all) of the merged objects have slots
@ -2800,8 +2801,8 @@ CAD program, and create G-Code for Isolation routing.
- added the Copy entry to the Project context menu
- made the functions behind Disable and Enable project context menu entries, non-threaded to fix a possible issue
- added multiple object selection on Open ... and Import ... (idea and code snippet came from Travers Carter, BitBucket user https://bitbucket.org/travc/)
- fixed 'grbl_laser' postprocessor bugs (missing functions)
- fixed display geometry for 'grbl_laser' postprocessor
- fixed 'GRBL_laser' postprocessor bugs (missing functions)
- fixed display geometry for 'GRBL_laser' postprocessor
- Excellon Editor - added possibility to create an linear drill array rotated at an custom angle
- added the Edit and Properties entries to the Project context menu

View File

@ -4067,6 +4067,13 @@ class CNCjob(Geometry):
command['Z'] = 1
else:
command['Z'] = 0
match_lsr_pos_2 = re.search(r"^(M10[6|7])", gline)
if match_lsr_pos_2:
if 'M107' in match_lsr_pos_2.group(1):
command['Z'] = 1
else:
command['Z'] = 0
elif self.pp_solderpaste_name is not None:
if 'Paste' in self.pp_solderpaste_name:
match_paste = re.search(r"X([\+-]?\d+.[\+-]?\d+)\s*Y([\+-]?\d+.[\+-]?\d+)", gline)

View File

@ -992,23 +992,23 @@ class ExcellonObjectUI(ObjectUI):
self.grid3.addWidget(self.estartz_entry, 9, 1)
# End move Z:
self.eendz_label = QtWidgets.QLabel('%s:' % _("End move Z"))
self.eendz_label.setToolTip(
self.endz_label = QtWidgets.QLabel('%s:' % _("End move Z"))
self.endz_label.setToolTip(
_("Height of the tool after\n"
"the last move at the end of the job.")
)
self.eendz_entry = FCDoubleSpinner(callback=self.confirmation_message)
self.eendz_entry.set_precision(self.decimals)
self.endz_entry = FCDoubleSpinner(callback=self.confirmation_message)
self.endz_entry.set_precision(self.decimals)
if machinist_setting == 0:
self.eendz_entry.set_range(0.0, 9999.9999)
self.endz_entry.set_range(0.0, 9999.9999)
else:
self.eendz_entry.set_range(-9999.9999, 9999.9999)
self.endz_entry.set_range(-9999.9999, 9999.9999)
self.eendz_entry.setSingleStep(0.1)
self.endz_entry.setSingleStep(0.1)
self.grid3.addWidget(self.eendz_label, 11, 0)
self.grid3.addWidget(self.eendz_entry, 11, 1)
self.grid3.addWidget(self.endz_label, 11, 0)
self.grid3.addWidget(self.endz_entry, 11, 1)
# Feedrate X-Y
self.frxylabel = QtWidgets.QLabel('%s:' % _('Feedrate X-Y'))
@ -1748,23 +1748,23 @@ class GeometryObjectUI(ObjectUI):
# self.grid3.addWidget(self.gstartz_entry, 8, 1)
# The Z value for the end move
self.endzlabel = QtWidgets.QLabel('%s:' % _('End move Z'))
self.endzlabel.setToolTip(
self.endz_label = QtWidgets.QLabel('%s:' % _('End move Z'))
self.endz_label.setToolTip(
_("Height of the tool after\n"
"the last move at the end of the job.")
)
self.gendz_entry = FCDoubleSpinner(callback=self.confirmation_message)
self.gendz_entry.set_precision(self.decimals)
self.endz_entry = FCDoubleSpinner(callback=self.confirmation_message)
self.endz_entry.set_precision(self.decimals)
if machinist_setting == 0:
self.gendz_entry.set_range(0, 9999.9999)
self.endz_entry.set_range(0, 9999.9999)
else:
self.gendz_entry.set_range(-9999.9999, 9999.9999)
self.endz_entry.set_range(-9999.9999, 9999.9999)
self.gendz_entry.setSingleStep(0.1)
self.endz_entry.setSingleStep(0.1)
self.grid3.addWidget(self.endzlabel, 9, 0)
self.grid3.addWidget(self.gendz_entry, 9, 1)
self.grid3.addWidget(self.endz_label, 9, 0)
self.grid3.addWidget(self.endz_entry, 9, 1)
# Feedrate X-Y
self.frlabel = QtWidgets.QLabel('%s:' % _('Feedrate X-Y'))
@ -1804,16 +1804,16 @@ class GeometryObjectUI(ObjectUI):
"It is useful only for Marlin,\n"
"ignore for any other cases.")
)
self.cncfeedrate_rapid_entry = FCDoubleSpinner(callback=self.confirmation_message)
self.cncfeedrate_rapid_entry.set_precision(self.decimals)
self.cncfeedrate_rapid_entry.set_range(0, 99999.9999)
self.cncfeedrate_rapid_entry.setSingleStep(0.1)
self.feedrate_rapid_entry = FCDoubleSpinner(callback=self.confirmation_message)
self.feedrate_rapid_entry.set_precision(self.decimals)
self.feedrate_rapid_entry.set_range(0, 99999.9999)
self.feedrate_rapid_entry.setSingleStep(0.1)
self.grid3.addWidget(self.fr_rapidlabel, 12, 0)
self.grid3.addWidget(self.cncfeedrate_rapid_entry, 12, 1)
self.grid3.addWidget(self.feedrate_rapid_entry, 12, 1)
# default values is to hide
self.fr_rapidlabel.hide()
self.cncfeedrate_rapid_entry.hide()
self.feedrate_rapid_entry.hide()
# Cut over 1st point in path
self.extracut_cb = FCCheckBox('%s:' % _('Re-cut'))

View File

@ -3128,21 +3128,21 @@ class ExcellonOptPrefGroupUI(OptionsGroupUI):
grid2.addWidget(self.toolchangez_entry, 3, 1)
# End Move Z
endzlabel = QtWidgets.QLabel('%s:' % _('End move Z'))
endzlabel.setToolTip(
endz_label = QtWidgets.QLabel('%s:' % _('End move Z'))
endz_label.setToolTip(
_("Height of the tool after\n"
"the last move at the end of the job.")
)
self.eendz_entry = FCDoubleSpinner()
self.eendz_entry.set_precision(self.decimals)
self.endz_entry = FCDoubleSpinner()
self.endz_entry.set_precision(self.decimals)
if machinist_setting == 0:
self.eendz_entry.set_range(0.0000, 9999.9999)
self.endz_entry.set_range(0.0000, 9999.9999)
else:
self.eendz_entry.set_range(-9999.9999, 9999.9999)
self.endz_entry.set_range(-9999.9999, 9999.9999)
grid2.addWidget(endzlabel, 4, 0)
grid2.addWidget(self.eendz_entry, 4, 1)
grid2.addWidget(endz_label, 4, 0)
grid2.addWidget(self.endz_entry, 4, 1)
# Feedrate Z
frlabel = QtWidgets.QLabel('%s:' % _('Feedrate Z'))
@ -4055,24 +4055,24 @@ class GeometryOptPrefGroupUI(OptionsGroupUI):
grid1.addWidget(self.toolchangez_entry, 5, 1)
# End move Z
endzlabel = QtWidgets.QLabel('%s:' % _('End move Z'))
endzlabel.setToolTip(
endz_label = QtWidgets.QLabel('%s:' % _('End move Z'))
endz_label.setToolTip(
_("Height of the tool after\n"
"the last move at the end of the job.")
)
self.gendz_entry = FCDoubleSpinner()
self.endz_entry = FCDoubleSpinner()
if machinist_setting == 0:
self.gendz_entry.set_range(0.000, 9999.9999)
self.endz_entry.set_range(0.000, 9999.9999)
else:
self.gendz_entry.set_range(-9999.9999, 9999.9999)
self.endz_entry.set_range(-9999.9999, 9999.9999)
self.gendz_entry.set_precision(self.decimals)
self.gendz_entry.setSingleStep(0.1)
self.gendz_entry.setWrapping(True)
self.endz_entry.set_precision(self.decimals)
self.endz_entry.setSingleStep(0.1)
self.endz_entry.setWrapping(True)
grid1.addWidget(endzlabel, 6, 0)
grid1.addWidget(self.gendz_entry, 6, 1)
grid1.addWidget(endz_label, 6, 0)
grid1.addWidget(self.endz_entry, 6, 1)
# Feedrate X-Y
frlabel = QtWidgets.QLabel('%s:' % _('Feedrate X-Y'))
@ -4207,14 +4207,14 @@ class GeometryAdvOptPrefGroupUI(OptionsGroupUI):
"It is useful only for Marlin,\n"
"ignore for any other cases.")
)
self.cncfeedrate_rapid_entry = FCDoubleSpinner()
self.cncfeedrate_rapid_entry.set_range(0, 99999.9999)
self.cncfeedrate_rapid_entry.set_precision(self.decimals)
self.cncfeedrate_rapid_entry.setSingleStep(0.1)
self.cncfeedrate_rapid_entry.setWrapping(True)
self.feedrate_rapid_entry = FCDoubleSpinner()
self.feedrate_rapid_entry.set_range(0, 99999.9999)
self.feedrate_rapid_entry.set_precision(self.decimals)
self.feedrate_rapid_entry.setSingleStep(0.1)
self.feedrate_rapid_entry.setWrapping(True)
grid1.addWidget(fr_rapid_label, 4, 0)
grid1.addWidget(self.cncfeedrate_rapid_entry, 4, 1)
grid1.addWidget(self.feedrate_rapid_entry, 4, 1)
# End move extra cut
self.extracut_cb = FCCheckBox('%s' % _('Re-cut'))

View File

@ -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

View File

@ -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'

View File

@ -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'])

View File

@ -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'])

View File

@ -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

View 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

View File

@ -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):

View File

@ -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'])

View File

@ -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'])

View File

@ -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

View File

@ -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'])