From 2fd8c769961b594a47cfc9edbe9afa157ceafa98 Mon Sep 17 00:00:00 2001 From: Marius Stanciu Date: Sun, 29 Aug 2021 19:01:46 +0300 Subject: [PATCH] =?UTF-8?q?-=20fixed=20a=20reported=20issue=20with=20the?= =?UTF-8?q?=20manual=20cutout=20in=20Cutout=20Plugin=20where=20adding=20mo?= =?UTF-8?q?re=20gaps=20will=20crash=20the=20app=20due=20of=20the=20manual?= =?UTF-8?q?=20geometry=20being=20a=20MultiPolygon=20and=20not=20a=20Polygo?= =?UTF-8?q?n=20as=20it=20was=20assumed=20-=20fixed=20a=20reported=20bug=20?= =?UTF-8?q?in=20convert=202=20geometry=20where=20a=20MultiLineString'=20ob?= =?UTF-8?q?ject=20does=20not=20support=20item=20assignment=E2=80=9C=20erro?= =?UTF-8?q?r=20was=20issued?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- CHANGELOG.md | 2 ++ appPlugins/ToolCutOut.py | 11 ++++++++++- app_Main.py | 5 ++++- 3 files changed, 16 insertions(+), 2 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 43e976df..14947636 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -10,6 +10,8 @@ CHANGELOG for FlatCAM beta 28.08.2021 - removed the setting for HDPI from Preferences and QSettings: QT6 does it automatically now +- fixed a reported issue with the manual cutout in Cutout Plugin where adding more gaps will crash the app due of the manual geometry being a MultiPolygon and not a Polygon as it was assumed +- fixed a reported bug in convert 2 geometry where a MultiLineString' object does not support item assignment“ error was issued 26.08.2021 diff --git a/appPlugins/ToolCutOut.py b/appPlugins/ToolCutOut.py index 54a571c6..73c2a02d 100644 --- a/appPlugins/ToolCutOut.py +++ b/appPlugins/ToolCutOut.py @@ -1623,7 +1623,16 @@ class CutOut(AppTool): if self.ui.gaptype_radio.get_value() == 'mb': mb_dia = self.ui.mb_dia_entry.get_value() b_dia = (self.cutting_dia / 2.0) - (mb_dia / 2.0) - self.mb_manual_solid_geo = self.flatten(unary_union(self.manual_solid_geo).buffer(b_dia).interiors) + # flaten manual geometry + unified_man_geo = unary_union(self.manual_solid_geo) + buff_man_geo = unified_man_geo.buffer(b_dia) + if isinstance(buff_man_geo, MultiPolygon): + int_list = [] + for b_geo in buff_man_geo.geoms: + int_list += b_geo.interiors + else: + int_list = buff_man_geo.interiors + self.mb_manual_solid_geo = self.flatten(int_list) self.cutting_gapsize = self.ui.gapsize.get_value() diff --git a/app_Main.py b/app_Main.py index 218bdd79..06541e28 100644 --- a/app_Main.py +++ b/app_Main.py @@ -4563,7 +4563,10 @@ class App(QtCore.QObject): for tooluid, dict_value in obj.tools.items(): total_solid_geometry += deepcopy(dict_value['solid_geometry']) # clear the original geometry - dict_value['solid_geometry'][:] = [] + if isinstance(dict_value['solid_geometry'], list): + dict_value['solid_geometry'][:] = [] + else: + dict_value['solid_geometry'] = [] obj.solid_geometry = deepcopy(total_solid_geometry) obj.plot()