From 739e41d48b4c86c6979811b1ef433d9dbe96a7e2 Mon Sep 17 00:00:00 2001 From: Marius Stanciu Date: Tue, 17 May 2022 15:43:36 +0300 Subject: [PATCH] - 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)