Просмотр исходного кода

- fixed issue in "re-cut" feature when combined with multi-depth feature

Marius Stanciu 5 лет назад
Родитель
Сommit
ffaea546db
3 измененных файлов с 43 добавлено и 7 удалено
  1. 1 0
      README.md
  2. 42 6
      camlib.py
  3. 0 1
      flatcamTools/ToolPaint.py

+ 1 - 0
README.md

@@ -14,6 +14,7 @@ CAD program, and create G-Code for Isolation routing.
 - updated the "re-cut" feature in Geometry object; now if the re-cut parameter is non zero it will cut half of the entered distance before the isolation end and half of it after the isolation end
 - added to Paint and NCC Tool a feature that allow polygon area selection when the reference is selected as Area Selection
 - in Paint Tool and NCC Tool added ability to use Escape Tool to cancel Area Selection and for Paint Tool to cancel Polygon Selection
+- fixed issue in "re-cut" feature when combined with multi-depth feature
 
 13.03.2020
 

+ 42 - 6
camlib.py

@@ -5186,13 +5186,13 @@ class CNCjob(Geometry):
         # between point 0 and point 1 is more than the distance we set for the extra cut then make an interpolation
         # along the path and find the point at the distance extracut_length
 
-        # this is an extra line therefore lift the milling bit
-        gcode += self.doformat(p.lift_code, x=prev_x, y=prev_y, z_move=z_move)  # lift
-
         if extracut_length == 0.0:
             extra_path = [path[-1], path[0], path[1]]
-            new_x = path[-1][0]
-            new_y = path[-1][1]
+            new_x = extra_path[0][0]
+            new_y = extra_path[0][1]
+
+            # this is an extra line therefore lift the milling bit
+            gcode += self.doformat(p.lift_code, x=prev_x, y=prev_y, z_move=z_move)  # lift
 
             # move fast to the new first point
             gcode += self.doformat(p.rapid_code, x=new_x, y=new_y)
@@ -5211,14 +5211,28 @@ class CNCjob(Geometry):
             for pt in extra_path[1:]:
                 gcode += self.doformat(p.linear_code, x=pt[0], y=pt[1])
                 last_pt = pt
+
+            # go back to the original point
+            gcode += self.doformat(p.linear_code, x=path[0][0], y=path[0][1])
+            last_pt = path[0]
         else:
             # go to the point that is 5% in length before the end (therefore 95% length from start of the line),
             # along the line to be cut
-            extra_line = substring(target_linear, (-extracut_length * 0.5), (extracut_length * 0.5))
+            if extracut_length >= target_linear.length:
+                extracut_length = target_linear.length
+
+            # ---------------------------------------------
+            # first half
+            # ---------------------------------------------
+            start_length = target_linear.length - (extracut_length * 0.5)
+            extra_line = substring(target_linear, start_length, target_linear.length)
             extra_path = list(extra_line.coords)
             new_x = extra_path[0][0]
             new_y = extra_path[0][1]
 
+            # this is an extra line therefore lift the milling bit
+            gcode += self.doformat(p.lift_code, x=prev_x, y=prev_y, z_move=z_move)  # lift
+
             # move fast to the new first point
             gcode += self.doformat(p.rapid_code, x=new_x, y=new_y)
 
@@ -5231,6 +5245,28 @@ class CNCjob(Geometry):
             else:
                 gcode += self.doformat(p.down_code, x=new_x, y=new_y, z_cut=z_cut)  # Start cutting
 
+            # start cutting the extra line
+            for pt in extra_path[1:]:
+                gcode += self.doformat(p.linear_code, x=pt[0], y=pt[1])
+
+            # ---------------------------------------------
+            # second half
+            # ---------------------------------------------
+            extra_line = substring(target_linear, 0, (extracut_length * 0.5))
+            extra_path = list(extra_line.coords)
+
+            # start cutting the extra line
+            last_pt = extra_path[0]
+            for pt in extra_path[1:]:
+                gcode += self.doformat(p.linear_code, x=pt[0], y=pt[1])
+                last_pt = pt
+
+            # ---------------------------------------------
+            # back to original start point, cutting
+            # ---------------------------------------------
+            extra_line = substring(target_linear, 0, (extracut_length * 0.5))
+            extra_path = list(extra_line.coords)[::-1]
+
             # start cutting the extra line
             last_pt = extra_path[0]
             for pt in extra_path[1:]:

+ 0 - 1
flatcamTools/ToolPaint.py

@@ -1778,7 +1778,6 @@ class ToolPaint(FlatCAMTool, Gerber):
         else:
             key = event.key
 
-        print(key)
         if key == QtCore.Qt.Key_Escape or key == 'Escape':
             try:
                 if self.app.is_legacy is False: