- in Panelize Tool - made sure that when the path optimization will yield an empty geometry it will not be added to the panel geometry

This commit is contained in:
Marius Stanciu
2020-12-03 02:30:16 +02:00
committed by Marius
parent 9231530e20
commit 01f5a37bee
3 changed files with 12 additions and 7 deletions

View File

@@ -17,6 +17,7 @@ CHANGELOG for FlatCAM beta
- in Panelize Tool - fixed the export when panelizing Excllon objects - 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 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 - 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 1.12.2020

View File

@@ -470,7 +470,8 @@ class Panelize(AppTool):
pol_nr = 0 pol_nr = 0
for geo_el in panel_source_obj.tools[tool]['solid_geometry']: for geo_el in panel_source_obj.tools[tool]['solid_geometry']:
trans_geo = translate_recursion(geo_el) 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 # update progress
pol_nr += 1 pol_nr += 1
@@ -615,7 +616,7 @@ class Panelize(AppTool):
lines[idx_s] = res lines[idx_s] = res
fused_lines = linemerge(lines) 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 new_obj.tools[tool]['solid_geometry'] = fused_lines + other_geo
@@ -749,7 +750,8 @@ class Panelize(AppTool):
pol_nr = 0 pol_nr = 0
for geo_el in panel_source_obj.tools[tool]['solid_geometry']: for geo_el in panel_source_obj.tools[tool]['solid_geometry']:
trans_geo = translate_recursion(geo_el) 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 # update progress
pol_nr += 1 pol_nr += 1

View File

@@ -7583,8 +7583,10 @@ class CNCjob(Geometry):
maxx = -np.Inf maxx = -np.Inf
maxy = -np.Inf maxy = -np.Inf
try: try:
for k in v['solid_geometry']: for geo in v['solid_geometry']:
minx_, miny_, maxx_, maxy_ = bounds_rec(k) if geo.is_empty:
continue
minx_, miny_, maxx_, maxy_ = bounds_rec(geo)
minx = min(minx, minx_) minx = min(minx, minx_)
miny = min(miny, miny_) miny = min(miny, miny_)
maxx = max(maxx, maxx_) maxx = max(maxx, maxx_)
@@ -7603,8 +7605,8 @@ class CNCjob(Geometry):
maxx = -np.Inf maxx = -np.Inf
maxy = -np.Inf maxy = -np.Inf
try: try:
for k in v['solid_geometry']: for geo in v['solid_geometry']:
minx_, miny_, maxx_, maxy_ = bounds_rec(k) minx_, miny_, maxx_, maxy_ = bounds_rec(geo)
minx = min(minx, minx_) minx = min(minx, minx_)
miny = min(miny, miny_) miny = min(miny, miny_)
maxx = max(maxx, maxx_) maxx = max(maxx, maxx_)