- working on a new tool to process automatically PcbWizard Excellon files which are generated in 2 files

This commit is contained in:
Marius Stanciu
2019-04-15 03:29:43 +03:00
parent 2e7d9f953f
commit db26895b5b
6 changed files with 437 additions and 7 deletions

View File

@@ -3837,7 +3837,7 @@ class Excellon(Geometry):
# Repeating command
self.repeat_re = re.compile(r'R(\d+)')
def parse_file(self, filename):
def parse_file(self, filename=None, file_obj=None):
"""
Reads the specified file as array of lines as
passes it to ``parse_lines()``.
@@ -3846,9 +3846,15 @@ class Excellon(Geometry):
:type filename: str
:return: None
"""
efile = open(filename, 'r')
estr = efile.readlines()
efile.close()
if file_obj:
estr = file_obj
else:
if filename is None:
return "fail"
efile = open(filename, 'r')
estr = efile.readlines()
efile.close()
try:
self.parse_lines(estr)
except: