- 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:
@@ -1995,13 +1995,13 @@ class Gerber(Geometry):
|
||||
self.solid_geometry = flatten_shapely_geometry(self.solid_geometry)
|
||||
if 0 not in self.tools:
|
||||
self.tools[0] = {
|
||||
'type': 'REG',
|
||||
'size': 0.0,
|
||||
'geometry': []
|
||||
'type': 'REG',
|
||||
'size': 0.0,
|
||||
'geometry': []
|
||||
}
|
||||
|
||||
for pol in self.solid_geometry:
|
||||
new_el = {'solid': pol, 'follow': pol.exterior}
|
||||
new_el = {'solid': pol, 'follow': LineString(pol.exterior.coords)}
|
||||
self.tools[0]['geometry'].append(new_el)
|
||||
|
||||
def import_dxf_as_gerber(self, filename, units='MM'):
|
||||
|
||||
@@ -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:
|
||||
|
||||
Reference in New Issue
Block a user