Exception when clicking outside single polygon when trying to paint.
Issue #96
resolved
When trying to "paint" a polygon, if clicking outside the only polygon in the Geometry object, an exception is raised:
[DEBUG][MainThread] on_paint_button_click--> FlatCAMObj.read_form()
[DEBUG][MainThread] button=1, x=77, y=430, xdata=-0.017330, ydata=2.272231
[DEBUG][MainThread] No active tool to respond to click!
Traceback (most recent call last):
File "/usr/local/lib/python2.7/dist-packages/matplotlib/backends/backend_qt5.py", line 263, in mousePressEvent
FigureCanvasBase.button_press_event(self, x, y, button)
File "/usr/local/lib/python2.7/dist-packages/matplotlib/backend_bases.py", line 1870, in button_press_event
self.callbacks.process(s, mouseevent)
File "/usr/local/lib/python2.7/dist-packages/matplotlib/cbook.py", line 540, in process
proxy(*args, **kwargs)
File "/usr/local/lib/python2.7/dist-packages/matplotlib/cbook.py", line 415, in __call__
return mtd(*args, **kwargs)
File "/home/jpcaram/flatcam/FlatCAMObj.py", line 953, in doit
self.paint_poly(point, tooldia, overlap)
File "/home/jpcaram/flatcam/FlatCAMObj.py", line 960, in paint_poly
poly = find_polygon(self.solid_geometry, inside_pt)
File "/home/jpcaram/flatcam/camlib.py", line 2920, in find_polygon
for poly in poly_set:
TypeError: 'Polygon' object is not iterable
Aparently find_polygon
is expecting an iterable, but the geometry consists of only a single Polygon.
Action items:
- Handle non-iterables
- Catch the exception and show error (No polygon found?)
Comments (4)
-
reporter -
reporter - marked as major
The bug brakes the bed flattening feature, thus raising the priority.
-
reporter - marked as critical
It will brake any "paint" operation when whatever is passed to
find_polygon()
is not exactly an iterables with each having a.contains()
method. Increasing priority to critical. -
reporter - changed status to resolved
Solved in commit 4c234fc.
- Log in to comment
The problem continues to exist even when clicking inside the polygon.