Additional fixes for export size and flattening the geometry list
This commit is contained in:
@@ -1730,22 +1730,17 @@ class App(QtCore.QObject):
|
|||||||
|
|
||||||
# Sometimes obj.solid_geometry can be a list instead of a Shapely class
|
# Sometimes obj.solid_geometry can be a list instead of a Shapely class
|
||||||
# Make sure we see it as a Shapely Geometry class
|
# Make sure we see it as a Shapely Geometry class
|
||||||
geom = obj.solid_geometry
|
geom = cascaded_union(obj.flatten())
|
||||||
if type(obj.solid_geometry) is list:
|
|
||||||
geom = [cascaded_union(obj.solid_geometry)][0]
|
|
||||||
|
|
||||||
|
|
||||||
# Determine bounding area for svg export
|
# Determine bounding area for svg export
|
||||||
svgwidth = geom.bounds[2] - geom.bounds[0]
|
bounds = obj.bounds()
|
||||||
svgheight = geom.bounds[3] - geom.bounds[1]
|
size = obj.size()
|
||||||
minx = geom.bounds[0]
|
|
||||||
miny = geom.bounds[1] - svgheight
|
|
||||||
|
|
||||||
# Convert everything to strings for use in the xml doc
|
# Convert everything to strings for use in the xml doc
|
||||||
svgwidth = str(svgwidth)
|
svgwidth = str(size[0])
|
||||||
svgheight = str(svgheight)
|
svgheight = str(size[1])
|
||||||
minx = str(minx)
|
minx = str(bounds[0])
|
||||||
miny = str(miny)
|
miny = str(bounds[1] - size[1])
|
||||||
uom = obj.units.lower()
|
uom = obj.units.lower()
|
||||||
|
|
||||||
# Add a SVG Header and footer to the svg output from shapely
|
# Add a SVG Header and footer to the svg output from shapely
|
||||||
|
|||||||
@@ -877,9 +877,7 @@ class Geometry(object):
|
|||||||
"""
|
"""
|
||||||
# Sometimes self.solid_geometry can be a list instead of a Shapely class
|
# Sometimes self.solid_geometry can be a list instead of a Shapely class
|
||||||
# Make sure we see it as a Shapely Geometry class
|
# Make sure we see it as a Shapely Geometry class
|
||||||
geom = self.solid_geometry
|
geom = cascaded_union(self.flatten())
|
||||||
if type(self.solid_geometry) is list:
|
|
||||||
geom = [cascaded_union(self.solid_geometry)][0]
|
|
||||||
|
|
||||||
# Convert to a SVG
|
# Convert to a SVG
|
||||||
svg_elem = geom.svg(scale_factor=0.05)
|
svg_elem = geom.svg(scale_factor=0.05)
|
||||||
|
|||||||
Reference in New Issue
Block a user