diff --git a/camlib.py b/camlib.py index 79123680..ee46c922 100644 --- a/camlib.py +++ b/camlib.py @@ -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] diff --git a/postprocessors/Toolchange_manual.py b/postprocessors/Toolchange_manual.py index 767ec8c3..dce498b4 100644 --- a/postprocessors/Toolchange_manual.py +++ b/postprocessors/Toolchange_manual.py @@ -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 diff --git a/postprocessors/default.py b/postprocessors/default.py index 6a8a540f..2c086a3c 100644 --- a/postprocessors/default.py +++ b/postprocessors/default.py @@ -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