From f641cc65bdb6ad4cac18c7f8f62821ba600c6e19 Mon Sep 17 00:00:00 2001 From: Marius Stanciu Date: Tue, 22 Mar 2022 00:33:02 +0200 Subject: [PATCH] - fixed the GCode generation such that (for milling Geometries) the choice of using (or not) and end position is respected - for `hpgl` code generation made sure that the first travel line is not marked as a cut line when using a toolchange event --- CHANGELOG.md | 5 +++++ camlib.py | 13 ++++++++++--- 2 files changed, 15 insertions(+), 3 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 1933637a..4a8306ee 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -7,6 +7,11 @@ CHANGELOG for FlatCAM beta ================================================= +22.03.2022 + +- fixed the GCode generation such that (for milling Geometries) the choice of using (or not) and end position is respected +- for `hpgl` code generation made sure that the first travel line is not marked as a cut line when using a toolchange event + 21.03.2022 - optimized the UI for the CNCJob object diff --git a/camlib.py b/camlib.py index 3517bbd7..a5a059e1 100644 --- a/camlib.py +++ b/camlib.py @@ -4027,12 +4027,16 @@ class CNCjob(Geometry): t_gcode += self.doformat(p.lift_code, x=current_pt[0], y=current_pt[1]) t_gcode += self.doformat(p.spindle_stop_code) - if isinstance(self.xy_end, tuple): + if isinstance(self.xy_end, (tuple, list)): endx = self.xy_end[0] endy = self.xy_end[1] else: - endx = 0 - endy = 0 + try: + endx = current_pt[0] + endy = current_pt[1] + except Exception: + endx = 0.0 + endy = 0.0 t_gcode += self.doformat(p.end_code, x=endx, y=endy) self.app.inform.emit( @@ -6600,6 +6604,9 @@ class CNCjob(Geometry): command['Z'] = 1 else: command['Z'] = 0 + match_toolchange = re.search(r"^SP\d*", gline) + if match_toolchange: + command['Z'] = 1 elif 'laser' in self.pp_excellon_name.lower() or 'laser' in self.pp_geometry_name.lower() or \ (self.pp_solderpaste_name is not None and 'paste' in self.pp_solderpaste_name.lower()):