From a374483998baff2fab4c43027c83f8bf97e5fdf5 Mon Sep 17 00:00:00 2001 From: jaseg Date: Sun, 19 Feb 2023 23:42:17 +0100 Subject: cli: First draft of most of the CLI --- gerbonara/cam.py | 15 +++++++++++++++ 1 file changed, 15 insertions(+) (limited to 'gerbonara/cam.py') 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. """ -- cgit