- progress in ToolChange Custom commands replacement and rename

This commit is contained in:
Marius Stanciu 2019-02-28 18:02:29 +02:00 committed by Marius
parent 546f643035
commit 9f60df850e
19 changed files with 372 additions and 337 deletions

View File

@ -1381,6 +1381,8 @@ class App(QtCore.QObject):
self.ui.general_defaults_form.general_gui_set_group.layout_combo.activated.connect(self.on_layout)
self.ui.cncjob_defaults_form.cncjob_adv_opt_group.tc_variable_combo.currentIndexChanged[str].connect(
self.on_cnc_custom_parameters)
# Modify G-CODE Plot Area TAB
self.ui.code_editor.textChanged.connect(self.handleTextChanged)
self.ui.buttonOpen.clicked.connect(self.handleOpen)
@ -1660,6 +1662,8 @@ class App(QtCore.QObject):
#self.log.debug("defaults_write_form(): No field for: %s" % option)
# TODO: Rethink this?
pass
except AttributeError:
log.debug(field)
def clear_pool(self):
self.pool.close()
@ -3690,6 +3694,12 @@ class App(QtCore.QObject):
self.ui.snap_max_dist_entry.setText(str(self.defaults["global_snap_max"]))
self.ui.grid_gap_link_cb.setChecked(True)
def on_cnc_custom_parameters(self, signal_text):
if signal_text == 'Parameters':
return
else:
self.ui.cncjob_defaults_form.cncjob_adv_opt_group.toolchange_text.insertPlainText('%%%s%%' % signal_text)
def on_save_button(self):
self.save_defaults(silent=False)
# load the defaults so they are updated into the app

View File

@ -4675,24 +4675,32 @@ class CNCJobAdvOptPrefGroupUI(OptionsGroupUI):
hlay1.addWidget(self.tc_variable_combo)
# Populate the Combo Box
variables = ['tool', 'toolC', 't_drills', 'toolchangex', 'toolchangey', 'toolchangez']
variables = ['Parameters', 'tool', 'tooldia', 't_drills', 'x_toolchange', 'y_toolchange', 'z_toolchange',
'z_cut', 'z_move', 'z_depthpercut', 'spindlespeed', 'dwelltime']
self.tc_variable_combo.addItems(variables)
self.tc_variable_combo.setItemData(0, "tool = tool number", Qt.ToolTipRole)
self.tc_variable_combo.setItemData(1, "toolC = tool diameter", Qt.ToolTipRole)
self.tc_variable_combo.setItemData(2, "t_drills = for Excellon, total number of drills", Qt.ToolTipRole)
self.tc_variable_combo.setItemData(3, "toolchangex = X coord for Toolchange", Qt.ToolTipRole)
self.tc_variable_combo.setItemData(4, "toolchangey = Y coord for Toolchange", Qt.ToolTipRole)
self.tc_variable_combo.setItemData(5, "toolchangez = Z coord for Toolchange", Qt.ToolTipRole)
self.tc_variable_combo.setItemData(0, "FlatCAM CNC parameters", Qt.ToolTipRole)
self.tc_variable_combo.setItemData(1, "tool = tool number", Qt.ToolTipRole)
self.tc_variable_combo.setItemData(2, "tooldia = tool diameter", Qt.ToolTipRole)
self.tc_variable_combo.setItemData(3, "t_drills = for Excellon, total number of drills", Qt.ToolTipRole)
self.tc_variable_combo.setItemData(4, "x_toolchange = X coord for Toolchange", Qt.ToolTipRole)
self.tc_variable_combo.setItemData(5, "y_toolchange = Y coord for Toolchange", Qt.ToolTipRole)
self.tc_variable_combo.setItemData(6, "z_toolchange = Z coord for Toolchange", Qt.ToolTipRole)
self.tc_variable_combo.setItemData(7, "z_cut = Z coord for Toolchange", Qt.ToolTipRole)
self.tc_variable_combo.setItemData(8, "z_move = Z coord for Toolchange", Qt.ToolTipRole)
self.tc_variable_combo.setItemData(9, "z_depthpercut = the step value for multidepth cut", Qt.ToolTipRole)
self.tc_variable_combo.setItemData(10, "spindlesspeed = the value for the spindle speed", Qt.ToolTipRole)
self.tc_variable_combo.setItemData(11, "dwelltime = time to dwell to allow the spindle to reach it's set RPM",
Qt.ToolTipRole)
hlay1.addStretch()
# Insert Variable into the Toolchange G-Code Text Box
self.tc_insert_buton = FCButton("Insert")
self.tc_insert_buton.setToolTip(
"Insert the variable in the GCode Box\n"
"surrounded by the '%' symbol."
)
hlay1.addWidget(self.tc_insert_buton)
# self.tc_insert_buton = FCButton("Insert")
# self.tc_insert_buton.setToolTip(
# "Insert the variable in the GCode Box\n"
# "surrounded by the '%' symbol."
# )
# hlay1.addWidget(self.tc_insert_buton)
self.layout.addStretch()

View File

@ -5152,8 +5152,16 @@ class FlatCAMCNCjob(FlatCAMObj, CNCjob):
self.ui.export_gcode_button.clicked.connect(self.on_exportgcode_button_click)
self.ui.modify_gcode_button.clicked.connect(self.on_modifygcode_button_click)
self.ui.tc_variable_combo.currentIndexChanged[str].connect(self.on_cnc_custom_parameters)
self.ui.cncplot_method_combo.activated_custom.connect(self.on_plot_kind_change)
def on_cnc_custom_parameters(self, signal_text):
if signal_text == 'Parameters':
return
else:
self.ui.toolchange_text.insertPlainText('%%%s%%' % signal_text)
def ui_connect(self):
for row in range(self.ui.cnc_tools_table.rowCount()):
self.ui.cnc_tools_table.cellWidget(row, 6).clicked.connect(self.on_plot_cb_click_table)

View File

@ -109,7 +109,7 @@ class FlatCAMPostProc_Tools(object, metaclass=ABCPostProcRegister):
pass
@abstractmethod
def feedrate_z_code(self, p):
def z_feedrate_code(self, p):
pass
@abstractmethod

View File

@ -1497,24 +1497,32 @@ class CNCObjectUI(ObjectUI):
cnclay1.addWidget(self.tc_variable_combo)
# Populate the Combo Box
variables = ['tool', 'toolC', 't_drills', 'toolchangex', 'toolchangey', 'toolchangez']
variables = ['Parameters', 'tool', 'tooldia', 't_drills', 'x_toolchange', 'y_toolchange', 'z_toolchange',
'z_cut', 'z_move', 'z_depthpercut', 'spindlespeed', 'dwelltime']
self.tc_variable_combo.addItems(variables)
self.tc_variable_combo.setItemData(0, "tool = tool number", Qt.ToolTipRole)
self.tc_variable_combo.setItemData(1, "toolC = tool diameter", Qt.ToolTipRole)
self.tc_variable_combo.setItemData(2, "t_drills = for Excellon, total number of drills", Qt.ToolTipRole)
self.tc_variable_combo.setItemData(3, "toolchangex = X coord for Toolchange", Qt.ToolTipRole)
self.tc_variable_combo.setItemData(4, "toolchangey = Y coord for Toolchange", Qt.ToolTipRole)
self.tc_variable_combo.setItemData(5, "toolchangez = Z coord for Toolchange", Qt.ToolTipRole)
self.tc_variable_combo.setItemData(0, "FlatCAM CNC parameters", Qt.ToolTipRole)
self.tc_variable_combo.setItemData(1, "tool = tool number", Qt.ToolTipRole)
self.tc_variable_combo.setItemData(2, "tooldia = tool diameter", Qt.ToolTipRole)
self.tc_variable_combo.setItemData(3, "t_drills = for Excellon, total number of drills", Qt.ToolTipRole)
self.tc_variable_combo.setItemData(4, "x_toolchange = X coord for Toolchange", Qt.ToolTipRole)
self.tc_variable_combo.setItemData(5, "y_toolchange = Y coord for Toolchange", Qt.ToolTipRole)
self.tc_variable_combo.setItemData(6, "z_toolchange = Z coord for Toolchange", Qt.ToolTipRole)
self.tc_variable_combo.setItemData(7, "z_cut = Z coord for Toolchange", Qt.ToolTipRole)
self.tc_variable_combo.setItemData(8, "z_move = Z coord for Toolchange", Qt.ToolTipRole)
self.tc_variable_combo.setItemData(9, "z_depthpercut = the step value for multidepth cut", Qt.ToolTipRole)
self.tc_variable_combo.setItemData(10, "spindlesspeed = the value for the spindle speed", Qt.ToolTipRole)
self.tc_variable_combo.setItemData(11, "dwelltime = time to dwell to allow the spindle to reach it's set RPM",
Qt.ToolTipRole)
cnclay1.addStretch()
# Insert Variable into the Toolchange G-Code Text Box
self.tc_insert_buton = FCButton("Insert")
self.tc_insert_buton.setToolTip(
"Insert the variable in the GCode Box\n"
"surrounded by the '%' symbol."
)
cnclay1.addWidget(self.tc_insert_buton)
# self.tc_insert_buton = FCButton("Insert")
# self.tc_insert_buton.setToolTip(
# "Insert the variable in the GCode Box\n"
# "surrounded by the '%' symbol."
# )
# cnclay1.addWidget(self.tc_insert_buton)
h_lay = QtWidgets.QHBoxLayout()
h_lay.setAlignment(QtCore.Qt.AlignRight | QtCore.Qt.AlignVCenter)

View File

@ -12,6 +12,7 @@ CAD program, and create G-Code for Isolation routing.
28.02.2019
- added a change that when a double click is performed in a object on canvas resulting in a selection, if the notebook is hidden then it will be displayed
- progress in ToolChange Custom commands replacement and rename
27.02.2019

110
camlib.py
View File

@ -4594,18 +4594,18 @@ class CNCjob(Geometry):
self.z_move = z_move
self.feedrate = feedrate
self.feedrate_z = feedrate_z
self.z_feedrate = feedrate_z
self.feedrate_rapid = feedrate_rapid
self.tooldia = tooldia
self.toolchangez = toolchangez
self.toolchange_xy = toolchange_xy
self.z_toolchange = toolchangez
self.xy_toolchange = toolchange_xy
self.toolchange_xy_type = None
self.toolC = tooldia
self.endz = endz
self.depthpercut = depthpercut
self.z_end = endz
self.z_depthpercut = depthpercut
self.unitcode = {"IN": "G20", "MM": "G21"}
@ -4659,9 +4659,9 @@ class CNCjob(Geometry):
# Attributes to be included in serialization
# Always append to it because it carries contents
# from Geometry.
self.ser_attrs += ['kind', 'z_cut', 'z_move', 'toolchangez', 'feedrate', 'feedrate_z', 'feedrate_rapid',
self.ser_attrs += ['kind', 'z_cut', 'z_move', 'z_toolchange', 'feedrate', 'z_feedrate', 'feedrate_rapid',
'tooldia', 'gcode', 'input_geometry_bounds', 'gcode_parsed', 'steps_per_circle',
'depthpercut', 'spindlespeed', 'dwell', 'dwelltime']
'z_depthpercut', 'spindlespeed', 'dwell', 'dwelltime']
@property
def postdata(self):
@ -4674,12 +4674,12 @@ class CNCjob(Geometry):
self.z_cut = float(self.z_cut) * factor
self.z_move *= factor
self.feedrate *= factor
self.feedrate_z *= factor
self.z_feedrate *= factor
self.feedrate_rapid *= factor
self.tooldia *= factor
self.toolchangez *= factor
self.endz *= factor
self.depthpercut = float(self.depthpercut) * factor
self.z_toolchange *= factor
self.z_end *= factor
self.z_depthpercut = float(self.z_depthpercut) * factor
return factor
@ -4785,14 +4785,14 @@ class CNCjob(Geometry):
else:
self.z_cut = drillz
self.toolchangez = toolchangez
self.z_toolchange = toolchangez
try:
if toolchangexy == '':
self.toolchange_xy = None
self.xy_toolchange = None
else:
self.toolchange_xy = [float(eval(a)) for a in toolchangexy.split(",")]
if len(self.toolchange_xy) < 2:
self.xy_toolchange = [float(eval(a)) for a in toolchangexy.split(",")]
if len(self.xy_toolchange) < 2:
self.app.inform.emit("[ERROR]The Toolchange X,Y field in Edit -> Preferences has to be "
"in the format (x, y) \nbut now there is only one value, not two. ")
return 'fail'
@ -4801,7 +4801,7 @@ class CNCjob(Geometry):
pass
self.startz = startz
self.endz = endz
self.z_end = endz
self.pp_excellon = self.app.postprocessors[self.pp_excellon_name]
p = self.pp_excellon
@ -4851,9 +4851,9 @@ class CNCjob(Geometry):
gcode += self.doformat(p.feedrate_code)
if toolchange is False:
if self.toolchange_xy is not None:
gcode += self.doformat(p.lift_code, x=self.toolchange_xy[0], y=self.toolchange_xy[1])
gcode += self.doformat(p.startz_code, x=self.toolchange_xy[0], y=self.toolchange_xy[1])
if self.xy_toolchange is not None:
gcode += self.doformat(p.lift_code, x=self.xy_toolchange[0], y=self.xy_toolchange[1])
gcode += self.doformat(p.startz_code, x=self.xy_toolchange[0], y=self.xy_toolchange[1])
else:
gcode += self.doformat(p.lift_code, x=0.0, y=0.0)
gcode += self.doformat(p.startz_code, x=0.0, y=0.0)
@ -4890,9 +4890,9 @@ class CNCjob(Geometry):
locations.append((point.coords.xy[0][0], point.coords.xy[1][0]))
return locations
if self.toolchange_xy is not None:
self.oldx = self.toolchange_xy[0]
self.oldy = self.toolchange_xy[1]
if self.xy_toolchange is not None:
self.oldx = self.xy_toolchange[0]
self.oldy = self.xy_toolchange[1]
else:
self.oldx = 0.0
self.oldy = 0.0
@ -5200,7 +5200,7 @@ class CNCjob(Geometry):
self.z_move = float(z_move) if z_move else None
self.feedrate = float(feedrate) if feedrate else None
self.feedrate_z = float(feedrate_z) if feedrate_z else None
self.z_feedrate = float(feedrate_z) if feedrate_z else None
self.feedrate_rapid = float(feedrate_rapid) if feedrate_rapid else None
self.spindlespeed = int(spindlespeed) if spindlespeed else None
@ -5208,22 +5208,22 @@ class CNCjob(Geometry):
self.dwelltime = float(dwelltime) if dwelltime else None
self.startz = float(startz) if startz else None
self.endz = float(endz) if endz else None
self.z_end = float(endz) if endz else None
self.depthpercut = float(depthpercut) if depthpercut else None
self.z_depthpercut = float(depthpercut) if depthpercut else None
self.multidepth = multidepth
self.toolchangez = float(toolchangez) if toolchangez else None
self.z_toolchange = float(toolchangez) if toolchangez else None
# it servers in the postprocessor file
self.tool = tool_no
try:
if toolchangexy == '':
self.toolchange_xy = None
self.xy_toolchange = None
else:
self.toolchange_xy = [float(eval(a)) for a in toolchangexy.split(",")]
if len(self.toolchange_xy) < 2:
self.xy_toolchange = [float(eval(a)) for a in toolchangexy.split(",")]
if len(self.xy_toolchange) < 2:
self.app.inform.emit("[ERROR]The Toolchange X,Y field in Edit -> Preferences has to be "
"in the format (x, y) \nbut now there is only one value, not two. ")
return 'fail'
@ -5286,7 +5286,7 @@ class CNCjob(Geometry):
if toolchange:
# if "line_xyz" in self.pp_geometry_name:
# self.gcode += self.doformat(p.toolchange_code, x=self.toolchange_xy[0], y=self.toolchange_xy[1])
# self.gcode += self.doformat(p.toolchange_code, x=self.xy_toolchange[0], y=self.xy_toolchange[1])
# else:
# self.gcode += self.doformat(p.toolchange_code)
self.gcode += self.doformat(p.toolchange_code)
@ -5447,7 +5447,7 @@ class CNCjob(Geometry):
self.feedrate = float(feedrate) if feedrate else None
self.feedrate_z = float(feedrate_z) if feedrate_z else None
self.z_feedrate = float(feedrate_z) if feedrate_z else None
self.feedrate_rapid = float(feedrate_rapid) if feedrate_rapid else None
@ -5459,20 +5459,20 @@ class CNCjob(Geometry):
self.startz = float(startz) if startz else None
self.endz = float(endz) if endz else None
self.z_end = float(endz) if endz else None
self.depthpercut = float(depthpercut) if depthpercut else None
self.z_depthpercut = float(depthpercut) if depthpercut else None
self.multidepth = multidepth
self.toolchangez = float(toolchangez) if toolchangez else None
self.z_toolchange = float(toolchangez) if toolchangez else None
try:
if toolchangexy == '':
self.toolchange_xy = None
self.xy_toolchange = None
else:
self.toolchange_xy = [float(eval(a)) for a in toolchangexy.split(",")]
if len(self.toolchange_xy) < 2:
self.xy_toolchange = [float(eval(a)) for a in toolchangexy.split(",")]
if len(self.xy_toolchange) < 2:
self.app.inform.emit("[ERROR]The Toolchange X,Y field in Edit -> Preferences has to be "
"in the format (x, y) \nbut now there is only one value, not two. ")
return 'fail'
@ -5538,7 +5538,7 @@ class CNCjob(Geometry):
if toolchange:
# if "line_xyz" in self.pp_geometry_name:
# self.gcode += self.doformat(p.toolchange_code, x=self.toolchange_xy[0], y=self.toolchange_xy[1])
# self.gcode += self.doformat(p.toolchange_code, x=self.xy_toolchange[0], y=self.xy_toolchange[1])
# else:
# self.gcode += self.doformat(p.toolchange_code)
self.gcode += self.doformat(p.toolchange_code)
@ -5705,11 +5705,11 @@ class CNCjob(Geometry):
gcode += self.doformat(p.rapid_code, x=path[0][0], y=path[0][1]) # Move to first point
# Move down to cutting depth
gcode += self.doformat(p.feedrate_z_code)
gcode += self.doformat(p.z_feedrate_code)
gcode += self.doformat(p.down_z_start_code)
gcode += self.doformat(p.spindle_fwd_code) # Start dispensing
gcode += self.doformat(p.dwell_fwd_code)
gcode += self.doformat(p.feedrate_z_dispense_code)
gcode += self.doformat(p.z_feedrate_dispense_code)
gcode += self.doformat(p.lift_z_dispense_code)
gcode += self.doformat(p.feedrate_xy_code)
@ -5723,12 +5723,12 @@ class CNCjob(Geometry):
gcode += self.doformat(p.down_z_stop_code)
gcode += self.doformat(p.spindle_off_code)
gcode += self.doformat(p.dwell_rev_code)
gcode += self.doformat(p.feedrate_z_code)
gcode += self.doformat(p.z_feedrate_code)
gcode += self.doformat(p.lift_code)
elif type(geometry) == Point:
gcode += self.doformat(p.linear_code, x=path[0][0], y=path[0][1]) # Move to first point
gcode += self.doformat(p.feedrate_z_dispense_code)
gcode += self.doformat(p.z_feedrate_dispense_code)
gcode += self.doformat(p.down_z_start_code)
gcode += self.doformat(p.spindle_fwd_code) # Start dispensing
gcode += self.doformat(p.dwell_fwd_code)
@ -5739,7 +5739,7 @@ class CNCjob(Geometry):
gcode += self.doformat(p.spindle_off_code)
gcode += self.doformat(p.down_z_stop_code)
gcode += self.doformat(p.dwell_rev_code)
gcode += self.doformat(p.feedrate_z_code)
gcode += self.doformat(p.z_feedrate_code)
gcode += self.doformat(p.lift_code)
return gcode
@ -5772,17 +5772,17 @@ class CNCjob(Geometry):
else:
z_cut = Decimal(self.z_cut).quantize(Decimal('0.000000001'))
if self.depthpercut is None:
self.depthpercut = z_cut
elif not isinstance(self.depthpercut, Decimal):
self.depthpercut = Decimal(self.depthpercut).quantize(Decimal('0.000000001'))
if self.z_depthpercut is None:
self.z_depthpercut = z_cut
elif not isinstance(self.z_depthpercut, Decimal):
self.z_depthpercut = Decimal(self.z_depthpercut).quantize(Decimal('0.000000001'))
depth = 0
reverse = False
while depth > z_cut:
# Increase depth. Limit to z_cut.
depth -= self.depthpercut
depth -= self.z_depthpercut
if depth < z_cut:
depth = z_cut
@ -6180,7 +6180,7 @@ class CNCjob(Geometry):
feedrate = self.feedrate
if feedrate_z is None:
feedrate_z = self.feedrate_z
feedrate_z = self.z_feedrate
if feedrate_rapid is None:
feedrate_rapid = self.feedrate_rapid
@ -6205,7 +6205,7 @@ class CNCjob(Geometry):
# Move down to cutting depth
if down:
# Different feedrate for vertical cut?
gcode += self.doformat(p.feedrate_z_code)
gcode += self.doformat(p.z_feedrate_code)
# gcode += self.doformat(p.feedrate_code)
gcode += self.doformat(p.down_code, x=path[0][0], y=path[0][1], z_cut=z_cut)
gcode += self.doformat(p.feedrate_code, feedrate=feedrate)
@ -6250,7 +6250,7 @@ class CNCjob(Geometry):
feedrate = self.feedrate
if feedrate_z is None:
feedrate_z = self.feedrate_z
feedrate_z = self.z_feedrate
if feedrate_rapid is None:
feedrate_rapid = self.feedrate_rapid
@ -6273,8 +6273,8 @@ class CNCjob(Geometry):
# Move down to cutting depth
if down:
# Different feedrate for vertical cut?
if self.feedrate_z is not None:
gcode += self.doformat(p.feedrate_z_code)
if self.z_feedrate is not None:
gcode += self.doformat(p.z_feedrate_code)
# gcode += self.doformat(p.feedrate_code)
gcode += self.doformat(p.down_code, x=path[0][0], y=path[0][1], z_cut=z_cut)
gcode += self.doformat(p.feedrate_code, feedrate=feedrate)
@ -6302,8 +6302,8 @@ class CNCjob(Geometry):
p = self.pp_geometry
gcode += self.doformat(p.linear_code, x=path[0][0], y=path[0][1]) # Move to first point
if self.feedrate_z is not None:
gcode += self.doformat(p.feedrate_z_code)
if self.z_feedrate is not None:
gcode += self.doformat(p.z_feedrate_code)
gcode += self.doformat(p.down_code, x=path[0][0], y=path[0][1], z_cut = self.z_cut)
gcode += self.doformat(p.feedrate_code)
else:

View File

@ -59,13 +59,13 @@ class Paste_1(FlatCAMPostProc_Tools):
return 'G01 Z' + self.coordinate_format%(p.coords_decimals, float(p['z_stop']))
def toolchange_code(self, p):
toolchangez = float(p['z_toolchange'])
z_toolchange = float(p['z_toolchange'])
toolchangexy = [float(eval(a)) for a in p['xy_toolchange'].split(",")]
gcode = ''
if toolchangexy is not None:
toolchangex = toolchangexy[0]
toolchangey = toolchangexy[1]
x_toolchange = toolchangexy[0]
y_toolchange = toolchangexy[1]
if p.units.upper() == 'MM':
toolC_formatted = format(float(p['toolC']), '.2f')
@ -74,26 +74,26 @@ class Paste_1(FlatCAMPostProc_Tools):
if toolchangexy is not None:
gcode = """
G00 Z{toolchangez}
G00 X{toolchangex} Y{toolchangey}
G00 Z{z_toolchange}
G00 X{x_toolchange} Y{y_toolchange}
T{tool}
M6
(MSG, Change to Tool with Nozzle Dia = {toolC})
M0
""".format(toolchangex=self.coordinate_format % (p.coords_decimals, toolchangex),
toolchangey=self.coordinate_format % (p.coords_decimals, toolchangey),
toolchangez=self.coordinate_format % (p.coords_decimals, toolchangez),
""".format(x_toolchange=self.coordinate_format % (p.coords_decimals, x_toolchange),
y_toolchange=self.coordinate_format % (p.coords_decimals, y_toolchange),
z_toolchange=self.coordinate_format % (p.coords_decimals, z_toolchange),
tool=int(int(p.tool)),
toolC=toolC_formatted)
else:
gcode = """
G00 Z{toolchangez}
G00 Z{z_toolchange}
T{tool}
M6
(MSG, Change to Tool with Nozzle Dia = {toolC})
M0
""".format(toolchangez=self.coordinate_format % (p.coords_decimals, toolchangez),
""".format(z_toolchange=self.coordinate_format % (p.coords_decimals, z_toolchange),
tool=int(int(p.tool)),
toolC=toolC_formatted)
@ -121,7 +121,7 @@ M0
def feedrate_xy_code(self, p):
return 'G01 F' + str(self.feedrate_format %(p.fr_decimals, float(p['frxy'])))
def feedrate_z_code(self, p):
def z_feedrate_code(self, p):
return 'G01 F' + str(self.feedrate_format %(p.fr_decimals, float(p['frz'])))
def feedrate_z_dispense_code(self, p):

View File

@ -9,7 +9,7 @@ class Repetier(FlatCAMPostProc):
def start_code(self, p):
units = ' ' + str(p['units']).lower()
coords_xy = p['toolchange_xy']
coords_xy = p['xy_toolchange']
gcode = ''
xmin = '%.*f' % (p.coords_decimals, p['options']['xmin'])
@ -23,18 +23,18 @@ class Repetier(FlatCAMPostProc):
gcode += ';Feedrate: ' + str(p['feedrate']) + units + '/min' + '\n'
if str(p['options']['type']) == 'Geometry':
gcode += ';Feedrate_Z: ' + str(p['feedrate_z']) + units + '/min' + '\n'
gcode += ';Feedrate_Z: ' + str(p['z_feedrate']) + units + '/min' + '\n'
gcode += ';Feedrate rapids ' + str(p['feedrate_rapid']) + units + '/min' + '\n' + '\n'
gcode += ';Z_Cut: ' + str(p['z_cut']) + units + '\n'
if str(p['options']['type']) == 'Geometry':
if p['multidepth'] is True:
gcode += ';DepthPerCut: ' + str(p['depthpercut']) + units + ' <=>' + \
str(math.ceil(abs(p['z_cut']) / p['depthpercut'])) + ' passes' + '\n'
gcode += ';DepthPerCut: ' + str(p['z_depthpercut']) + units + ' <=>' + \
str(math.ceil(abs(p['z_cut']) / p['z_depthpercut'])) + ' passes' + '\n'
gcode += ';Z_Move: ' + str(p['z_move']) + units + '\n'
gcode += ';Z Toolchange: ' + str(p['toolchangez']) + units + '\n'
gcode += ';Z Toolchange: ' + str(p['z_toolchange']) + units + '\n'
if coords_xy is not None:
gcode += ';X,Y Toolchange: ' + "%.4f, %.4f" % (coords_xy[0], coords_xy[1]) + units + '\n'
@ -42,7 +42,7 @@ class Repetier(FlatCAMPostProc):
gcode += ';X,Y Toolchange: ' + "None" + units + '\n'
gcode += ';Z Start: ' + str(p['startz']) + units + '\n'
gcode += ';Z End: ' + str(p['endz']) + units + '\n'
gcode += ';Z End: ' + str(p['z_end']) + 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':
@ -73,19 +73,19 @@ class Repetier(FlatCAMPostProc):
return 'G1 Z' + self.coordinate_format%(p.coords_decimals, p.z_cut) + " " + self.end_feedrate_code(p)
def toolchange_code(self, p):
toolchangez = p.toolchangez
toolchangexy = p.toolchange_xy
z_toolchange = p.z_toolchange
toolchangexy = p.xy_toolchange
f_plunge = p.f_plunge
gcode = ''
if toolchangexy is not None:
toolchangex = toolchangexy[0]
toolchangey = toolchangexy[1]
x_toolchange = toolchangexy[0]
y_toolchange = toolchangexy[1]
no_drills = 1
if int(p.tool) == 1 and p.startz is not None:
toolchangez = p.startz
z_toolchange = p.startz
if p.units.upper() == 'MM':
toolC_formatted = format(p.toolC, '.2f')
@ -99,22 +99,22 @@ class Repetier(FlatCAMPostProc):
if toolchangexy is not None:
gcode = """
G0 Z{toolchangez}
G0 X{toolchangex} Y{toolchangey}
G0 Z{z_toolchange}
G0 X{x_toolchange} Y{y_toolchange}
M84
@pause Change to Tool Dia = {toolC}, Total drills for tool T{tool} = {t_drills}
""".format(toolchangex=self.coordinate_format % (p.coords_decimals, toolchangex),
toolchangey=self.coordinate_format % (p.coords_decimals, toolchangey),
toolchangez=self.coordinate_format % (p.coords_decimals, toolchangez),
""".format(x_toolchange=self.coordinate_format % (p.coords_decimals, x_toolchange),
y_toolchange=self.coordinate_format % (p.coords_decimals, y_toolchange),
z_toolchange=self.coordinate_format % (p.coords_decimals, z_toolchange),
tool=int(p.tool),
t_drills=no_drills,
toolC=toolC_formatted)
else:
gcode = """
G0 Z{toolchangez}
G0 Z{z_toolchange}
M84
@pause Change to Tool Dia = {toolC}, Total drills for tool T{tool} = {t_drills}
""".format(toolchangez=self.coordinate_format % (p.coords_decimals, toolchangez),
""".format(z_toolchange=self.coordinate_format % (p.coords_decimals, z_toolchange),
tool=int(p.tool),
t_drills=no_drills,
toolC=toolC_formatted)
@ -127,21 +127,21 @@ M84
else:
if toolchangexy is not None:
gcode = """
G0 Z{toolchangez}
G0 X{toolchangex} Y{toolchangey}
G0 Z{z_toolchange}
G0 X{x_toolchange} Y{y_toolchange}
M84
@pause Change to tool T{tool} with Tool Dia = {toolC}
""".format(toolchangex=self.coordinate_format % (p.coords_decimals, toolchangex),
toolchangey=self.coordinate_format % (p.coords_decimals, toolchangey),
toolchangez=self.coordinate_format % (p.coords_decimals, toolchangez),
""".format(x_toolchange=self.coordinate_format % (p.coords_decimals, x_toolchange),
y_toolchange=self.coordinate_format % (p.coords_decimals, y_toolchange),
z_toolchange=self.coordinate_format % (p.coords_decimals, z_toolchange),
tool=int(p.tool),
toolC=toolC_formatted)
else:
gcode = """
G0 Z{toolchangez}
G0 Z{z_toolchange}
M84
@pause Change to tool T{tool} with Tool Dia = {toolC}
""".format(toolchangez=self.coordinate_format%(p.coords_decimals, toolchangez),
""".format(z_toolchange=self.coordinate_format%(p.coords_decimals, z_toolchange),
tool=int(p.tool),
toolC=toolC_formatted)
@ -164,8 +164,8 @@ M84
return ('G1 ' + self.position_code(p)).format(**p) + " " + self.end_feedrate_code(p)
def end_code(self, p):
coords_xy = p['toolchange_xy']
gcode = ('G0 Z' + self.feedrate_format %(p.fr_decimals, p.endz) + " " + self.feedrate_rapid_code(p) + "\n")
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"
@ -178,8 +178,8 @@ M84
def end_feedrate_code(self, p):
return 'F' + self.feedrate_format %(p.fr_decimals, p.feedrate)
def feedrate_z_code(self, p):
return 'G1 F' + str(self.feedrate_format %(p.fr_decimals, p.feedrate_z))
def z_feedrate_code(self, p):
return 'G1 F' + str(self.feedrate_format %(p.fr_decimals, p.z_feedrate))
def feedrate_rapid_code(self, p):
return 'F' + self.feedrate_rapid_format % (p.fr_decimals, p.feedrate_rapid)

View File

@ -72,9 +72,9 @@ class Roland_MDX_20(FlatCAMPostProc):
def end_code(self, p):
if p.units.upper() == 'IN':
z = p.endz / 25.4
z = p.z_end / 25.4
else:
z = p.endz
z = p.z_end
gcode = self.feedrate_rapid_code(p) + '\n'
gcode += self.position_code(p).format(**p) + ',' + str(float(z * 40.0)) + ';'
return gcode
@ -89,13 +89,13 @@ class Roland_MDX_20(FlatCAMPostProc):
fr_sec = 6
return 'V' + str(self.feedrate_format % fr_sec) + ';'
def feedrate_z_code(self, p):
fr_sec = p.feedrate_z / 60
def z_feedrate_code(self, p):
fr_sec = p.z_feedrate / 60
# valid feedrate for MDX20 is between 0.1mm/sec and 15mm/sec (6mm/min to 900mm/min)
if p.feedrate_z >= 900:
if p.z_feedrate >= 900:
fr_sec = 15
if p.feedrate_z < 6:
if p.z_feedrate < 6:
fr_sec = 6
return 'V' + str(self.feedrate_format % fr_sec) + ';'

View File

@ -8,7 +8,7 @@ class Toolchange_Custom(FlatCAMPostProc):
def start_code(self, p):
units = ' ' + str(p['units']).lower()
coords_xy = p['toolchange_xy']
coords_xy = p['xy_toolchange']
gcode = ''
xmin = '%.*f' % (p.coords_decimals, p['options']['xmin'])
@ -22,18 +22,18 @@ class Toolchange_Custom(FlatCAMPostProc):
gcode += '(Feedrate: ' + str(p['feedrate']) + units + '/min' + ')\n'
if str(p['options']['type']) == 'Geometry':
gcode += '(Feedrate_Z: ' + str(p['feedrate_z']) + units + '/min' + ')\n'
gcode += '(Feedrate_Z: ' + str(p['z_feedrate']) + units + '/min' + ')\n'
gcode += '(Feedrate rapids ' + str(p['feedrate_rapid']) + units + '/min' + ')\n' + '\n'
gcode += '(Z_Cut: ' + str(p['z_cut']) + units + ')\n'
if str(p['options']['type']) == 'Geometry':
if p['multidepth'] is True:
gcode += '(DepthPerCut: ' + str(p['depthpercut']) + units + ' <=>' + \
str(math.ceil(abs(p['z_cut']) / p['depthpercut'])) + ' passes' + ')\n'
gcode += '(DepthPerCut: ' + str(p['z_depthpercut']) + units + ' <=>' + \
str(math.ceil(abs(p['z_cut']) / p['z_depthpercut'])) + ' passes' + ')\n'
gcode += '(Z_Move: ' + str(p['z_move']) + units + ')\n'
gcode += '(Z Toolchange: ' + str(p['toolchangez']) + units + ')\n'
gcode += '(Z Toolchange: ' + str(p['z_toolchange']) + units + ')\n'
if coords_xy is not None:
gcode += '(X,Y Toolchange: ' + "%.4f, %.4f" % (coords_xy[0], coords_xy[1]) + units + ')\n'
@ -41,7 +41,7 @@ class Toolchange_Custom(FlatCAMPostProc):
gcode += '(X,Y Toolchange: ' + "None" + units + ')\n'
gcode += '(Z Start: ' + str(p['startz']) + units + ')\n'
gcode += '(Z End: ' + str(p['endz']) + units + ')\n'
gcode += '(Z End: ' + str(p['z_end']) + 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':
@ -71,19 +71,19 @@ class Toolchange_Custom(FlatCAMPostProc):
return 'G01 Z' + self.coordinate_format%(p.coords_decimals, p.z_cut)
def toolchange_code(self, p):
toolchangez = p.toolchangez
toolchangexy = p.toolchange_xy
z_toolchange = p.z_toolchange
toolchangexy = p.xy_toolchange
f_plunge = p.f_plunge
gcode = ''
if toolchangexy is not None:
toolchangex = toolchangexy[0]
toolchangey = toolchangexy[1]
x_toolchange = toolchangexy[0]
y_toolchange = toolchangexy[1]
no_drills = 1
if int(p.tool) == 1 and p.startz is not None:
toolchangez = p.startz
z_toolchange = p.startz
if p.units.upper() == 'MM':
toolC_formatted = format(p.toolC, '.2f')
@ -98,8 +98,8 @@ class Toolchange_Custom(FlatCAMPostProc):
if toolchangexy is not None:
gcode = """
M6
""".format(toolchangex=self.coordinate_format % (p.coords_decimals, toolchangex),
toolchangey=self.coordinate_format % (p.coords_decimals, toolchangey),
""".format(x_toolchange=self.coordinate_format % (p.coords_decimals, x_toolchange),
y_toolchange=self.coordinate_format % (p.coords_decimals, y_toolchange),
tool=int(p.tool),
t_drills=no_drills,
toolC=toolC_formatted)
@ -112,8 +112,8 @@ M6
if toolchangexy is not None:
gcode = """
M6
""".format(toolchangex=self.coordinate_format % (p.coords_decimals, toolchangex),
toolchangey=self.coordinate_format % (p.coords_decimals, toolchangey),
""".format(x_toolchange=self.coordinate_format % (p.coords_decimals, x_toolchange),
y_toolchange=self.coordinate_format % (p.coords_decimals, y_toolchange),
tool=int(p.tool),
toolC=toolC_formatted)
@ -135,8 +135,8 @@ M6
return ('G01 ' + self.position_code(p)).format(**p)
def end_code(self, p):
coords_xy = p['toolchange_xy']
gcode = ('G00 Z' + self.feedrate_format %(p.fr_decimals, p.endz) + "\n")
coords_xy = p['xy_toolchange']
gcode = ('G00 Z' + self.feedrate_format %(p.fr_decimals, p.z_end) + "\n")
if coords_xy is not None:
gcode += 'G00 X{x} Y{y}'.format(x=coords_xy[0], y=coords_xy[1]) + "\n"
@ -145,8 +145,8 @@ M6
def feedrate_code(self, p):
return 'G01 F' + str(self.feedrate_format %(p.fr_decimals, p.feedrate))
def feedrate_z_code(self, p):
return 'G01 F' + str(self.feedrate_format %(p.fr_decimals, p.feedrate_z))
def z_feedrate_code(self, p):
return 'G01 F' + str(self.feedrate_format %(p.fr_decimals, p.z_feedrate))
def spindle_code(self, p):
if p.spindlespeed:

View File

@ -8,7 +8,7 @@ class Toolchange_Probe_MACH3(FlatCAMPostProc):
def start_code(self, p):
units = ' ' + str(p['units']).lower()
coords_xy = p['toolchange_xy']
coords_xy = p['xy_toolchange']
gcode = ''
xmin = '%.*f' % (p.coords_decimals, p['options']['xmin'])
@ -22,7 +22,7 @@ class Toolchange_Probe_MACH3(FlatCAMPostProc):
gcode += '(Feedrate: ' + str(p['feedrate']) + units + '/min' + ')\n'
if str(p['options']['type']) == 'Geometry':
gcode += '(Feedrate_Z: ' + str(p['feedrate_z']) + units + '/min' + ')\n'
gcode += '(Feedrate_Z: ' + str(p['z_feedrate']) + units + '/min' + ')\n'
gcode += '(Feedrate rapids ' + str(p['feedrate_rapid']) + units + '/min' + ')\n' + '\n'
gcode += '(Feedrate Probe ' + str(p['feedrate_probe']) + units + '/min' + ')\n' + '\n'
@ -30,11 +30,11 @@ class Toolchange_Probe_MACH3(FlatCAMPostProc):
if str(p['options']['type']) == 'Geometry':
if p['multidepth'] is True:
gcode += '(DepthPerCut: ' + str(p['depthpercut']) + units + ' <=>' + \
str(math.ceil(abs(p['z_cut']) / p['depthpercut'])) + ' passes' + ')\n'
gcode += '(DepthPerCut: ' + str(p['z_depthpercut']) + units + ' <=>' + \
str(math.ceil(abs(p['z_cut']) / p['z_depthpercut'])) + ' passes' + ')\n'
gcode += '(Z_Move: ' + str(p['z_move']) + units + ')\n'
gcode += '(Z Toolchange: ' + str(p['toolchangez']) + units + ')\n'
gcode += '(Z Toolchange: ' + str(p['z_toolchange']) + units + ')\n'
if coords_xy is not None:
gcode += '(X,Y Toolchange: ' + "%.4f, %.4f" % (coords_xy[0], coords_xy[1]) + units + ')\n'
@ -42,7 +42,7 @@ class Toolchange_Probe_MACH3(FlatCAMPostProc):
gcode += '(X,Y Toolchange: ' + "None" + units + ')\n'
gcode += '(Z Start: ' + str(p['startz']) + units + ')\n'
gcode += '(Z End: ' + str(p['endz']) + units + ')\n'
gcode += '(Z End: ' + str(p['z_end']) + units + ')\n'
gcode += '(Z Probe Depth: ' + str(p['z_pdepth']) + units + ')\n'
gcode += '(Steps per circle: ' + str(p['steps_per_circle']) + ')\n'
@ -76,20 +76,20 @@ class Toolchange_Probe_MACH3(FlatCAMPostProc):
return 'G01 Z' + self.coordinate_format%(p.coords_decimals, p.z_cut)
def toolchange_code(self, p):
toolchangez = p.toolchangez
toolchangexy = p.toolchange_xy
z_toolchange = p.z_toolchange
toolchangexy = p.xy_toolchange
f_plunge = p.f_plunge
gcode = ''
if toolchangexy is not None:
toolchangex = toolchangexy[0]
toolchangey = toolchangexy[1]
x_toolchange = toolchangexy[0]
y_toolchange = toolchangexy[1]
no_drills = 1
if int(p.tool) == 1 and p.startz is not None:
toolchangez = p.startz
z_toolchange = p.startz
if p.units.upper() == 'MM':
toolC_formatted = format(p.toolC, '.2f')
@ -106,8 +106,8 @@ class Toolchange_Probe_MACH3(FlatCAMPostProc):
M5
T{tool}
M6
G00 Z{toolchangez}
G00 X{toolchangex} Y{toolchangey}
G00 Z{z_toolchange}
G00 X{x_toolchange} Y{y_toolchange}
(MSG, Change to Tool Dia = {toolC} ||| CONNECT THE PROBE ||| Drills for this tool = {t_drills})
M0
F{feedrate_probe}
@ -120,9 +120,9 @@ G92 Z0
G00 Z{z_move}
(MSG, Remove any clips or other devices used for probing. CNC work is resuming ...)
M0
""".format(toolchangex=self.coordinate_format % (p.coords_decimals, toolchangex),
toolchangey=self.coordinate_format % (p.coords_decimals, toolchangey),
toolchangez=self.coordinate_format % (p.coords_decimals, toolchangez),
""".format(x_toolchange=self.coordinate_format % (p.coords_decimals, x_toolchange),
y_toolchange=self.coordinate_format % (p.coords_decimals, y_toolchange),
z_toolchange=self.coordinate_format % (p.coords_decimals, z_toolchange),
z_move=self.coordinate_format % (p.coords_decimals, p.z_move),
z_in_between=self.coordinate_format % (p.coords_decimals, p.z_move / 2),
feedrate_probe=str(self.feedrate_format %(p.fr_decimals, p.feedrate_probe)),
@ -136,7 +136,7 @@ M0
M5
T{tool}
M6
G00 Z{toolchangez}
G00 Z{z_toolchange}
(MSG, Change to Tool Dia = {toolC} ||| CONNECT THE PROBE ||| Drills for this tool = {t_drills})
M0
F{feedrate_probe}
@ -149,7 +149,7 @@ G92 Z0
G00 Z{z_move}
(MSG, Remove any clips or other devices used for probing. CNC work is resuming ...)
M0
""".format(toolchangez=self.coordinate_format % (p.coords_decimals, toolchangez),
""".format(z_toolchange=self.coordinate_format % (p.coords_decimals, z_toolchange),
z_move=self.coordinate_format % (p.coords_decimals, p.z_move),
z_in_between=self.coordinate_format % (p.coords_decimals, p.z_move / 2),
feedrate_probe=str(self.feedrate_format %(p.fr_decimals, p.feedrate_probe)),
@ -169,8 +169,8 @@ M0
M5
T{tool}
M6
G00 Z{toolchangez}
G00 X{toolchangex} Y{toolchangey}
G00 Z{z_toolchange}
G00 X{x_toolchange} Y{y_toolchange}
(MSG, Change to Tool Dia = {toolC} ||| CONNECT THE PROBE)
M0
F{feedrate_probe}
@ -183,9 +183,9 @@ G92 Z0
G00 Z{z_move}
(MSG, Remove any clips or other devices used for probing. CNC work is resuming ...)
M0
""".format(toolchangex=self.coordinate_format % (p.coords_decimals, toolchangex),
toolchangey=self.coordinate_format % (p.coords_decimals, toolchangey),
toolchangez=self.coordinate_format % (p.coords_decimals, toolchangez),
""".format(x_toolchange=self.coordinate_format % (p.coords_decimals, x_toolchange),
y_toolchange=self.coordinate_format % (p.coords_decimals, y_toolchange),
z_toolchange=self.coordinate_format % (p.coords_decimals, z_toolchange),
z_move=self.coordinate_format % (p.coords_decimals, p.z_move),
z_in_between=self.coordinate_format % (p.coords_decimals, p.z_move / 2),
feedrate_probe=str(self.feedrate_format %(p.fr_decimals, p.feedrate_probe)),
@ -198,7 +198,7 @@ M0
M5
T{tool}
M6
G00 Z{toolchangez}
G00 Z{z_toolchange}
(MSG, Change to Tool Dia = {toolC} ||| CONNECT THE PROBE)
M0
F{feedrate_probe}
@ -211,7 +211,7 @@ G92 Z0
G00 Z{z_move}
(MSG, Remove any clips or other devices used for probing. CNC work is resuming ...)
M0
""".format(toolchangez=self.coordinate_format % (p.coords_decimals, toolchangez),
""".format(z_toolchange=self.coordinate_format % (p.coords_decimals, z_toolchange),
z_move=self.coordinate_format % (p.coords_decimals, p.z_move),
z_in_between=self.coordinate_format % (p.coords_decimals, p.z_move / 2),
feedrate_probe=str(self.feedrate_format %(p.fr_decimals, p.feedrate_probe)),
@ -238,8 +238,8 @@ M0
return ('G01 ' + self.position_code(p)).format(**p)
def end_code(self, p):
coords_xy = p['toolchange_xy']
gcode = ('G00 Z' + self.feedrate_format %(p.fr_decimals, p.endz) + "\n")
coords_xy = p['xy_toolchange']
gcode = ('G00 Z' + self.feedrate_format %(p.fr_decimals, p.z_end) + "\n")
if coords_xy is not None:
gcode += 'G00 X{x} Y{y}'.format(x=coords_xy[0], y=coords_xy[1]) + "\n"
@ -248,8 +248,8 @@ M0
def feedrate_code(self, p):
return 'G01 F' + str(self.feedrate_format %(p.fr_decimals, p.feedrate))
def feedrate_z_code(self, p):
return 'G01 F' + str(self.feedrate_format %(p.fr_decimals, p.feedrate_z))
def z_feedrate_code(self, p):
return 'G01 F' + str(self.feedrate_format %(p.fr_decimals, p.z_feedrate))
def spindle_code(self, p):
if p.spindlespeed:

View File

@ -8,7 +8,7 @@ class Toolchange_manual(FlatCAMPostProc):
def start_code(self, p):
units = ' ' + str(p['units']).lower()
coords_xy = p['toolchange_xy']
coords_xy = p['xy_toolchange']
gcode = ''
xmin = '%.*f' % (p.coords_decimals, p['options']['xmin'])
@ -22,24 +22,24 @@ class Toolchange_manual(FlatCAMPostProc):
gcode += '(Feedrate: ' + str(p['feedrate']) + units + '/min' + ')\n'
if str(p['options']['type']) == 'Geometry':
gcode += '(Feedrate_Z: ' + str(p['feedrate_z']) + units + '/min' + ')\n'
gcode += '(Feedrate_Z: ' + str(p['z_feedrate']) + units + '/min' + ')\n'
gcode += '(Feedrate rapids ' + str(p['feedrate_rapid']) + units + '/min' + ')\n' + '\n'
gcode += '(Z_Cut: ' + str(p['z_cut']) + units + ')\n'
if str(p['options']['type']) == 'Geometry':
if p['multidepth'] is True:
gcode += '(DepthPerCut: ' + str(p['depthpercut']) + units + ' <=>' + \
str(math.ceil(abs(p['z_cut']) / p['depthpercut'])) + ' passes' + ')\n'
gcode += '(DepthPerCut: ' + str(p['z_depthpercut']) + units + ' <=>' + \
str(math.ceil(abs(p['z_cut']) / p['z_depthpercut'])) + ' passes' + ')\n'
gcode += '(Z_Move: ' + str(p['z_move']) + units + ')\n'
gcode += '(Z Toolchange: ' + str(p['toolchangez']) + units + ')\n'
gcode += '(Z Toolchange: ' + str(p['z_toolchange']) + units + ')\n'
if coords_xy is not None:
gcode += '(X,Y Toolchange: ' + "%.4f, %.4f" % (coords_xy[0], coords_xy[1]) + units + ')\n'
else:
gcode += '(X,Y Toolchange: ' + "None" + units + ')\n'
gcode += '(Z Start: ' + str(p['startz']) + units + ')\n'
gcode += '(Z End: ' + str(p['endz']) + units + ')\n'
gcode += '(Z End: ' + str(p['z_end']) + 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':
@ -72,22 +72,22 @@ class Toolchange_manual(FlatCAMPostProc):
return 'G01 Z' + self.coordinate_format % (p.coords_decimals, p.z_cut)
def toolchange_code(self, p):
toolchangez = p.toolchangez
toolchangexy = p.toolchange_xy
z_toolchange = p.z_toolchange
toolchangexy = p.xy_toolchange
f_plunge = p.f_plunge
gcode = ''
if toolchangexy is not None:
toolchangex = toolchangexy[0]
toolchangey = toolchangexy[1]
x_toolchange = toolchangexy[0]
y_toolchange = toolchangexy[1]
# else:
# toolchangex = p.oldx
# toolchangey = p.oldy
# x_toolchange = p.oldx
# y_toolchange = p.oldy
no_drills = 1
if int(p.tool) == 1 and p.startz is not None:
toolchangez = p.startz
z_toolchange = p.startz
if p.units.upper() == 'MM':
toolC_formatted = format(p.toolC, '.2f')
@ -102,20 +102,20 @@ class Toolchange_manual(FlatCAMPostProc):
if toolchangexy is not None:
gcode = """
M5
G00 Z{toolchangez}
G00 Z{z_toolchange}
T{tool}
G00 X{toolchangex} Y{toolchangey}
G00 X{x_toolchange} Y{y_toolchange}
(MSG, Change to Tool Dia = {toolC} ||| Total drills for tool T{tool} = {t_drills})
M0
G01 Z0
(MSG, Adjust the tool T{tool} to touch the material and then tighten it slightly.)
M0
G00 Z{toolchangez}
G00 Z{z_toolchange}
(MSG, Now the tool can be tightened more securely.)
M0
""".format(toolchangex=self.coordinate_format%(p.coords_decimals, toolchangex),
toolchangey=self.coordinate_format%(p.coords_decimals, toolchangey),
toolchangez=self.coordinate_format%(p.coords_decimals, toolchangez),
""".format(x_toolchange=self.coordinate_format%(p.coords_decimals, x_toolchange),
y_toolchange=self.coordinate_format%(p.coords_decimals, y_toolchange),
z_toolchange=self.coordinate_format%(p.coords_decimals, z_toolchange),
tool=int(p.tool),
t_drills=no_drills,
toolC=toolC_formatted)
@ -123,18 +123,18 @@ M0
else:
gcode = """
M5
G00 Z{toolchangez}
G00 Z{z_toolchange}
T{tool}
(MSG, Change to Tool Dia = {toolC} ||| Total drills for tool T{tool} = {t_drills})
M0
G01 Z0
(MSG, Adjust the tool T{tool} to touch the material and then tighten it slightly.)
M0
G00 Z{toolchangez}
G00 Z{z_toolchange}
(MSG, Now the tool can be tightened more securely.)
M0
""".format(
toolchangez=self.coordinate_format%(p.coords_decimals, toolchangez),
z_toolchange=self.coordinate_format%(p.coords_decimals, z_toolchange),
tool=int(p.tool),
t_drills=no_drills,
toolC=toolC_formatted)
@ -147,36 +147,36 @@ M0
if toolchangexy is not None:
gcode = """
M5
G00 Z{toolchangez}
G00 Z{z_toolchange}
T{tool}
G00 X{toolchangex}Y{toolchangey}
G00 X{x_toolchange}Y{y_toolchange}
(MSG, Change to Tool Dia = {toolC})
M0
G01 Z0
(MSG, Adjust the tool T{tool} to touch the material and then tighten it slightly.)
M0
G00 Z{toolchangez}
G00 Z{z_toolchange}
(MSG, Now the tool can be tightened more securely.)
M0
""".format(toolchangex=self.coordinate_format%(p.coords_decimals, toolchangex),
toolchangey=self.coordinate_format%(p.coords_decimals, toolchangey),
toolchangez=self.coordinate_format%(p.coords_decimals, toolchangez),
""".format(x_toolchange=self.coordinate_format%(p.coords_decimals, x_toolchange),
y_toolchange=self.coordinate_format%(p.coords_decimals, y_toolchange),
z_toolchange=self.coordinate_format%(p.coords_decimals, z_toolchange),
tool=int(p.tool),
toolC=toolC_formatted)
else:
gcode = """
M5
G00 Z{toolchangez}
G00 Z{z_toolchange}
T{tool}
(MSG, Change to Tool Dia = {toolC})
M0
G01 Z0
(MSG, Adjust the tool T{tool} to touch the material and then tighten it slightly.)
M0
G00 Z{toolchangez}
G00 Z{z_toolchange}
(MSG, Now the tool can be tightened more securely.)
M0
""".format(toolchangez=self.coordinate_format%(p.coords_decimals, toolchangez),
""".format(z_toolchange=self.coordinate_format%(p.coords_decimals, z_toolchange),
tool=int(p.tool),
toolC=toolC_formatted)
@ -198,8 +198,8 @@ M0
return ('G01 ' + self.position_code(p)).format(**p)
def end_code(self, p):
coords_xy = p['toolchange_xy']
gcode = ('G00 Z' + self.feedrate_format %(p.fr_decimals, p.endz) + "\n")
coords_xy = p['xy_toolchange']
gcode = ('G00 Z' + self.feedrate_format %(p.fr_decimals, p.z_end) + "\n")
if coords_xy is not None:
gcode += 'G00 X{x} Y{y}'.format(x=coords_xy[0], y=coords_xy[1]) + "\n"
else:
@ -209,8 +209,8 @@ M0
def feedrate_code(self, p):
return 'G01 F' + str(self.feedrate_format %(p.fr_decimals, p.feedrate))
def feedrate_z_code(self, p):
return 'G01 F' + str(self.feedrate_format %(p.fr_decimals, p.feedrate_z))
def z_feedrate_code(self, p):
return 'G01 F' + str(self.feedrate_format %(p.fr_decimals, p.z_feedrate))
def spindle_code(self,p):
if p.spindlespeed:

View File

@ -8,7 +8,7 @@ class default(FlatCAMPostProc):
def start_code(self, p):
units = ' ' + str(p['units']).lower()
coords_xy = p['toolchange_xy']
coords_xy = p['xy_toolchange']
gcode = ''
xmin = '%.*f' % (p.coords_decimals, p['options']['xmin'])
@ -22,18 +22,18 @@ class default(FlatCAMPostProc):
gcode += '(Feedrate: ' + str(p['feedrate']) + units + '/min' + ')\n'
if str(p['options']['type']) == 'Geometry':
gcode += '(Feedrate_Z: ' + str(p['feedrate_z']) + units + '/min' + ')\n'
gcode += '(Feedrate_Z: ' + str(p['z_feedrate']) + units + '/min' + ')\n'
gcode += '(Feedrate rapids ' + str(p['feedrate_rapid']) + units + '/min' + ')\n' + '\n'
gcode += '(Z_Cut: ' + str(p['z_cut']) + units + ')\n'
if str(p['options']['type']) == 'Geometry':
if p['multidepth'] is True:
gcode += '(DepthPerCut: ' + str(p['depthpercut']) + units + ' <=>' + \
str(math.ceil(abs(p['z_cut']) / p['depthpercut'])) + ' passes' + ')\n'
gcode += '(DepthPerCut: ' + str(p['z_depthpercut']) + units + ' <=>' + \
str(math.ceil(abs(p['z_cut']) / p['z_depthpercut'])) + ' passes' + ')\n'
gcode += '(Z_Move: ' + str(p['z_move']) + units + ')\n'
gcode += '(Z Toolchange: ' + str(p['toolchangez']) + units + ')\n'
gcode += '(Z Toolchange: ' + str(p['z_toolchange']) + units + ')\n'
if coords_xy is not None:
gcode += '(X,Y Toolchange: ' + "%.4f, %.4f" % (coords_xy[0], coords_xy[1]) + units + ')\n'
@ -41,7 +41,7 @@ class default(FlatCAMPostProc):
gcode += '(X,Y Toolchange: ' + "None" + units + ')\n'
gcode += '(Z Start: ' + str(p['startz']) + units + ')\n'
gcode += '(Z End: ' + str(p['endz']) + units + ')\n'
gcode += '(Z End: ' + str(p['z_end']) + 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':
@ -73,19 +73,19 @@ class default(FlatCAMPostProc):
return 'G01 Z' + self.coordinate_format%(p.coords_decimals, p.z_cut)
def toolchange_code(self, p):
toolchangez = p.toolchangez
toolchangexy = p.toolchange_xy
z_toolchange = p.z_toolchange
toolchangexy = p.xy_toolchange
f_plunge = p.f_plunge
gcode = ''
if toolchangexy is not None:
toolchangex = toolchangexy[0]
toolchangey = toolchangexy[1]
x_toolchange = toolchangexy[0]
y_toolchange = toolchangexy[1]
no_drills = 1
if int(p.tool) == 1 and p.startz is not None:
toolchangez = p.startz
z_toolchange = p.startz
if p.units.upper() == 'MM':
toolC_formatted = format(p.toolC, '.2f')
@ -100,26 +100,26 @@ class default(FlatCAMPostProc):
if toolchangexy is not None:
gcode = """
M5
G00 Z{toolchangez}
G00 X{toolchangex} Y{toolchangey}
G00 Z{z_toolchange}
G00 X{x_toolchange} Y{y_toolchange}
T{tool}
M6
(MSG, Change to Tool Dia = {toolC} ||| Total drills for tool T{tool} = {t_drills})
M0
""".format(toolchangex=self.coordinate_format % (p.coords_decimals, toolchangex),
toolchangey=self.coordinate_format % (p.coords_decimals, toolchangey),
toolchangez=self.coordinate_format % (p.coords_decimals, toolchangez),
""".format(x_toolchange=self.coordinate_format % (p.coords_decimals, x_toolchange),
y_toolchange=self.coordinate_format % (p.coords_decimals, y_toolchange),
z_toolchange=self.coordinate_format % (p.coords_decimals, z_toolchange),
tool=int(p.tool),
t_drills=no_drills,
toolC=toolC_formatted)
else:
gcode = """
M5
G00 Z{toolchangez}
G00 Z{z_toolchange}
T{tool}
M6
(MSG, Change to Tool Dia = {toolC} ||| Total drills for tool T{tool} = {t_drills})
M0""".format(toolchangez=self.coordinate_format % (p.coords_decimals, toolchangez),
M0""".format(z_toolchange=self.coordinate_format % (p.coords_decimals, z_toolchange),
tool=int(p.tool),
t_drills=no_drills,
toolC=toolC_formatted)
@ -131,24 +131,24 @@ M0""".format(toolchangez=self.coordinate_format % (p.coords_decimals, toolchange
if toolchangexy is not None:
gcode = """
M5
G00 Z{toolchangez}
G00 X{toolchangex} Y{toolchangey}
G00 Z{z_toolchange}
G00 X{x_toolchange} Y{y_toolchange}
T{tool}
M6
(MSG, Change to Tool Dia = {toolC})
M0""".format(toolchangex=self.coordinate_format % (p.coords_decimals, toolchangex),
toolchangey=self.coordinate_format % (p.coords_decimals, toolchangey),
toolchangez=self.coordinate_format % (p.coords_decimals, toolchangez),
M0""".format(x_toolchange=self.coordinate_format % (p.coords_decimals, x_toolchange),
y_toolchange=self.coordinate_format % (p.coords_decimals, y_toolchange),
z_toolchange=self.coordinate_format % (p.coords_decimals, z_toolchange),
tool=int(p.tool),
toolC=toolC_formatted)
else:
gcode = """
M5
G00 Z{toolchangez}
G00 Z{z_toolchange}
T{tool}
M6
(MSG, Change to Tool Dia = {toolC})
M0""".format(toolchangez=self.coordinate_format%(p.coords_decimals, toolchangez),
M0""".format(z_toolchange=self.coordinate_format%(p.coords_decimals, z_toolchange),
tool=int(p.tool),
toolC=toolC_formatted)
@ -170,8 +170,8 @@ M0""".format(toolchangez=self.coordinate_format%(p.coords_decimals, toolchangez)
return ('G01 ' + self.position_code(p)).format(**p)
def end_code(self, p):
coords_xy = p['toolchange_xy']
gcode = ('G00 Z' + self.feedrate_format %(p.fr_decimals, p.endz) + "\n")
coords_xy = p['xy_toolchange']
gcode = ('G00 Z' + self.feedrate_format %(p.fr_decimals, p.z_end) + "\n")
if coords_xy is not None:
gcode += 'G00 X{x} Y{y}'.format(x=coords_xy[0], y=coords_xy[1]) + "\n"
@ -180,8 +180,8 @@ M0""".format(toolchangez=self.coordinate_format%(p.coords_decimals, toolchangez)
def feedrate_code(self, p):
return 'G01 F' + str(self.feedrate_format %(p.fr_decimals, p.feedrate))
def feedrate_z_code(self, p):
return 'G01 F' + str(self.feedrate_format %(p.fr_decimals, p.feedrate_z))
def z_feedrate_code(self, p):
return 'G01 F' + str(self.feedrate_format %(p.fr_decimals, p.z_feedrate))
def spindle_code(self, p):
if p.spindlespeed:

View File

@ -8,7 +8,7 @@ class grbl_11(FlatCAMPostProc):
def start_code(self, p):
units = ' ' + str(p['units']).lower()
coords_xy = p['toolchange_xy']
coords_xy = p['xy_toolchange']
gcode = ''
xmin = '%.*f' % (p.coords_decimals, p['options']['xmin'])
@ -22,24 +22,24 @@ class grbl_11(FlatCAMPostProc):
gcode += '(Feedrate: ' + str(p['feedrate']) + units + '/min' + ')\n'
if str(p['options']['type']) == 'Geometry':
gcode += '(Feedrate_Z: ' + str(p['feedrate_z']) + units + '/min' + ')\n'
gcode += '(Feedrate_Z: ' + str(p['z_feedrate']) + units + '/min' + ')\n'
gcode += '(Feedrate rapids ' + str(p['feedrate_rapid']) + units + '/min' + ')\n' + '\n'
gcode += '(Z_Cut: ' + str(p['z_cut']) + units + ')\n'
if str(p['options']['type']) == 'Geometry':
if p['multidepth'] is True:
gcode += '(DepthPerCut: ' + str(p['depthpercut']) + units + ' <=>' + \
str(math.ceil(abs(p['z_cut']) / p['depthpercut'])) + ' passes' + ')\n'
gcode += '(DepthPerCut: ' + str(p['z_depthpercut']) + units + ' <=>' + \
str(math.ceil(abs(p['z_cut']) / p['z_depthpercut'])) + ' passes' + ')\n'
gcode += '(Z_Move: ' + str(p['z_move']) + units + ')\n'
gcode += '(Z Toolchange: ' + str(p['toolchangez']) + units + ')\n'
gcode += '(Z Toolchange: ' + str(p['z_toolchange']) + units + ')\n'
if coords_xy is not None:
gcode += '(X,Y Toolchange: ' + "%.4f, %.4f" % (coords_xy[0], coords_xy[1]) + units + ')\n'
else:
gcode += '(X,Y Toolchange: ' + "None" + units + ')\n'
gcode += '(Z Start: ' + str(p['startz']) + units + ')\n'
gcode += '(Z End: ' + str(p['endz']) + units + ')\n'
gcode += '(Z End: ' + str(p['z_end']) + 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':
@ -72,19 +72,19 @@ class grbl_11(FlatCAMPostProc):
return 'G01 Z' + self.coordinate_format%(p.coords_decimals, p.z_cut)
def toolchange_code(self, p):
toolchangez = p.toolchangez
toolchangexy = p.toolchange_xy
z_toolchange = p.z_toolchange
toolchangexy = p.xy_toolchange
f_plunge = p.f_plunge
gcode = ''
if toolchangexy is not None:
toolchangex = toolchangexy[0]
toolchangey = toolchangexy[1]
x_toolchange = toolchangexy[0]
y_toolchange = toolchangexy[1]
no_drills = 1
if int(p.tool) == 1 and p.startz is not None:
toolchangez = p.startz
z_toolchange = p.startz
if p.units.upper() == 'MM':
toolC_formatted = format(p.toolC, '.2f')
@ -99,25 +99,25 @@ class grbl_11(FlatCAMPostProc):
if toolchangexy is not None:
gcode = """
M5
G00 Z{toolchangez}
G00 X{toolchangex} Y{toolchangey}
G00 Z{z_toolchange}
G00 X{x_toolchange} Y{y_toolchange}
T{tool}
M6
(MSG, Change to Tool Dia = {toolC} ||| Total drills for tool T{tool} = {t_drills})
M0""".format(toolchangex=self.coordinate_format % (p.coords_decimals, toolchangex),
toolchangey=self.coordinate_format % (p.coords_decimals, toolchangey),
toolchangez=self.coordinate_format % (p.coords_decimals, toolchangez),
M0""".format(x_toolchange=self.coordinate_format % (p.coords_decimals, x_toolchange),
y_toolchange=self.coordinate_format % (p.coords_decimals, y_toolchange),
z_toolchange=self.coordinate_format % (p.coords_decimals, z_toolchange),
tool=int(p.tool),
t_drills=no_drills,
toolC=toolC_formatted)
else:
gcode = """
M5
G00 Z{toolchangez}
G00 Z{z_toolchange}
T{tool}
M6
(MSG, Change to Tool Dia = {toolC} ||| Total drills for tool T{tool} = {t_drills})
M0""".format(toolchangez=self.coordinate_format % (p.coords_decimals, toolchangez),
M0""".format(z_toolchange=self.coordinate_format % (p.coords_decimals, z_toolchange),
tool=int(p.tool),
t_drills=no_drills,
toolC=toolC_formatted)
@ -130,24 +130,24 @@ M0""".format(toolchangez=self.coordinate_format % (p.coords_decimals, toolchange
if toolchangexy is not None:
gcode = """
M5
G00 Z{toolchangez}
G00 X{toolchangex} Y{toolchangey}
G00 Z{z_toolchange}
G00 X{x_toolchange} Y{y_toolchange}
T{tool}
M6
(MSG, Change to Tool Dia = {toolC})
M0""".format(toolchangex=self.coordinate_format % (p.coords_decimals, toolchangex),
toolchangey=self.coordinate_format % (p.coords_decimals, toolchangey),
toolchangez=self.coordinate_format % (p.coords_decimals, toolchangez),
M0""".format(x_toolchange=self.coordinate_format % (p.coords_decimals, x_toolchange),
y_toolchange=self.coordinate_format % (p.coords_decimals, y_toolchange),
z_toolchange=self.coordinate_format % (p.coords_decimals, z_toolchange),
tool=int(p.tool),
toolC=toolC_formatted)
else:
gcode = """
M5
G00 Z{toolchangez}
G00 Z{z_toolchange}
T{tool}
M6
(MSG, Change to Tool Dia = {toolC})
M0""".format(toolchangez=self.coordinate_format%(p.coords_decimals, toolchangez),
M0""".format(z_toolchange=self.coordinate_format%(p.coords_decimals, z_toolchange),
tool=int(p.tool),
toolC=toolC_formatted)
@ -170,8 +170,8 @@ M0""".format(toolchangez=self.coordinate_format%(p.coords_decimals, toolchangez)
' F' + str(self.feedrate_format %(p.fr_decimals, p.feedrate))
def end_code(self, p):
coords_xy = p['toolchange_xy']
gcode = ('G00 Z' + self.feedrate_format %(p.fr_decimals, p.endz) + "\n")
coords_xy = p['xy_toolchange']
gcode = ('G00 Z' + self.feedrate_format %(p.fr_decimals, p.z_end) + "\n")
if coords_xy is not None:
gcode += 'G00 X{x} Y{y}'.format(x=coords_xy[0], y=coords_xy[1]) + "\n"
@ -180,8 +180,8 @@ M0""".format(toolchangez=self.coordinate_format%(p.coords_decimals, toolchangez)
def feedrate_code(self, p):
return 'G01 F' + str(self.feedrate_format %(p.fr_decimals, p.feedrate))
def feedrate_z_code(self, p):
return 'G01 F' + str(self.feedrate_format %(p.fr_decimals, p.feedrate_z))
def z_feedrate_code(self, p):
return 'G01 F' + str(self.feedrate_format %(p.fr_decimals, p.z_feedrate))
def spindle_code(self,p):
if p.spindlespeed:

View File

@ -68,8 +68,8 @@ class grbl_laser(FlatCAMPostProc):
' F' + str(self.feedrate_format %(p.fr_decimals, p.feedrate))
def end_code(self, p):
coords_xy = p['toolchange_xy']
gcode = ('G00 Z' + self.feedrate_format %(p.fr_decimals, p.endz) + "\n")
coords_xy = p['xy_toolchange']
gcode = ('G00 Z' + self.feedrate_format %(p.fr_decimals, p.z_end) + "\n")
if coords_xy is not None:
gcode += 'G00 X{x} Y{y}'.format(x=coords_xy[0], y=coords_xy[1]) + "\n"
@ -78,8 +78,8 @@ class grbl_laser(FlatCAMPostProc):
def feedrate_code(self, p):
return 'G01 F' + str(self.feedrate_format %(p.fr_decimals, p.feedrate))
def feedrate_z_code(self, p):
return 'G01 F' + str(self.feedrate_format %(p.fr_decimals, p.feedrate_z))
def z_feedrate_code(self, p):
return 'G01 F' + str(self.feedrate_format %(p.fr_decimals, p.z_feedrate))
def spindle_code(self, p):
return ''

View File

@ -60,7 +60,7 @@ class hpgl(FlatCAMPostProc):
def feedrate_code(self, p):
return ''
def feedrate_z_code(self, p):
def z_feedrate_code(self, p):
return ''
def feedrate_rapid_code(self, p):

View File

@ -8,7 +8,7 @@ class line_xyz(FlatCAMPostProc):
def start_code(self, p):
units = ' ' + str(p['units']).lower()
coords_xy = p['toolchange_xy']
coords_xy = p['xy_toolchange']
gcode = ''
xmin = '%.*f' % (p.coords_decimals, p['options']['xmin'])
@ -22,24 +22,24 @@ class line_xyz(FlatCAMPostProc):
gcode += '(Feedrate: ' + str(p['feedrate']) + units + '/min' + ')\n'
if str(p['options']['type']) == 'Geometry':
gcode += '(Feedrate_Z: ' + str(p['feedrate_z']) + units + '/min' + ')\n'
gcode += '(Feedrate_Z: ' + str(p['z_feedrate']) + units + '/min' + ')\n'
gcode += '(Feedrate rapids ' + str(p['feedrate_rapid']) + units + '/min' + ')\n' + '\n'
gcode += '(Z_Cut: ' + str(p['z_cut']) + units + ')\n'
if str(p['options']['type']) == 'Geometry':
if p['multidepth'] is True:
gcode += '(DepthPerCut: ' + str(p['depthpercut']) + units + ' <=>' + \
str(math.ceil(abs(p['z_cut']) / p['depthpercut'])) + ' passes' + ')\n'
gcode += '(DepthPerCut: ' + str(p['z_depthpercut']) + units + ' <=>' + \
str(math.ceil(abs(p['z_cut']) / p['z_depthpercut'])) + ' passes' + ')\n'
gcode += '(Z_Move: ' + str(p['z_move']) + units + ')\n'
gcode += '(Z Toolchange: ' + str(p['toolchangez']) + units + ')\n'
gcode += '(Z Toolchange: ' + str(p['z_toolchange']) + units + ')\n'
if coords_xy is not None:
gcode += '(X,Y Toolchange: ' + "%.4f, %.4f" % (coords_xy[0], coords_xy[1]) + units + ')\n'
else:
gcode += '(X,Y Toolchange: ' + "None" + units + ')\n'
gcode += '(Z Start: ' + str(p['startz']) + units + ')\n'
gcode += '(Z End: ' + str(p['endz']) + units + ')\n'
gcode += '(Z End: ' + str(p['z_end']) + 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':
@ -80,26 +80,26 @@ class line_xyz(FlatCAMPostProc):
return g
def toolchange_code(self, p):
toolchangez = p.toolchangez
toolchangexy = p.toolchange_xy
z_toolchange = p.z_toolchange
xy_toolchange = p.xy_toolchange
f_plunge = p.f_plunge
gcode = ''
if toolchangexy is not None:
toolchangex = toolchangexy[0]
toolchangey = toolchangexy[1]
if xy_toolchange is not None:
x_toolchange = xy_toolchange[0]
y_toolchange = xy_toolchange[1]
else:
if str(p['options']['type']) == 'Excellon':
toolchangex = p.oldx
toolchangey = p.oldy
x_toolchange = p.oldx
y_toolchange = p.oldy
else:
toolchangex = p.x
toolchangey = p.y
x_toolchange = p.x
y_toolchange = p.y
no_drills = 1
if int(p.tool) == 1 and p.startz is not None:
toolchangez = p.startz
z_toolchange = p.startz
if p.units.upper() == 'MM':
toolC_formatted = format(p.toolC, '.2f')
@ -112,40 +112,40 @@ class line_xyz(FlatCAMPostProc):
no_drills = i[2]
gcode = """
M5
G00 X{toolchangex} Y{toolchangey} Z{toolchangez}
G00 X{x_toolchange} Y{x_toolchange} Z{z_toolchange}
T{tool}
M6
(MSG, Change to Tool Dia = {toolC} ||| Total drills for tool T{tool} = {t_drills})
M0""".format(toolchangex=self.coordinate_format%(p.coords_decimals, toolchangex),
toolchangey=self.coordinate_format % (p.coords_decimals, toolchangey),
toolchangez=self.coordinate_format % (p.coords_decimals, toolchangez),
M0""".format(x_toolchange=self.coordinate_format%(p.coords_decimals, x_toolchange),
y_toolchange=self.coordinate_format % (p.coords_decimals, y_toolchange),
z_toolchange=self.coordinate_format % (p.coords_decimals, z_toolchange),
tool=int(p.tool),
t_drills=no_drills,
toolC=toolC_formatted)
if f_plunge is True:
gcode += """\nG00 X{toolchangex} Y{toolchangey} Z{z_move}""".format(
toolchangex=self.coordinate_format%(p.coords_decimals, toolchangex),
toolchangey=self.coordinate_format % (p.coords_decimals, toolchangey),
gcode += """\nG00 X{x_toolchange} Y{x_toolchange} Z{z_move}""".format(
x_toolchange=self.coordinate_format%(p.coords_decimals, x_toolchange),
y_toolchange=self.coordinate_format % (p.coords_decimals, y_toolchange),
z_move=self.coordinate_format % (p.coords_decimals, p.z_move))
return gcode
else:
gcode = """
M5
G00 X{toolchangex} Y{toolchangey} Z{toolchangez}
G00 X{x_toolchange} Y{x_toolchange} Z{z_toolchange}
T{tool}
M6
(MSG, Change to Tool Dia = {toolC})
M0""".format(toolchangex=self.coordinate_format%(p.coords_decimals, toolchangex),
toolchangey=self.coordinate_format % (p.coords_decimals, toolchangey),
toolchangez=self.coordinate_format % (p.coords_decimals, toolchangez),
M0""".format(x_toolchange=self.coordinate_format%(p.coords_decimals, x_toolchange),
y_toolchange=self.coordinate_format % (p.coords_decimals, y_toolchange),
z_toolchange=self.coordinate_format % (p.coords_decimals, z_toolchange),
tool=int(p.tool),
toolC=toolC_formatted)
if f_plunge is True:
gcode += """\nG00 X{toolchangex} Y{toolchangey} Z{z_move}""".format(
toolchangex=self.coordinate_format % (p.coords_decimals, toolchangex),
toolchangey=self.coordinate_format % (p.coords_decimals, toolchangey),
gcode += """\nG00 X{x_toolchange} Y{x_toolchange} Z{z_move}""".format(
x_toolchange=self.coordinate_format % (p.coords_decimals, x_toolchange),
y_toolchange=self.coordinate_format % (p.coords_decimals, y_toolchange),
z_move=self.coordinate_format % (p.coords_decimals, p.z_move))
return gcode
@ -170,19 +170,19 @@ M0""".format(toolchangex=self.coordinate_format%(p.coords_decimals, toolchangex)
return g
def end_code(self, p):
coords_xy = p['toolchange_xy']
coords_xy = p['xy_toolchange']
if coords_xy is not None:
g = 'G00 X{x} Y{y}'.format(x=coords_xy[0], y=coords_xy[1]) + "\n"
else:
g = ('G00 ' + self.position_code(p)).format(**p)
g += ' Z' + self.coordinate_format % (p.coords_decimals, p.endz)
g += ' Z' + self.coordinate_format % (p.coords_decimals, p.z_end)
return g
def feedrate_code(self, p):
return 'G01 F' + str(self.feedrate_format %(p.fr_decimals, p.feedrate))
def feedrate_z_code(self, p):
return 'G01 F' + str(self.feedrate_format %(p.fr_decimals, p.feedrate_z))
def z_feedrate_code(self, p):
return 'G01 F' + str(self.feedrate_format %(p.fr_decimals, p.z_feedrate))
def spindle_code(self, p):
if p.spindlespeed:

View File

@ -9,7 +9,7 @@ class marlin(FlatCAMPostProc):
def start_code(self, p):
units = ' ' + str(p['units']).lower()
coords_xy = p['toolchange_xy']
coords_xy = p['xy_toolchange']
gcode = ''
xmin = '%.*f' % (p.coords_decimals, p['options']['xmin'])
@ -23,18 +23,18 @@ class marlin(FlatCAMPostProc):
gcode += ';Feedrate: ' + str(p['feedrate']) + units + '/min' + '\n'
if str(p['options']['type']) == 'Geometry':
gcode += ';Feedrate_Z: ' + str(p['feedrate_z']) + units + '/min' + '\n'
gcode += ';Feedrate_Z: ' + str(p['z_feedrate']) + units + '/min' + '\n'
gcode += ';Feedrate rapids ' + str(p['feedrate_rapid']) + units + '/min' + '\n' + '\n'
gcode += ';Z_Cut: ' + str(p['z_cut']) + units + '\n'
if str(p['options']['type']) == 'Geometry':
if p['multidepth'] is True:
gcode += ';DepthPerCut: ' + str(p['depthpercut']) + units + ' <=>' + \
str(math.ceil(abs(p['z_cut']) / p['depthpercut'])) + ' passes' + '\n'
gcode += ';DepthPerCut: ' + str(p['z_depthpercut']) + units + ' <=>' + \
str(math.ceil(abs(p['z_cut']) / p['z_depthpercut'])) + ' passes' + '\n'
gcode += ';Z_Move: ' + str(p['z_move']) + units + '\n'
gcode += ';Z Toolchange: ' + str(p['toolchangez']) + units + '\n'
gcode += ';Z Toolchange: ' + str(p['z_toolchange']) + units + '\n'
if coords_xy is not None:
gcode += ';X,Y Toolchange: ' + "%.4f, %.4f" % (coords_xy[0], coords_xy[1]) + units + '\n'
@ -42,7 +42,7 @@ class marlin(FlatCAMPostProc):
gcode += ';X,Y Toolchange: ' + "None" + units + '\n'
gcode += ';Z Start: ' + str(p['startz']) + units + '\n'
gcode += ';Z End: ' + str(p['endz']) + units + '\n'
gcode += ';Z End: ' + str(p['z_end']) + 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':
@ -73,19 +73,19 @@ class marlin(FlatCAMPostProc):
return 'G1 Z' + self.coordinate_format%(p.coords_decimals, p.z_cut) + " " + self.end_feedrate_code(p)
def toolchange_code(self, p):
toolchangez = p.toolchangez
toolchangexy = p.toolchange_xy
z_toolchange = p.z_toolchange
toolchangexy = p.xy_toolchange
f_plunge = p.f_plunge
gcode = ''
if toolchangexy is not None:
toolchangex = toolchangexy[0]
toolchangey = toolchangexy[1]
x_toolchange = toolchangexy[0]
y_toolchange = toolchangexy[1]
no_drills = 1
if int(p.tool) == 1 and p.startz is not None:
toolchangez = p.startz
z_toolchange = p.startz
if p.units.upper() == 'MM':
toolC_formatted = format(p.toolC, '.2f')
@ -100,25 +100,25 @@ class marlin(FlatCAMPostProc):
if toolchangexy is not None:
gcode = """
M5
G0 Z{toolchangez}
G0 X{toolchangex} Y{toolchangey}
G0 Z{z_toolchange}
G0 X{x_toolchange} Y{y_toolchange}
T{tool}
M6
;MSG, Change to Tool Dia = {toolC}, Total drills for tool T{tool} = {t_drills}
M0""".format(toolchangex=self.coordinate_format % (p.coords_decimals, toolchangex),
toolchangey=self.coordinate_format % (p.coords_decimals, toolchangey),
toolchangez=self.coordinate_format % (p.coords_decimals, toolchangez),
M0""".format(x_toolchange=self.coordinate_format % (p.coords_decimals, x_toolchange),
y_toolchange=self.coordinate_format % (p.coords_decimals, y_toolchange),
z_toolchange=self.coordinate_format % (p.coords_decimals, z_toolchange),
tool=int(p.tool),
t_drills=no_drills,
toolC=toolC_formatted)
else:
gcode = """
M5
G0 Z{toolchangez}
G0 Z{z_toolchange}
T{tool}
M6
;MSG, Change to Tool Dia = {toolC}, Total drills for tool T{tool} = {t_drills}
M0""".format(toolchangez=self.coordinate_format % (p.coords_decimals, toolchangez),
M0""".format(z_toolchange=self.coordinate_format % (p.coords_decimals, z_toolchange),
tool=int(p.tool),
t_drills=no_drills,
toolC=toolC_formatted)
@ -131,24 +131,24 @@ M0""".format(toolchangez=self.coordinate_format % (p.coords_decimals, toolchange
if toolchangexy is not None:
gcode = """
M5
G0 Z{toolchangez}
G0 X{toolchangex} Y{toolchangey}
G0 Z{z_toolchange}
G0 X{x_toolchange} Y{y_toolchange}
T{tool}
M6
;MSG, Change to Tool Dia = {toolC}
M0""".format(toolchangex=self.coordinate_format % (p.coords_decimals, toolchangex),
toolchangey=self.coordinate_format % (p.coords_decimals, toolchangey),
toolchangez=self.coordinate_format % (p.coords_decimals, toolchangez),
M0""".format(x_toolchange=self.coordinate_format % (p.coords_decimals, x_toolchange),
y_toolchange=self.coordinate_format % (p.coords_decimals, y_toolchange),
z_toolchange=self.coordinate_format % (p.coords_decimals, z_toolchange),
tool=int(p.tool),
toolC=toolC_formatted)
else:
gcode = """
M5
G0 Z{toolchangez}
G0 Z{z_toolchange}
T{tool}
M6
;MSG, Change to Tool Dia = {toolC}
M0""".format(toolchangez=self.coordinate_format%(p.coords_decimals, toolchangez),
M0""".format(z_toolchange=self.coordinate_format%(p.coords_decimals, z_toolchange),
tool=int(p.tool),
toolC=toolC_formatted)
@ -170,8 +170,8 @@ M0""".format(toolchangez=self.coordinate_format%(p.coords_decimals, toolchangez)
return ('G1 ' + self.position_code(p)).format(**p) + " " + self.end_feedrate_code(p)
def end_code(self, p):
coords_xy = p['toolchange_xy']
gcode = ('G0 Z' + self.feedrate_format %(p.fr_decimals, p.endz) + " " + self.feedrate_rapid_code(p) + "\n")
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"
@ -184,8 +184,8 @@ M0""".format(toolchangez=self.coordinate_format%(p.coords_decimals, toolchangez)
def end_feedrate_code(self, p):
return 'F' + self.feedrate_format %(p.fr_decimals, p.feedrate)
def feedrate_z_code(self, p):
return 'G1 F' + str(self.feedrate_format %(p.fr_decimals, p.feedrate_z))
def z_feedrate_code(self, p):
return 'G1 F' + str(self.feedrate_format %(p.fr_decimals, p.z_feedrate))
def feedrate_rapid_code(self, p):
return 'F' + self.feedrate_rapid_format % (p.fr_decimals, p.feedrate_rapid)