Fixed Geometry merging. Solves issue #99.

This commit is contained in:
Juan Pablo Caram 2015-01-18 20:23:37 -05:00
parent 840cfcf9ff
commit 34a6b60053
4 changed files with 27 additions and 12 deletions

3
.gitignore vendored
View File

@ -1 +1,2 @@
*.pyc
*.pyc
.idea/

View File

@ -53,8 +53,8 @@ class App(QtCore.QObject):
## Logging ##
log = logging.getLogger('base')
#log.setLevel(logging.DEBUG)
log.setLevel(logging.WARNING)
log.setLevel(logging.DEBUG)
#log.setLevel(logging.WARNING)
formatter = logging.Formatter('[%(levelname)s][%(threadName)s] %(message)s')
handler = logging.StreamHandler()
handler.setFormatter(formatter)

View File

@ -875,16 +875,28 @@ class FlatCAMGeometry(FlatCAMObj, Geometry):
:param geo_final: Destination FlatCAMGeometry object.
:return: None
"""
geo_final.solid_geometry = []
if geo_final.solid_geometry is None:
geo_final.solid_geometry = []
if type(geo_final.solid_geometry) is not list:
geo_final.solid_geometry = [geo_final.solid_geometry]
for geo in geo_list:
try: # Iterable
for shape in geo.solid_geometry:
geo_final.solid_geometry.append(shape)
# Expand lists
if type(geo) is list:
FlatCAMGeometry.merge(geo, geo_final)
except TypeError: # Non-iterable
geo_final.solid_geometry.append(geo)
# If not list, just append
else:
geo_final.solid_geometry.append(geo.solid_geometry)
# try: # Iterable
# for shape in geo.solid_geometry:
# geo_final.solid_geometry.append(shape)
#
# except TypeError: # Non-iterable
# geo_final.solid_geometry.append(geo.solid_geometry)
def __init__(self, name):
FlatCAMObj.__init__(self, name)

View File

@ -42,8 +42,8 @@ import simplejson as json
import logging
log = logging.getLogger('base2')
#log.setLevel(logging.DEBUG)
log.setLevel(logging.WARNING)
log.setLevel(logging.DEBUG)
#log.setLevel(logging.WARNING)
#log.setLevel(logging.INFO)
formatter = logging.Formatter('[%(levelname)s] %(message)s')
handler = logging.StreamHandler()
@ -1908,7 +1908,7 @@ class Excellon(Geometry):
try:
for eline in elines:
line_num += 1
log.debug("%3d %s" % (line_num, str(eline)))
#log.debug("%3d %s" % (line_num, str(eline)))
### Cleanup lines
eline = eline.strip(' \r\n')
@ -1966,6 +1966,7 @@ class Excellon(Geometry):
continue
self.drills.append({'point': Point((x, y)), 'tool': current_tool})
log.debug("{:15} {:8} {:8}".format(eline, x, y))
continue
## Coordinates with period: Use literally. ##
@ -1988,6 +1989,7 @@ class Excellon(Geometry):
continue
self.drills.append({'point': Point((x, y)), 'tool': current_tool})
log.debug("{:15} {:8} {:8}".format(eline, x, y))
continue
#### Header ####