- fixed some leftovers from Qt6 port

- some code optimizations in the Gerber Editor
- Corners Plugin now generate Gerber objects with the solid geometry flattened
- fixed issue where Gerber objects created from importing SVG geometries could not be edited
This commit is contained in:
Marius Stanciu
2021-09-21 23:41:56 +03:00
committed by Marius
parent 548b5c2e28
commit eaf9562854
6 changed files with 87 additions and 61 deletions

View File

@@ -178,19 +178,20 @@ def path2shapely(path, object_type, res=1.0, units='MM', factor=1.0):
log.error("ParseSVG.path2shapely() MString --> %s" % str(e))
return None
if len(rings) > 0:
if len(rings) == 1 and not isinstance(rings, MultiLineString):
rings_len = len(rings.geoms)
if rings_len > 0:
if rings_len == 1 and not isinstance(rings, MultiLineString):
# Polygons are closed and require more than 2 points
if Point(rings[0][0]).almost_equals(Point(rings[0][-1])) and len(rings[0]) > 2:
geo_element = Polygon(rings[0])
if Point(rings.geoms[0][0]).almost_equals(Point(rings.geoms[0][-1])) and len(rings.geoms[0]) > 2:
geo_element = Polygon(rings.geoms[0])
else:
geo_element = LineString(rings[0])
geo_element = LineString(rings.geoms[0])
else:
try:
geo_element = Polygon(rings[0], rings[1:])
geo_element = Polygon(rings.geoms[0], rings.geoms[1:])
except Exception:
coords = []
for line in rings:
for line in rings.geoms:
coords.append(line.coords[0])
coords.append(line.coords[1])
try: