From 7bc941f3dde0f291d277245a7e1b14dd44225c7e Mon Sep 17 00:00:00 2001 From: Marius Stanciu Date: Wed, 26 Jan 2022 12:51:08 +0200 Subject: [PATCH] - in Cutout plugin added the ability to create Manual Geometries with negative tool diameters --- CHANGELOG.md | 1 + appPlugins/ToolCutOut.py | 13 ++++++------- 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 49e3bf9b..69709f29 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -12,6 +12,7 @@ CHANGELOG for FlatCAM beta - fixed the Cutout plugin not working with Geometry objects that are made out of a LineString or LinearRing geometric elements - fixed the Cutout plugin for the rectangular cutout: the name of the resulting object is now correct if there is no extension in the source file - modified the bounding box utility feature in the Gerber Object UI to work with buffer value of 0.0 and rounded corners +- in Cutout plugin added the ability to create Manual Geometries with negative tool diameters 25.01.2022 diff --git a/appPlugins/ToolCutOut.py b/appPlugins/ToolCutOut.py index c91f9993..a3763097 100644 --- a/appPlugins/ToolCutOut.py +++ b/appPlugins/ToolCutOut.py @@ -1681,11 +1681,6 @@ class CutOut(AppTool): return dia = float(self.ui.dia.get_value()) - if 0 in {dia}: - self.app.inform.emit('[ERROR_NOTCL] %s' % - _("Tool Diameter is zero value. Change it to a positive real number.")) - return - try: kind = self.ui.obj_kind_combo.get_value() except ValueError: @@ -1706,7 +1701,11 @@ class CutOut(AppTool): (isinstance(geo_union, list) and len(geo_union) == 1) or \ (isinstance(geo_union, MultiPolygon) and len(geo_union.geoms) == 1): - buff_geo = geo_union.buffer(margin + abs(dia / 2)).exterior + if dia >= 0: + buff_geo = geo_union.buffer(margin + abs(dia / 2)).exterior + else: + buff_geo = geo_union.buffer(margin + abs(dia / 2)).interiors + buff_geo = unary_union(buff_geo) if shape_type is False: geo_obj.solid_geometry = buff_geo else: @@ -2345,7 +2344,7 @@ class CutoutUI: # Tool Diameter self.dia = FCDoubleSpinner(callback=self.confirmation_message) self.dia.set_precision(self.decimals) - self.dia.set_range(0.0000, 10000.0000) + self.dia.set_range(-10000.0000, 10000.0000) self.dia_label = FCLabel('%s:' % _("Tool Dia")) self.dia_label.setToolTip(