- modified the bounding box utility feature in the Gerber Object UI to work with buffer value of 0.0 and rounded corners
This commit is contained in:
@@ -11,6 +11,7 @@ CHANGELOG for FlatCAM beta
|
|||||||
|
|
||||||
- fixed the Cutout plugin not working with Geometry objects that are made out of a LineString or LinearRing geometric elements
|
- fixed the Cutout plugin not working with Geometry objects that are made out of a LineString or LinearRing geometric elements
|
||||||
- fixed the Cutout plugin for the rectangular cutout: the name of the resulting object is now correct if there is no extension in the source file
|
- fixed the Cutout plugin for the rectangular cutout: the name of the resulting object is now correct if there is no extension in the source file
|
||||||
|
- modified the bounding box utility feature in the Gerber Object UI to work with buffer value of 0.0 and rounded corners
|
||||||
|
|
||||||
25.01.2022
|
25.01.2022
|
||||||
|
|
||||||
|
|||||||
@@ -461,7 +461,7 @@ class GerberObject(FlatCAMObj, Gerber):
|
|||||||
non_copper = bounding_box.difference(self.solid_geometry)
|
non_copper = bounding_box.difference(self.solid_geometry)
|
||||||
non_copper = flatten_shapely_geometry(non_copper)
|
non_copper = flatten_shapely_geometry(non_copper)
|
||||||
|
|
||||||
if non_copper is None or non_copper.is_empty:
|
if non_copper is None or (not isinstance(non_copper, list) and non_copper.is_empty):
|
||||||
app_obj.inform.emit("[ERROR_NOTCL] %s" % _("Operation could not be done."))
|
app_obj.inform.emit("[ERROR_NOTCL] %s" % _("Operation could not be done."))
|
||||||
return "fail"
|
return "fail"
|
||||||
geo_obj.solid_geometry = non_copper
|
geo_obj.solid_geometry = non_copper
|
||||||
@@ -483,6 +483,14 @@ class GerberObject(FlatCAMObj, Gerber):
|
|||||||
self.solid_geometry = unary_union(self.solid_geometry)
|
self.solid_geometry = unary_union(self.solid_geometry)
|
||||||
|
|
||||||
# Bounding box with rounded corners
|
# Bounding box with rounded corners
|
||||||
|
if isinstance(self.solid_geometry, Polygon):
|
||||||
|
bounding_box = self.solid_geometry.buffer(float(self.options["bboxmargin"])).exterior
|
||||||
|
elif isinstance(self.solid_geometry, MultiPolygon):
|
||||||
|
try:
|
||||||
|
bounding_box = self.solid_geometry.buffer(float(self.options["bboxmargin"])).exterior
|
||||||
|
except Exception:
|
||||||
|
bounding_box = self.solid_geometry.envelope.buffer(float(self.options["bboxmargin"]))
|
||||||
|
else:
|
||||||
bounding_box = self.solid_geometry.envelope.buffer(float(self.options["bboxmargin"]))
|
bounding_box = self.solid_geometry.envelope.buffer(float(self.options["bboxmargin"]))
|
||||||
if not self.options["bboxrounded"]: # Remove rounded corners
|
if not self.options["bboxrounded"]: # Remove rounded corners
|
||||||
bounding_box = bounding_box.envelope
|
bounding_box = bounding_box.envelope
|
||||||
|
|||||||
@@ -2506,6 +2506,9 @@ class Gerber(Geometry):
|
|||||||
# variables to display the percentage of work done
|
# variables to display the percentage of work done
|
||||||
self.geo_len = 0
|
self.geo_len = 0
|
||||||
try:
|
try:
|
||||||
|
if isinstance(self.solid_geometry, (MultiPolygon, MultiLineString)):
|
||||||
|
self.geo_len = len(self.solid_geometry.geoms)
|
||||||
|
else:
|
||||||
self.geo_len = len(self.solid_geometry)
|
self.geo_len = len(self.solid_geometry)
|
||||||
except (TypeError, ValueError, RuntimeError):
|
except (TypeError, ValueError, RuntimeError):
|
||||||
self.geo_len = 1
|
self.geo_len = 1
|
||||||
|
|||||||
Reference in New Issue
Block a user