- if extracut_length is zero then the extracut will cut up until the first point in path no matter what the distance is

This commit is contained in:
Marius Stanciu 2019-12-10 05:33:32 +02:00 committed by Marius
parent 511ebc274f
commit 932f8143cd
2 changed files with 18 additions and 12 deletions

View File

@ -13,6 +13,7 @@ CAD program, and create G-Code for Isolation routing.
- small changes in the Geometry UI
- now extracut option in the Geometry Object will recut as many points as many they are within the specified re-cut length
- if extracut_length is zero then the extracut will cut up until the first point in path no matter what the distance is
9.12.2019

View File

@ -4633,22 +4633,27 @@ 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
if abs(distance(path[1], path[0])) > extracut_length:
i_point = LineString([path[0], path[1]]).interpolate(extracut_length)
gcode += self.doformat(p.linear_code, x=i_point.x, y=i_point.y)
if extracut_length == 0.0:
gcode += self.doformat(p.linear_code, x=path[1][0], y=path[1][1])
last_pt = path[1]
else:
last_pt = path[0]
for pt in path[1:]:
extracut_distance = abs(distance(pt, last_pt))
if extracut_distance <= extracut_length:
gcode += self.doformat(p.linear_code, x=pt[0], y=pt[1])
last_pt = pt
else:
break
if abs(distance(path[1], path[0])) > extracut_length:
i_point = LineString([path[0], path[1]]).interpolate(extracut_length)
gcode += self.doformat(p.linear_code, x=i_point.x, y=i_point.y)
last_pt = (i_point.x, i_point.y)
else:
last_pt = path[0]
for pt in path[1:]:
extracut_distance = abs(distance(pt, last_pt))
if extracut_distance <= extracut_length:
gcode += self.doformat(p.linear_code, x=pt[0], y=pt[1])
last_pt = pt
else:
break
# Up to travelling height.
if up:
gcode += self.doformat(p.lift_code, x=pt[0], y=pt[1], z_move=z_move) # Stop cutting
gcode += self.doformat(p.lift_code, x=last_pt[0], y=last_pt[1], z_move=z_move) # Stop cutting
return gcode