- 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

This commit is contained in:
Marius Stanciu
2022-01-26 13:11:44 +02:00
committed by Marius
parent 7bc941f3dd
commit 73fca98f90
2 changed files with 8 additions and 1 deletions

View File

@@ -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

View File

@@ -2630,7 +2630,13 @@ class Geometry(object):
except TypeError:
try:
if factor is None or factor is False or factor == 0:
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: