Temporary fix/workaround for bug #83. Checking for empty list before running cascaded_union.

This commit is contained in:
jpcaram
2014-12-14 19:03:04 -05:00
parent 4eb69a9f07
commit c1b606feb4
2 changed files with 11 additions and 11 deletions

View File

@@ -1363,8 +1363,6 @@ class Gerber (Geometry):
else: else:
log.warning("Invalid arc in line %d." % line_num) log.warning("Invalid arc in line %d." % line_num)
### Operation code alone ### Operation code alone
# Operation code alone, usually just D03 (Flash) # Operation code alone, usually just D03 (Flash)
# self.opcode_re = re.compile(r'^D0?([123])\*$') # self.opcode_re = re.compile(r'^D0?([123])\*$')
@@ -1479,7 +1477,6 @@ class Gerber (Geometry):
print "RE:", self.lpol_re.pattern print "RE:", self.lpol_re.pattern
print "MATCH:", self.lpol_re.search(gline) print "MATCH:", self.lpol_re.search(gline)
match = self.lpol_re.search(gline) match = self.lpol_re.search(gline)
if match: if match:
if len(path) > 1 and current_polarity != match.group(1): if len(path) > 1 and current_polarity != match.group(1):
@@ -1493,6 +1490,9 @@ class Gerber (Geometry):
# --- Apply buffer --- # --- Apply buffer ---
print "current_polarity:", current_polarity print "current_polarity:", current_polarity
# If added for testing of bug #83
# TODO: Remove when bug fixed
if len(poly_buffer) > 0:
if current_polarity == 'D': if current_polarity == 'D':
print "Union with Cascaded Union of:", poly_buffer print "Union with Cascaded Union of:", poly_buffer
self.solid_geometry = self.solid_geometry.union(cascaded_union(poly_buffer)) self.solid_geometry = self.solid_geometry.union(cascaded_union(poly_buffer))

0
setup_ubuntu.sh Normal file → Executable file
View File