- updated the Gerber parser such that it will parse correctly Gerber files that have only one solid polygon inside with multiple clear polygons (like those generated by the Invert Tool)

This commit is contained in:
Marius Stanciu 2020-05-25 00:37:54 +03:00 committed by Marius
parent a6bdf04937
commit 2623bb0a65
4 changed files with 9 additions and 3 deletions

View File

@ -1476,7 +1476,7 @@ class Gerber(Geometry):
sol_geo_length = 1
try:
if buff_length == 0 and sol_geo_length in [0, 1]:
if buff_length == 0 and sol_geo_length in [0, 1] and self.solid_geometry.area == 0:
log.error("Object is not Gerber file or empty. Aborting Object creation.")
return 'fail'
except TypeError as e:

View File

@ -228,6 +228,11 @@ class ToolInvertGerber(AppTool):
for poly in grb_obj.solid_geometry:
new_solid_geometry = new_solid_geometry.difference(poly)
try:
__ = iter(new_solid_geometry)
except TypeError:
new_solid_geometry = [new_solid_geometry]
new_options = {}
for opt in grb_obj.options:
new_options[opt] = deepcopy(grb_obj.options[opt])

View File

@ -13,7 +13,7 @@ CHANGELOG for FlatCAM beta
- added a new GUI element which is a evaluated LineEdit that accepts only float numbers and /,*,+,-,% chars
- finished the Etch Compensation Tool
- fixed unreliable work of Gerber Editor and optimized the App.editor2object() method
- updated the Gerber parser such that it will parse correctly Gerber files that have only one solid polygon inside with multiple clear polygons (like those generated by the Invert Tool)
23.05.2020

View File

@ -586,7 +586,8 @@ class Geometry(object):
return
def is_empty(self):
if isinstance(self.solid_geometry, BaseGeometry):
if isinstance(self.solid_geometry, BaseGeometry) or isinstance(self.solid_geometry, Polygon) or \
isinstance(self.solid_geometry, MultiPolygon):
return self.solid_geometry.is_empty
if isinstance(self.solid_geometry, list):