summaryrefslogtreecommitdiff
path: root/gerbonara/excellon.py
diff options
context:
space:
mode:
authorjaseg <git-bigdata-wsl-arch@jaseg.de>2022-06-18 23:51:43 +0200
committerjaseg <git-bigdata-wsl-arch@jaseg.de>2022-06-18 23:51:43 +0200
commita88364b7a98b6f8d8edd4f1616908ba8889485dd (patch)
tree1275cbfcda36aed6ab6e95c69fed710bf389a0b3 /gerbonara/excellon.py
parentfa7a526883bdd35aca780b653af96169fd843aa8 (diff)
downloadgerbonara-a88364b7a98b6f8d8edd4f1616908ba8889485dd.tar.gz
gerbonara-a88364b7a98b6f8d8edd4f1616908ba8889485dd.tar.bz2
gerbonara-a88364b7a98b6f8d8edd4f1616908ba8889485dd.zip
Fix up saving and zip writing logic
Diffstat (limited to 'gerbonara/excellon.py')
-rwxr-xr-xgerbonara/excellon.py8
1 files changed, 4 insertions, 4 deletions
diff --git a/gerbonara/excellon.py b/gerbonara/excellon.py
index 54fcb51..ea5eba4 100755
--- a/gerbonara/excellon.py
+++ b/gerbonara/excellon.py
@@ -378,7 +378,7 @@ class ExcellonFile(CamFile):
yield 'M30'
- def generate_excellon(self, settings=None, drop_comments=True):
+ def write_to_bytes(self, settings=None, drop_comments=True):
""" Export to Excellon format. This function always generates XNC, which is a well-defined subset of Excellon.
Uses sane default settings if you don't give any.
@@ -397,13 +397,13 @@ class ExcellonFile(CamFile):
settings = FileSettings()
settings.zeros = None
settings.number_format = (3,5)
- return '\n'.join(self._generate_statements(settings, drop_comments=drop_comments))
+ return '\n'.join(self._generate_statements(settings, drop_comments=drop_comments)).encode('utf-8')
def save(self, filename, settings=None, drop_comments=True):
""" Save this Excellon file to the file system. See :py:meth:`~.ExcellonFile.generate_excellon` for the meaning
of the arguments. """
- with open(filename, 'w') as f:
- f.write(self.generate_excellon(settings, drop_comments=drop_comments))
+ with open(filename, 'wb') as f:
+ f.write(self.write_to_bytes(settings, drop_comments=drop_comments))
def offset(self, x=0, y=0, unit=MM):
for obj in self.objects: