diff --git a/CHANGELOG.md b/CHANGELOG.md index 087bff69..98112ab8 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -17,6 +17,7 @@ CHANGELOG for FlatCAM beta - in Panelize Tool - fixed the export when panelizing Excllon objects - in Panelize Tool - remade the methods such that panelizing a Gerber object as Geometry panel will now hold all the Gerber apertures as Geometry tools and added a supplementary tool that holds the solid_geometry. - in Panelize Tool - remade the methods such that panelizing a Geometry object as a Gerber panel will attempt to create polygons from Geometry +- in Panelize Tool - made sure that when the path optimization will yield an empty geometry it will not be added to the panel geometry 1.12.2020 diff --git a/appTools/ToolPanelize.py b/appTools/ToolPanelize.py index a3d870f2..16f67f4e 100644 --- a/appTools/ToolPanelize.py +++ b/appTools/ToolPanelize.py @@ -470,7 +470,8 @@ class Panelize(AppTool): pol_nr = 0 for geo_el in panel_source_obj.tools[tool]['solid_geometry']: trans_geo = translate_recursion(geo_el) - new_obj.tools[tool]['solid_geometry'].append(trans_geo) + if not trans_geo.is_empty: + new_obj.tools[tool]['solid_geometry'].append(trans_geo) # update progress pol_nr += 1 @@ -615,7 +616,7 @@ class Panelize(AppTool): lines[idx_s] = res fused_lines = linemerge(lines) - fused_lines = [unary_union(fused_lines)] + fused_lines = [unary_union(fused_lines)] if not fused_lines.is_empty else [] new_obj.tools[tool]['solid_geometry'] = fused_lines + other_geo @@ -749,7 +750,8 @@ class Panelize(AppTool): pol_nr = 0 for geo_el in panel_source_obj.tools[tool]['solid_geometry']: trans_geo = translate_recursion(geo_el) - new_obj.tools[tool]['solid_geometry'].append(trans_geo) + if not trans_geo.is_empty: + new_obj.tools[tool]['solid_geometry'].append(trans_geo) # update progress pol_nr += 1 diff --git a/camlib.py b/camlib.py index 5416efa9..2f8dd8c4 100644 --- a/camlib.py +++ b/camlib.py @@ -7583,8 +7583,10 @@ class CNCjob(Geometry): maxx = -np.Inf maxy = -np.Inf try: - for k in v['solid_geometry']: - minx_, miny_, maxx_, maxy_ = bounds_rec(k) + for geo in v['solid_geometry']: + if geo.is_empty: + continue + minx_, miny_, maxx_, maxy_ = bounds_rec(geo) minx = min(minx, minx_) miny = min(miny, miny_) maxx = max(maxx, maxx_) @@ -7603,8 +7605,8 @@ class CNCjob(Geometry): maxx = -np.Inf maxy = -np.Inf try: - for k in v['solid_geometry']: - minx_, miny_, maxx_, maxy_ = bounds_rec(k) + for geo in v['solid_geometry']: + minx_, miny_, maxx_, maxy_ = bounds_rec(geo) minx = min(minx, minx_) miny = min(miny, miny_) maxx = max(maxx, maxx_)