- fixed postprocessor files to work with toolchange_xy parameter value = None (no values in Edit - Preferences fields) - actual fix

- fixed Tcl commands CncJob and DrillCncJob to work with toolchange
This commit is contained in:
Marius Stanciu
2019-01-31 01:45:14 +02:00
committed by Marius S
parent 7bc806f1dc
commit 4441e40042
10 changed files with 205 additions and 57 deletions

View File

@@ -88,22 +88,47 @@ class default(FlatCAMPostProc):
if i[0] == p.tool:
no_drills = i[2]
gcode = """G00 Z{toolchangez}
if toolchangexy is not None:
gcode = """G00 Z{toolchangez}
G00 X{toolchangex} Y{toolchangey}
T{tool}
M5
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(toolchangex=self.coordinate_format % (p.coords_decimals, toolchangex),
toolchangey=self.coordinate_format % (p.coords_decimals, toolchangey),
toolchangez=self.coordinate_format % (p.coords_decimals, toolchangez),
tool=int(p.tool),
t_drills=no_drills,
toolC=toolC_formatted)
else:
gcode = """G00 Z{toolchangez}
T{tool}
M5
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),
tool=int(p.tool),
t_drills=no_drills,
toolC=toolC_formatted)
if toolchangexy is not None:
gcode += ('\n' + 'G00 X{toolchangex} Y{toolchangey}'.format(toolchangex=toolchangex,
toolchangey=toolchangey))
return gcode
else:
gcode = """G00 Z{toolchangez}
if toolchangexy is not None:
gcode = """G00 Z{toolchangez}
G00 X{toolchangex} Y{toolchangey}
T{tool}
M5
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),
tool=int(p.tool),
toolC=toolC_formatted)
else:
gcode = """G00 Z{toolchangez}
T{tool}
M5
M6
@@ -111,9 +136,7 @@ M6
M0""".format(toolchangez=self.coordinate_format%(p.coords_decimals, toolchangez),
tool=int(p.tool),
toolC=toolC_formatted)
if toolchangexy is not None:
gcode += ('\n' + 'G00 X{toolchangex} Y{toolchangey}'.format(toolchangex=toolchangex,
toolchangey=toolchangey))
return gcode
def up_to_zero_code(self, p):

View File

@@ -72,6 +72,8 @@ class grbl_11(FlatCAMPostProc):
toolchangex = toolchangexy[0]
toolchangey = toolchangexy[1]
no_drills = 1
if int(p.tool) == 1 and p.startz is not None:
toolchangez = p.startz
@@ -80,39 +82,60 @@ class grbl_11(FlatCAMPostProc):
else:
toolC_formatted = format(p.toolC, '.4f')
no_drills = 1
if str(p['options']['type']) == 'Excellon':
for i in p['options']['Tools_in_use']:
if i[0] == p.tool:
no_drills = i[2]
gcode = """G00 Z{toolchangez}
T{tool}
M5
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),
tool=int(p.tool),
t_drills=no_drills,
toolC=toolC_formatted)
if toolchangexy is not None:
gcode = """G00 Z{toolchangez}
G00 X{toolchangex} Y{toolchangey}
T{tool}
M5
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),
tool=int(p.tool),
t_drills=no_drills,
toolC=toolC_formatted)
else:
gcode = """G00 Z{toolchangez}
T{tool}
M5
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),
tool=int(p.tool),
t_drills=no_drills,
toolC=toolC_formatted)
if toolchangexy is not None:
gcode += ('\n' + 'G00 X{toolchangex} Y{toolchangey}'.format(toolchangex=toolchangex,
toolchangey=toolchangey))
return gcode
else:
gcode = """G00 Z{toolchangez}
T{tool}
M5
M6
(MSG, Change to Tool Dia = {toolC})
M0""".format(toolchangez=self.coordinate_format % (p.coords_decimals, toolchangez),
tool=int(p.tool),
toolC=toolC_formatted)
if toolchangexy is not None:
gcode += ('\n' + 'G00 X{toolchangex} Y{toolchangey}'.format(toolchangex=toolchangex,
toolchangey=toolchangey))
gcode = """G00 Z{toolchangez}
G00 X{toolchangex} Y{toolchangey}
T{tool}
M5
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),
tool=int(p.tool),
toolC=toolC_formatted)
else:
gcode = """G00 Z{toolchangez}
T{tool}
M5
M6
(MSG, Change to Tool Dia = {toolC})
M0""".format(toolchangez=self.coordinate_format%(p.coords_decimals, toolchangez),
tool=int(p.tool),
toolC=toolC_formatted)
return gcode
def up_to_zero_code(self, p):

View File

@@ -80,8 +80,12 @@ class line_xyz(FlatCAMPostProc):
toolchangex = toolchangexy[0]
toolchangey = toolchangexy[1]
else:
toolchangex = p.x
toolchangey = p.y
if str(p['options']['type']) == 'Excellon':
toolchangex = p.oldx
toolchangey = p.oldy
else:
toolchangex = p.x
toolchangey = p.y
no_drills = 1

View File

@@ -64,14 +64,15 @@ class manual_toolchange(FlatCAMPostProc):
def toolchange_code(self, p):
toolchangez = p.toolchangez
toolchangexy = p['toolchange_xy']
toolchangexy = p.toolchange_xy
gcode = ''
if toolchangexy is not None:
toolchangex = toolchangexy[0]
toolchangey = toolchangexy[1]
else:
toolchangex = p.oldx
toolchangey = p.oldy
# else:
# toolchangex = p.oldx
# toolchangey = p.oldy
no_drills = 1
@@ -87,10 +88,12 @@ class manual_toolchange(FlatCAMPostProc):
for i in p['options']['Tools_in_use']:
if i[0] == p.tool:
no_drills = i[2]
return """G00 Z{toolchangez}
if toolchangexy is not None:
gcode = """G00 Z{toolchangez}
T{tool}
M5
G00 X{toolchangex} Y{toolchangey}
M5
G00 X{toolchangex} Y{toolchangey}
(MSG, Change to Tool Dia = {toolC}, Total drills for current tool = {t_drills})
M0
G01 Z0
@@ -103,8 +106,28 @@ M0
tool=int(p.tool),
t_drills=no_drills,
toolC=toolC_formatted)
else:
gcode = """G00 Z{toolchangez}
T{tool}
M5
(MSG, Change to Tool Dia = {toolC}, Total drills for current tool = {t_drills})
M0
G01 Z0
M0
G00 Z{toolchangez}
M0
""".format(
toolchangez=self.coordinate_format%(p.coords_decimals, toolchangez),
tool=int(p.tool),
t_drills=no_drills,
toolC=toolC_formatted)
return gcode
else:
return """G00 Z{toolchangez}
if toolchangexy is not None:
gcode = """G00 Z{toolchangez}
T{tool}
M5
G00 X{toolchangex}Y{toolchangey}
@@ -119,6 +142,21 @@ M0
toolchangez=self.coordinate_format%(p.coords_decimals, toolchangez),
tool=int(p.tool),
toolC=toolC_formatted)
else:
gcode = """G00 Z{toolchangez}
T{tool}
M5
(MSG, Change to Tool Dia = {toolC})
M0
G01 Z0
M0
G00 Z{toolchangez}
M0
""".format(toolchangez=self.coordinate_format%(p.coords_decimals, toolchangez),
tool=int(p.tool),
toolC=toolC_formatted)
return gcode
def up_to_zero_code(self, p):
return 'G01 Z0'

View File

@@ -66,6 +66,13 @@ class marlin(FlatCAMPostProc):
def toolchange_code(self, p):
toolchangez = p.toolchangez
toolchangexy = p.toolchange_xy
gcode = ''
if toolchangexy is not None:
toolchangex = toolchangexy[0]
toolchangey = toolchangexy[1]
no_drills = 1
if int(p.tool) == 1 and p.startz is not None:
@@ -80,20 +87,57 @@ class marlin(FlatCAMPostProc):
for i in p['options']['Tools_in_use']:
if i[0] == p.tool:
no_drills = i[2]
return """G0 Z{toolchangez}
if toolchangexy is not None:
gcode = """G0 Z{toolchangez}
G0 X{toolchangex} Y{toolchangey}
T{tool}
M5
M0 Change to Tool Dia = {toolC}, Total drills for current tool = {t_drills}
""".format(toolchangez=self.coordinate_format%(p.coords_decimals, toolchangez),
tool=int(p.tool),
t_drills=no_drills,
toolC=toolC_formatted)
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),
tool=int(p.tool),
t_drills=no_drills,
toolC=toolC_formatted)
else:
gcode = """G0 Z{toolchangez}
T{tool}
M5
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),
tool=int(p.tool),
t_drills=no_drills,
toolC=toolC_formatted)
return gcode
else:
return """G0 Z{toolchangez}
if toolchangexy is not None:
gcode = """G0 Z{toolchangez}
G0 X{toolchangex} Y{toolchangey}
T{tool}
M5
M0 Change to Tool Dia = {toolC}
""".format(toolchangez=self.coordinate_format%(p.coords_decimals, toolchangez),
tool=int(p.tool),
toolC=toolC_formatted)
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),
tool=int(p.tool),
toolC=toolC_formatted)
else:
gcode = """G0 Z{toolchangez}
T{tool}
M5
M6
(MSG, Change to Tool Dia = {toolC})
M0""".format(toolchangez=self.coordinate_format%(p.coords_decimals, toolchangez),
tool=int(p.tool),
toolC=toolC_formatted)
return gcode
def up_to_zero_code(self, p):
return 'G1 Z0' + " " + self.feedrate_code(p)