From fb5fdff1cd07ebb97d3145797b6711060c5cfa03 Mon Sep 17 00:00:00 2001 From: Marius Stanciu Date: Thu, 19 Nov 2020 22:53:25 +0200 Subject: [PATCH] - in Tool Cutout fixed issues when using a negative value for the Margin parameter when the cutout object is a Gerber object --- CHANGELOG.md | 1 + appTools/ToolCutOut.py | 10 ++++++++-- 2 files changed, 9 insertions(+), 2 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 5767a82d..af19dac3 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -11,6 +11,7 @@ CHANGELOG for FlatCAM beta - cleaned up the Geometry Properties UI - in Geometry Properties UI restored the plot functionality +- in Tool Cutout fixed issues when using a negative value for the Margin parameter when the cutout object is a Gerber object 17.11.2020 diff --git a/appTools/ToolCutOut.py b/appTools/ToolCutOut.py index 29a1efea..eba1d344 100644 --- a/appTools/ToolCutOut.py +++ b/appTools/ToolCutOut.py @@ -798,9 +798,10 @@ class CutOut(AppTool): object_geo = box(x0, y0, x1, y1) if margin >= 0: geo_buf = object_geo.buffer(margin + abs(dia / 2)) + geo = geo_buf.exterior else: - geo_buf = object_geo.buffer(margin - abs(dia / 2)) - geo = geo_buf.exterior + geo_buf = object_geo.buffer(- margin + abs(dia / 2)) + geo = unary_union(geo_buf.interiors) else: if isinstance(object_geo, MultiPolygon): x0, y0, x1, y1 = object_geo.bounds @@ -808,6 +809,11 @@ class CutOut(AppTool): geo_buf = object_geo.buffer(0) geo = geo_buf.exterior + print(geo) + if geo.is_empty: + self.app.inform.emit('[ERROR_NOTCL] %s' % _("Failed.")) + return 'fail' + solid_geo, rest_geo = cutout_handler(geom=geo, gapsize=gapsize) if gap_type == 'bt' and thin_entry != 0: gaps_solid_geo = rest_geo