- small changes in parse_gcode()

This commit is contained in:
Marius Stanciu 2019-12-06 18:45:13 +02:00
parent 13f67786af
commit 23a1388e98
3 changed files with 13 additions and 7 deletions

View File

@ -2612,7 +2612,7 @@ class CNCjob(Geometry):
# Tool change sequence (optional)
if toolchange:
gcode += self.doformat(p.toolchange_code,toolchangexy=(self.oldx, self.oldy))
gcode += self.doformat(p.toolchange_code, toolchangexy=(self.oldx, self.oldy))
gcode += self.doformat(p.spindle_code) # Spindle start
if self.dwell is True:
gcode += self.doformat(p.dwell_code) # Dwell time
@ -3972,9 +3972,11 @@ class CNCjob(Geometry):
path = [pos_xy]
# path = [(0, 0)]
self.app.inform.emit('%s: %d' % (_("Parsing GCode file. Number of lines"), len(self.gcode.splitlines())))
gcode_lines_list = self.gcode.splitlines()
self.app.inform.emit('%s: %d' % (_("Parsing GCode file. Number of lines"), len(gcode_lines_list)))
# Process every instruction
for line in StringIO(self.gcode):
for line in gcode_lines_list:
if force_parsing is False or force_parsing is None:
if '%MO' in line or '%' in line or 'MOIN' in line or 'MOMM' in line:
return "fail"
@ -3986,6 +3988,10 @@ class CNCjob(Geometry):
self.units = {20.0: "IN", 21.0: "MM"}[gobj['G']]
continue
# TODO take into consideration the tools and update the travel line thickness
if 'T' in gobj:
pass
# ## Changing height
if 'Z' in gobj:
if 'Roland' in self.pp_excellon_name or 'Roland' in self.pp_geometry_name:
@ -4067,6 +4073,9 @@ class CNCjob(Geometry):
stop = np.arctan2(-center[1] + y, -center[0] + x)
path += arc(center, radius, start, stop, arcdir[current['G']], int(self.steps_per_circle / 4))
current['X'] = x
current['Y'] = y
# Update current instruction
for code in gobj:
current[code] = gobj[code]

View File

@ -89,9 +89,6 @@ class Toolchange_manual(FlatCAMPostProc):
if toolchangexy is not None:
x_toolchange = toolchangexy[0]
y_toolchange = toolchangexy[1]
# else:
# x_toolchange = p.oldx
# y_toolchange = p.oldy
no_drills = 1

View File

@ -107,8 +107,8 @@ class default(FlatCAMPostProc):
gcode = """
M5
G00 Z{z_toolchange}
G00 X{x_toolchange} Y{y_toolchange}
T{tool}
G00 X{x_toolchange} Y{y_toolchange}
M6
(MSG, Change to Tool Dia = {toolC} ||| Total drills for tool T{tool} = {t_drills})
M0