From 739e41d48b4c86c6979811b1ef433d9dbe96a7e2 Mon Sep 17 00:00:00 2001 From: Marius Stanciu Date: Tue, 17 May 2022 15:43:36 +0300 Subject: [PATCH 1/2] - in Cutout Plugin added an extra attempt to solve the issue with creating invalid geometries --- CHANGELOG.md | 1 + appPlugins/ToolCutOut.py | 8 ++++++++ 2 files changed, 9 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 8c62e9c4..15e5ea78 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -11,6 +11,7 @@ CHANGELOG for FlatCAM Evo beta - in Cutout Plugin added ability to use the margin (full range of values: negative, zero, positive) when applying the cutout over a Geometry source object - updated the Turkish language strings (by Mehmet Kaya) +- in Cutout Plugin added an extra attempt to solve the issue with creating invalid geometries 16.05.2022 diff --git a/appPlugins/ToolCutOut.py b/appPlugins/ToolCutOut.py index 756df061..83b40745 100644 --- a/appPlugins/ToolCutOut.py +++ b/appPlugins/ToolCutOut.py @@ -744,6 +744,8 @@ class CutOut(AppTool): object_geo = Polygon(object_geo) if margin >= 0: geo_buf = object_geo.buffer(margin) + if geo_buf.is_empty: + geo_buf = object_geo.buffer(margin + 0.0000001) geo = geo_buf.exterior else: geo_buf = object_geo.buffer(0.0000001) @@ -771,6 +773,8 @@ class CutOut(AppTool): else: if margin >= 0: geo_buf = geom_struct.buffer(margin) + if geo_buf.is_empty: + geo_buf = geom_struct.buffer(margin + 0.0000001) geom_struct = geo_buf.exterior else: geo_buf = geom_struct.buffer(0.0000001) @@ -1126,6 +1130,8 @@ class CutOut(AppTool): else: if margin >= 0: geo_buf = geo.buffer(margin) + if geo_buf.is_empty: + geo_buf = geo.buffer(margin + 0.0000001) geo = geo_buf.exterior else: geo_buf = geo.buffer(0.0000001) @@ -1147,6 +1153,8 @@ class CutOut(AppTool): geom_struct = box(xmin, ymin, xmax, ymax) if margin >= 0: geo_buf = geom_struct.buffer(margin) + if geo_buf.is_empty: + geo_buf = geom_struct.buffer(margin + 0.0000001) geom_struct = geo_buf.exterior else: geo_buf = geom_struct.buffer(0.0000001) From 04bb08579418779d65af07ae2abb546ffb402116 Mon Sep 17 00:00:00 2001 From: Marius Stanciu Date: Tue, 17 May 2022 20:35:14 +0300 Subject: [PATCH 2/2] - the ArgThread class is no longer launched in case of Linux systems due of crashes --- CHANGELOG.md | 1 + appMain.py | 7 +++---- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 15e5ea78..5fbe3c3b 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -12,6 +12,7 @@ CHANGELOG for FlatCAM Evo beta - in Cutout Plugin added ability to use the margin (full range of values: negative, zero, positive) when applying the cutout over a Geometry source object - updated the Turkish language strings (by Mehmet Kaya) - in Cutout Plugin added an extra attempt to solve the issue with creating invalid geometries +- the ArgThread class is no longer launched in case of Linux systems due of crashes 16.05.2022 diff --git a/appMain.py b/appMain.py index d20170b2..65a68319 100644 --- a/appMain.py +++ b/appMain.py @@ -451,7 +451,7 @@ class App(QtCore.QObject): # ############################################################################################################ # ################# Setup the listening thread for another instance launching with args ###################### # ############################################################################################################ - if sys.platform == 'win32' or sys.platform == 'linux': + if sys.platform == 'win32': # make sure the thread is stored by using a self. otherwise it's garbage collected self.listen_th = QtCore.QThread() self.listen_th.start(priority=QtCore.QThread.Priority.LowestPriority) @@ -4180,7 +4180,7 @@ class App(QtCore.QObject): # try to quit the QThread that run ArgsThread class try: # del self.new_launch - if sys.platform == 'win32' or sys.platform == 'linux': + if sys.platform == 'win32': self.listen_th.quit() except Exception as e: if silent is False: @@ -4194,7 +4194,7 @@ class App(QtCore.QObject): # self.close_app_signal.emit() # sys.exit(0) QtWidgets.QApplication.quit() - if sys.platform == 'win32' or sys.platform == 'linux': + if sys.platform == 'win32': try: self.new_launch.close_command() except Exception: @@ -9451,7 +9451,6 @@ class App(QtCore.QObject): return float('%.*f' % (dec_nr, float(val))) - class ArgsThread(QtCore.QObject): open_signal = pyqtSignal(list) start = pyqtSignal()