- 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

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