Просмотр исходного кода

Fixes #135

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.
Thomas Duffin 10 лет назад
Родитель
Сommit
2c9a307483
1 измененных файлов с 1 добавлено и 1 удалено
  1. 1 1
      camlib.py

+ 1 - 1
camlib.py

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