Show messages and errors in TCL shell. Better exception handling and reporting when opening files.

This commit is contained in:
Juan Pablo Caram
2016-06-11 21:33:38 -04:00
parent ba05f832c0
commit f9cbd78cd1
2 changed files with 85 additions and 31 deletions

View File

@@ -158,6 +158,16 @@ class Geometry(object):
log.error("Failed to run union on polylines.")
raise
def is_empty(self):
if isinstance(self.solid_geometry, BaseGeometry):
return self.solid_geometry.is_empty
if isinstance(self.solid_geometry, list):
return len(self.solid_geometry) == 0
raise Exception("self.solid_geometry is neither BaseGeometry or list.")
def subtract_polygon(self, points):
"""
Subtract polygon from the given object. This only operates on the paths in the original geometry, i.e. it converts polygons into paths.
@@ -390,15 +400,6 @@ class Geometry(object):
"""
return self.solid_geometry.buffer(offset)
def is_empty(self):
if self.solid_geometry is None:
return True
if type(self.solid_geometry) is list and len(self.solid_geometry) == 0:
return True
return False
def import_svg(self, filename, flip=True):
"""
Imports shapes from an SVG file into the object's geometry.