Merge remote-tracking branch 'origin/Beta_8.995' into Beta_8.995

This commit is contained in:
Marius Stanciu
2022-05-09 16:20:59 +03:00
4 changed files with 34 additions and 6 deletions

View File

@@ -10,6 +10,7 @@ CHANGELOG for FlatCAM Evo beta
9.05.2022
- fixed an issue in the Paint Plugin where some polygons are discarded in a Geometry object made out of an imported SVG
- fixed an issue in the SVG parser where when parsing a path and getting multiple polygons will generate an invalid compound polygon (the polygons other than the first are seen as interiors even if they are not inside the first)
6.05.2022

View File

@@ -186,9 +186,37 @@ def path2shapely(path, object_type, res=1.0, units='MM', factor=1.0):
geo_element = Polygon(rings.geoms[0])
else:
geo_element = LineString(rings.geoms[0])
geometry.append(geo_element)
else:
try:
geo_element = Polygon(rings.geoms[0], rings.geoms[1:])
poly_list = [Polygon(line.coords) for line in rings.geoms]
# if len(poly_list) == 2:
# if poly_list[0].contains(poly_list[1]):
# geo_element = Polygon(rings.geoms[0], rings.geoms[1:])
# geometry.append(geo_element)
# else:
# geometry = poly_list
# else:
# geo_element = Polygon(rings.geoms[0], rings.geoms[1:])
# geometry.append(geo_element)
contained = []
not_contained = []
if len(poly_list) > 1:
for p in poly_list[1:]:
if poly_list[0].contains(p):
contained.append(p)
else:
not_contained.append(p)
else:
not_contained = poly_list
if not_contained:
geometry += [poly_list[0]]
geometry += not_contained
if contained:
geo_element = Polygon(poly_list[0].exterior, [p.exterior for p in contained])
geometry.append(geo_element)
except Exception:
coords = []
for line in rings.geoms:
@@ -198,7 +226,7 @@ def path2shapely(path, object_type, res=1.0, units='MM', factor=1.0):
geo_element = Polygon(coords)
except Exception:
geo_element = LineString(coords)
geometry.append(geo_element)
geometry.append(geo_element)
return geometry

View File

@@ -1976,9 +1976,7 @@ class ToolPaint(AppTool, Gerber):
total_geometry += list(x.get_objects())
# clean the geometry
new_geo = [g for g in total_geometry if g and not g.is_empty]
total_geometry = new_geo
final_solid_geometry += total_geometry
total_geometry = [g for g in total_geometry if g and not g.is_empty]
except grace:
return "fail"
except Exception as e:
@@ -1992,6 +1990,7 @@ class ToolPaint(AppTool, Gerber):
# dictionary and then reset the temporary list that stored that solid_geometry
tools_storage[current_uid]['solid_geometry'] = deepcopy(total_geometry)
tools_storage[current_uid]['data']['name'] = name
final_solid_geometry += total_geometry
# clean the progressive plotted shapes if it was used
if self.app.options["tools_paint_plotting"] == 'progressive':