- in import SVG and import DXF methods made sure that any polygons that are imported as polygons will survive and only the lines are optimized (changed the behavior of the above made modification)
This commit is contained in:
30
camlib.py
30
camlib.py
@@ -1058,8 +1058,19 @@ class Geometry(object):
|
||||
geos = [translate(scale(g, 1.0, -1.0, origin=(0, 0)), yoff=h) for g in geos]
|
||||
|
||||
# trying to optimize the resulting geometry by merging contiguous lines
|
||||
geos = self.flatten(geos, reset=True, pathonly=True)
|
||||
geos = linemerge(geos)
|
||||
geos = list(self.flatten_list(geos))
|
||||
geos_polys = []
|
||||
geos_lines = []
|
||||
for g in geos:
|
||||
if isinstance(g, Polygon):
|
||||
geos_polys.append(g)
|
||||
else:
|
||||
geos_lines.append(g)
|
||||
|
||||
merged_lines = linemerge(geos_lines)
|
||||
geos = geos_polys
|
||||
for l in merged_lines:
|
||||
geos.append(l)
|
||||
|
||||
# Add to object
|
||||
if self.solid_geometry is None:
|
||||
@@ -1123,8 +1134,19 @@ class Geometry(object):
|
||||
geos = getdxfgeo(dxf)
|
||||
|
||||
# trying to optimize the resulting geometry by merging contiguous lines
|
||||
geos = self.flatten(geos, reset=True, pathonly=True)
|
||||
geos = linemerge(geos)
|
||||
geos = list(self.flatten_list(geos))
|
||||
geos_polys = []
|
||||
geos_lines = []
|
||||
for g in geos:
|
||||
if isinstance(g, Polygon):
|
||||
geos_polys.append(g)
|
||||
else:
|
||||
geos_lines.append(g)
|
||||
|
||||
merged_lines = linemerge(geos_lines)
|
||||
geos = geos_polys
|
||||
for l in merged_lines:
|
||||
geos.append(l)
|
||||
|
||||
# Add to object
|
||||
if self.solid_geometry is None:
|
||||
|
||||
Reference in New Issue
Block a user