diff --git a/CHANGELOG.md b/CHANGELOG.md index 69709f29..c460a338 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -13,6 +13,7 @@ CHANGELOG for FlatCAM beta - 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 - in Cutout plugin added the ability to create Manual Geometries with negative tool diameters +- fix the Transform plugin, buffer functionality for Geometry objects such that the buffer with negative values will work by crating a buffer toward the interior of that geometry 25.01.2022 diff --git a/camlib.py b/camlib.py index 33890223..bde8620f 100644 --- a/camlib.py +++ b/camlib.py @@ -2630,7 +2630,13 @@ class Geometry(object): except TypeError: try: if factor is None or factor is False or factor == 0: - new_obj = obj.buffer(distance, resolution=self.geo_steps_per_circle, join_style=join) + if distance >= 0: + new_obj = obj.buffer(distance, resolution=self.geo_steps_per_circle, join_style=join) + else: + new_obj = obj.buffer(abs(distance*2), resolution=self.geo_steps_per_circle, join_style=join) + new_obj = unary_union(new_obj.interiors) + new_obj = new_obj.buffer(-distance, resolution=self.geo_steps_per_circle, join_style=join) + new_obj = new_obj.exterior if isinstance(obj, (LinearRing, LineString)) and only_exterior is True: new_obj = new_obj.exterior else: