From 5e401fd9f7564df462209d7e9ea33e1ed9dca422 Mon Sep 17 00:00:00 2001 From: Marius Stanciu Date: Fri, 5 Jul 2019 20:45:15 +0300 Subject: [PATCH] - some other bug in CutOut tool fixed --- README.md | 1 + flatcamTools/ToolCutOut.py | 19 +++++++++++-------- 2 files changed, 12 insertions(+), 8 deletions(-) diff --git a/README.md b/README.md index 0cfbf60a..12f87861 100644 --- a/README.md +++ b/README.md @@ -12,6 +12,7 @@ CAD program, and create G-Code for Isolation routing. 5.07.2019 - fixed bug in CutOut Tool +- some other bug in CutOut tool fixed 1.07.2019 diff --git a/flatcamTools/ToolCutOut.py b/flatcamTools/ToolCutOut.py index c7136e39..5a1ad29f 100644 --- a/flatcamTools/ToolCutOut.py +++ b/flatcamTools/ToolCutOut.py @@ -414,10 +414,13 @@ class CutOut(FlatCAMTool): else: object_geo = cutout_obj.solid_geometry - try: - __ = iter(object_geo) - except TypeError: - object_geo = [object_geo] + # try: + # __ = iter(object_geo) + # except TypeError: + # object_geo = [object_geo] + + object_geo = unary_union(object_geo) + # for geo in object_geo: if isinstance(cutout_obj, FlatCAMGerber): @@ -425,8 +428,6 @@ class CutOut(FlatCAMTool): else: geo = object_geo - geo = unary_union(geo) - # Get min and max data for each object as we just cut rectangles across X or Y xmin, ymin, xmax, ymax = recursive_bounds(geo) @@ -785,11 +786,13 @@ class CutOut(FlatCAMTool): convex_box = self.convex_box.get_value() def geo_init(geo_obj, app_obj): + geo_union = unary_union(cutout_obj.solid_geometry) + if convex_box: - geo = cutout_obj.solid_geometry.convex_hull + geo = geo_union.convex_hull geo_obj.solid_geometry = geo.buffer(margin + abs(dia / 2)) else: - geo = cutout_obj.solid_geometry + geo = geo_union geo = geo.buffer(margin + abs(dia / 2)) if isinstance(geo, Polygon): geo_obj.solid_geometry = geo.exterior