diff --git a/CHANGELOG.md b/CHANGELOG.md index 2ff35813..6a7e4865 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -13,6 +13,7 @@ CHANGELOG for FlatCAM Evo beta - in Geometry Editor for the Path tool but only when using the 3D engine graphic mode, the mouse cursor is followed by position data - in Geometry Editor for the Path tool fixed an issue with path projection when changing the grid size while the Path tool is active - in Geometry Editor, for Path tool, added UI that close on end of the Path tool action; it displays the projected length which now is kept for as long as it is wanted, allowing for path automation in case of repetitive lengths +- solved a ZeroDivisionError exception in the Geometry Editor -> Path Tool 13.04.2022 diff --git a/appEditors/AppGeoEditor.py b/appEditors/AppGeoEditor.py index 39a6f12d..841d1938 100644 --- a/appEditors/AppGeoEditor.py +++ b/appEditors/AppGeoEditor.py @@ -1086,13 +1086,15 @@ class FCPath(FCPolygon): last_pt = self.draw_app.app.mouse seg_length = math.sqrt((last_pt[0] - first_pt[0])**2 + (last_pt[1] - first_pt[1])**2) + if seg_length == 0.0: + return try: new_x = first_pt[0] + (last_pt[0] - first_pt[0]) / seg_length * target_length new_y = first_pt[1] + (last_pt[1] - first_pt[1]) / seg_length * target_length except ZeroDivisionError as err: self.points = [] self.clean_up() - return '%s %s' % (_("Failed."), str(err)) + return '[ERROR_NOTCL] %s %s' % (_("Failed."), str(err).capitalize()) if self.points[-1] != (new_x, new_y): self.points.append((new_x, new_y))