The polygon passed to clear_polygon() is generated using shapely’s buffer() function on line FlatCAMObj.py:1095.

When the margin given to the buffer() function is small, a single Polygon object is returned. If the margin is large enough it causes the polygon to be broken into pieces and a Multipolygon is returned instead. A visualisation of this can be seen in the shapely manual in the object.buffer() section.

The first thing clear_polygon() does is buffer the polygon again to take the tool diameter into account and the Polygon/Multipolygon generated by this is handled further down the function. The buffer() function used to take the tool diameter into account can be called happily on both Polygon and Multipolygon objects so there is no reason to block Multipolygons being passed to clear_polygon().

Therefore simply adding Multipolygon to the acceptable types in the assert statement on line camlib.py:382 fixes this bug and causes no further issues.
This commit is contained in:
Thomas Duffin 2015-10-25 23:14:11 +00:00
parent ed20a3d208
commit 2c9a307483
1 changed files with 1 additions and 1 deletions

View File

@ -379,7 +379,7 @@ class Geometry(object):
"""
log.debug("camlib.clear_polygon()")
assert type(polygon) == Polygon
assert type(polygon) == Polygon or type(polygon) == MultiPolygon
## The toolpaths
# Index first and last points in paths