- fixed the camlib.Geometry.import_svg() and camlib.Gerber.bounds() to work when importing SVG files as Gerber

This commit is contained in:
Marius Stanciu 2019-04-04 02:15:59 +03:00
parent 8fc7c0ffc1
commit 4bbdeaf844
2 changed files with 13 additions and 12 deletions

View File

@ -17,7 +17,7 @@ CAD program, and create G-Code for Isolation routing.
- modified the calling of the editor2object() slot function to fix an issue with updating geometry imported from SVG file, after edit
- working on Gerber Editor - added the key shortcuts: wip
- made saving of the project file non-blocking and also while saving the project file, if the user tries again to close the app while project file is being saved, the app will close only after saving is complete (the project file size is non zero)
- fixed the quit action when denying the save, to save the default values and the QSettings
- fixed the camlib.Geometry.import_svg() and camlib.Gerber.bounds() to work when importing SVG files as Gerber
31.03.2019

View File

@ -621,7 +621,6 @@ class Geometry(object):
# flatten the self.solid_geometry list for import_svg() to import SVG as Gerber
self.solid_geometry = list(self.flatten_list(self.solid_geometry))
#self.solid_geometry = cascaded_union(self.solid_geometry)
geos_text = getsvgtext(svg_root, object_type, units=units)
if geos_text is not None:
@ -632,7 +631,8 @@ class Geometry(object):
_, minimy, _, maximy = i.bounds
h2 = (maximy - minimy) * 0.5
geos_text_f.append(translate(scale(i, 1.0, -1.0, origin=(0, 0)), yoff=(h + h2)))
self.solid_geometry = [self.solid_geometry, geos_text_f]
if geos_text_f:
self.solid_geometry = self.solid_geometry + geos_text_f
def import_dxf(self, filename, object_type=None, units='MM'):
"""
@ -3246,16 +3246,17 @@ class Gerber (Geometry):
maxx = max(maxx, maxx_)
maxy = max(maxy, maxy_)
else:
try:
minx_, miny_, maxx_, maxy_ = bounds_rec(k)
except Exception as e:
log.debug("camlib.Geometry.bounds() --> %s" % str(e))
return
if not k.is_empty:
try:
minx_, miny_, maxx_, maxy_ = bounds_rec(k)
except Exception as e:
log.debug("camlib.Gerber.bounds() --> %s" % str(e))
return
minx = min(minx, minx_)
miny = min(miny, miny_)
maxx = max(maxx, maxx_)
maxy = max(maxy, maxy_)
minx = min(minx, minx_)
miny = min(miny, miny_)
maxx = max(maxx, maxx_)
maxy = max(maxy, maxy_)
return minx, miny, maxx, maxy
else:
# it's a Shapely object, return it's bounds