summaryrefslogtreecommitdiff
path: root/gerbonara/cad/kicad/footprints.py
diff options
context:
space:
mode:
Diffstat (limited to 'gerbonara/cad/kicad/footprints.py')
-rw-r--r--gerbonara/cad/kicad/footprints.py17
1 files changed, 15 insertions, 2 deletions
diff --git a/gerbonara/cad/kicad/footprints.py b/gerbonara/cad/kicad/footprints.py
index 9772b55..aedf9b8 100644
--- a/gerbonara/cad/kicad/footprints.py
+++ b/gerbonara/cad/kicad/footprints.py
@@ -389,6 +389,12 @@ class Pad:
_: SEXP_END = None
footprint: object = None
+ def __after_parse__(self, parent=None):
+ self.layers = unfuck_layers(self.layers)
+
+ def __before_sexp__(self):
+ self.layers = fuck_layers(self.layers)
+
def find_connected(self, **filters):
""" Find footprints connected to the same net as this pad """
return self.footprint.board.find_footprints(net=self.net.name, **filters)
@@ -677,12 +683,19 @@ class Footprint:
x, y = self.at.x-cx, self.at.y-cy
self.at.x = math.cos(angle)*x - math.sin(angle)*y + cx
self.at.y = math.sin(angle)*x + math.cos(angle)*y + cy
-
- self.at.rotation -= math.degrees(angle)
+ self.at.rotation -= math.degrees(angle)
for pad in self.pads:
pad.at.rotation -= math.degrees(angle)
+ def set_rotation(self, angle):
+ old_deg = self.at.rotation
+ new_deg = self.at.rotation = -math.degrees(angle)
+ delta = new_deg - old_deg
+
+ for pad in self.pads:
+ pad.at.rotation += delta
+
def objects(self, text=False, pads=True):
return chain(
(self.texts if text else []),