summaryrefslogtreecommitdiff
path: root/gerbonara/cam.py
diff options
context:
space:
mode:
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. """