summaryrefslogtreecommitdiff
path: root/gerbonara/apertures.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/apertures.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/apertures.py')
-rw-r--r--gerbonara/apertures.py21
1 files changed, 12 insertions, 9 deletions
diff --git a/gerbonara/apertures.py b/gerbonara/apertures.py
index a30cf13..4f41941 100644
--- a/gerbonara/apertures.py
+++ b/gerbonara/apertures.py
@@ -254,8 +254,8 @@ class CircleAperture(Aperture):
def scaled(self, scale):
return replace(self,
diameter=self.diameter*scale,
- hold_dia=None if self.hole_dia is None else self.hole_dia*scale,
- hold_rect_h=None if self.hole_rect_h is None else self.hole_rect_h*scale)
+ hole_dia=None if self.hole_dia is None else self.hole_dia*scale,
+ hole_rect_h=None if self.hole_rect_h is None else self.hole_rect_h*scale)
def to_macro(self):
return ApertureMacroInstance(GenericMacros.circle, self._params(unit=MM))
@@ -310,8 +310,8 @@ class RectangleAperture(Aperture):
return replace(self,
w=self.w*scale,
h=self.h*scale,
- hold_dia=None if self.hole_dia is None else self.hole_dia*scale,
- hold_rect_h=None if self.hole_rect_h is None else self.hole_rect_h*scale)
+ hole_dia=None if self.hole_dia is None else self.hole_dia*scale,
+ hole_rect_h=None if self.hole_rect_h is None else self.hole_rect_h*scale)
def to_macro(self):
return ApertureMacroInstance(GenericMacros.rect,
@@ -375,15 +375,18 @@ class ObroundAperture(Aperture):
return replace(self,
w=self.w*scale,
h=self.h*scale,
- hold_dia=None if self.hole_dia is None else self.hole_dia*scale,
- hold_rect_h=None if self.hole_rect_h is None else self.hole_rect_h*scale)
+ hole_dia=None if self.hole_dia is None else self.hole_dia*scale,
+ hole_rect_h=None if self.hole_rect_h is None else self.hole_rect_h*scale)
def to_macro(self):
# generic macro only supports w > h so flip x/y if h > w
- inst = self if self.w > self.h else replace(self, w=self.h, h=self.w, **_rotate_hole_90(self), rotation=self.rotation-90)
+ if self.w > self.h:
+ inst = self
+ else:
+ inst = replace(self, w=self.h, h=self.w, **self._rotate_hole_90(), rotation=self.rotation-90)
return ApertureMacroInstance(GenericMacros.obround,
[MM(inst.w, self.unit),
- MM(ints.h, self.unit),
+ MM(inst.h, self.unit),
MM(inst.hole_dia, self.unit),
MM(inst.hole_rect_h, self.unit),
inst.rotation])
@@ -434,7 +437,7 @@ class PolygonAperture(Aperture):
def scaled(self, scale):
return replace(self,
diameter=self.diameter*scale,
- hold_dia=None if self.hole_dia is None else self.hole_dia*scale)
+ hole_dia=None if self.hole_dia is None else self.hole_dia*scale)
def to_macro(self):
return ApertureMacroInstance(GenericMacros.polygon, self._params(MM))