- 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)

This commit is contained in:
Marius Stanciu
2022-05-09 16:12:12 +03:00
parent 9dc6c94a45
commit ba7fafb6de
2 changed files with 3 additions and 2 deletions

View File

@@ -10,6 +10,7 @@ CHANGELOG for FlatCAM Evo beta
9.05.2022 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 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 6.05.2022

View File

@@ -202,7 +202,7 @@ def path2shapely(path, object_type, res=1.0, units='MM', factor=1.0):
contained = [] contained = []
not_contained = [] not_contained = []
if len(poly_list) > 1: if len(poly_list) > 1:
for p in poly_list[1:-1]: for p in poly_list[1:]:
if poly_list[0].contains(p): if poly_list[0].contains(p):
contained.append(p) contained.append(p)
else: else:
@@ -217,7 +217,7 @@ def path2shapely(path, object_type, res=1.0, units='MM', factor=1.0):
if contained: if contained:
geo_element = Polygon(poly_list[0].exterior, [p.exterior for p in contained]) geo_element = Polygon(poly_list[0].exterior, [p.exterior for p in contained])
geometry.append(geo_element) geometry.append(geo_element)
except Exception as err: except Exception:
coords = [] coords = []
for line in rings.geoms: for line in rings.geoms:
coords.append(line.coords[0]) coords.append(line.coords[0])