summaryrefslogtreecommitdiff
path: root/gerbonara/cam.py
diff options
context:
space:
mode:
authorjaseg <git@jaseg.de>2023-02-19 23:42:17 +0100
committerjaseg <git@jaseg.de>2023-02-19 23:42:17 +0100
commita374483998baff2fab4c43027c83f8bf97e5fdf5 (patch)
tree090289b0aa8ea1fe7e425a9d39281cc24e44eae9 /gerbonara/cam.py
parentf64b03efc752b682b1cbe8cfb114f19e3362ef76 (diff)
downloadgerbonara-a374483998baff2fab4c43027c83f8bf97e5fdf5.tar.gz
gerbonara-a374483998baff2fab4c43027c83f8bf97e5fdf5.tar.bz2
gerbonara-a374483998baff2fab4c43027c83f8bf97e5fdf5.zip
cli: First draft of most of the CLI
Diffstat (limited to 'gerbonara/cam.py')
-rw-r--r--gerbonara/cam.py15
1 files changed, 15 insertions, 0 deletions
diff --git a/gerbonara/cam.py b/gerbonara/cam.py
index a289371..4944945 100644
--- a/gerbonara/cam.py
+++ b/gerbonara/cam.py
@@ -76,6 +76,11 @@ class FileSettings:
num = self.number_format[1 if self.zeros == 'leading' else 0] or 0
self._pad = '0'*num
+ @classmethod
+ def defaults(kls):
+ """ Return a set of good default FileSettings that will work for all gerber or excellon files. """
+ return FileSettings(unit=MM, number_format=(4,5), zeros=None)
+
def to_radian(self, value):
""" Convert a given numeric string or a given float from file units into radians. """
value = float(value)
@@ -386,6 +391,16 @@ class CamFile:
"""
raise NotImplementedError()
+ def scale(self, factor, unit=MM):
+ """ Scale all objects in this file by the given factor. Only uniform scaling using a single factor in both
+ directions is supported as for both Gerber and Excellon files, nonuniform scaling would distort circular
+ flashes, which would lead to garbage results.
+
+ :param float factor: Scale factor
+ :param unit: :py:class:`.LengthUnit` or str (``'mm'`` or ``'inch'``). Unit ``cx`` and ``cy`` are passed in. Default: mm
+ """
+ raise NotImplementedError()
+
@property
def is_empty(self):
""" Check if there are any objects in this file. """