- some other bug in CutOut tool fixed

This commit is contained in:
Marius Stanciu 2019-07-05 20:45:15 +03:00
parent 1edb049d86
commit 5e401fd9f7
2 changed files with 12 additions and 8 deletions

View File

@ -12,6 +12,7 @@ CAD program, and create G-Code for Isolation routing.
5.07.2019 5.07.2019
- fixed bug in CutOut Tool - fixed bug in CutOut Tool
- some other bug in CutOut tool fixed
1.07.2019 1.07.2019

View File

@ -414,10 +414,13 @@ class CutOut(FlatCAMTool):
else: else:
object_geo = cutout_obj.solid_geometry object_geo = cutout_obj.solid_geometry
try: # try:
__ = iter(object_geo) # __ = iter(object_geo)
except TypeError: # except TypeError:
object_geo = [object_geo] # object_geo = [object_geo]
object_geo = unary_union(object_geo)
# for geo in object_geo: # for geo in object_geo:
if isinstance(cutout_obj, FlatCAMGerber): if isinstance(cutout_obj, FlatCAMGerber):
@ -425,8 +428,6 @@ class CutOut(FlatCAMTool):
else: else:
geo = object_geo geo = object_geo
geo = unary_union(geo)
# Get min and max data for each object as we just cut rectangles across X or Y # Get min and max data for each object as we just cut rectangles across X or Y
xmin, ymin, xmax, ymax = recursive_bounds(geo) xmin, ymin, xmax, ymax = recursive_bounds(geo)
@ -785,11 +786,13 @@ class CutOut(FlatCAMTool):
convex_box = self.convex_box.get_value() convex_box = self.convex_box.get_value()
def geo_init(geo_obj, app_obj): def geo_init(geo_obj, app_obj):
geo_union = unary_union(cutout_obj.solid_geometry)
if convex_box: 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)) geo_obj.solid_geometry = geo.buffer(margin + abs(dia / 2))
else: else:
geo = cutout_obj.solid_geometry geo = geo_union
geo = geo.buffer(margin + abs(dia / 2)) geo = geo.buffer(margin + abs(dia / 2))
if isinstance(geo, Polygon): if isinstance(geo, Polygon):
geo_obj.solid_geometry = geo.exterior geo_obj.solid_geometry = geo.exterior