- fixed issue #386 - multiple Cut operation on a edited object created a crash due of the bounds() method
This commit is contained in:
parent
fdd5344581
commit
139baaff64
|
@ -3520,7 +3520,7 @@ class App(QtCore.QObject):
|
|||
|
||||
# update the geo object options so it is including the bounding box values
|
||||
try:
|
||||
xmin, ymin, xmax, ymax = edited_obj.bounds()
|
||||
xmin, ymin, xmax, ymax = edited_obj.bounds(flatten=True)
|
||||
edited_obj.options['xmin'] = xmin
|
||||
edited_obj.options['ymin'] = ymin
|
||||
edited_obj.options['xmax'] = xmax
|
||||
|
|
|
@ -19,6 +19,8 @@ CAD program, and create G-Code for Isolation routing.
|
|||
- fixed bug in Gerber parser that allowed loading as Gerber of a file that is not a Gerber
|
||||
- fixed a bug in extension detection for Gerber files that allowed in the filtered list files that extension *.gb*
|
||||
- added a processEvents method in the Gerber parser parse_lines() method
|
||||
- fixed issue #386 - multiple Cut operation on a edited object created a crash due of the bounds() method
|
||||
|
||||
|
||||
4.04.2020
|
||||
|
||||
|
|
16
camlib.py
16
camlib.py
|
@ -614,10 +614,12 @@ class Geometry(object):
|
|||
log.warning("Not implemented.")
|
||||
self.solid_geometry = cascaded_union(diffs)
|
||||
|
||||
def bounds(self):
|
||||
def bounds(self, flatten=False):
|
||||
"""
|
||||
Returns coordinates of rectangular bounds
|
||||
of geometry: (xmin, ymin, xmax, ymax).
|
||||
:param flatten: will flatten the solid_geometry if True
|
||||
:return:
|
||||
"""
|
||||
# fixed issue of getting bounds only for one level lists of objects
|
||||
# now it can get bounds for nested lists of objects
|
||||
|
@ -661,7 +663,13 @@ class Geometry(object):
|
|||
maxy_list = []
|
||||
|
||||
for tool in self.tools:
|
||||
minx, miny, maxx, maxy = bounds_rec(self.tools[tool]['solid_geometry'])
|
||||
working_geo = self.tools[tool]['solid_geometry']
|
||||
|
||||
if flatten:
|
||||
self.flatten(geometry=working_geo, reset=True)
|
||||
working_geo = self.flat_geometry
|
||||
|
||||
minx, miny, maxx, maxy = bounds_rec(working_geo)
|
||||
minx_list.append(minx)
|
||||
miny_list.append(miny)
|
||||
maxx_list.append(maxx)
|
||||
|
@ -669,6 +677,10 @@ class Geometry(object):
|
|||
|
||||
return(min(minx_list), min(miny_list), max(maxx_list), max(maxy_list))
|
||||
else:
|
||||
if flatten:
|
||||
self.flatten(reset=True)
|
||||
self.solid_geometry = self.flat_geometry
|
||||
|
||||
bounds_coords = bounds_rec(self.solid_geometry)
|
||||
return bounds_coords
|
||||
|
||||
|
|
Loading…
Reference in New Issue