kicad: Fix footprint rotation

Previously, footprint rotation was mirrored compared with everything
else in the kicad API
This commit is contained in:
jaseg 2024-07-19 19:22:26 +02:00
parent 5f5bbccd05
commit eadd250ee3

View file

@ -876,20 +876,20 @@ class Footprint:
around the given coordinates in the global coordinate space. Otherwise rotate around the footprint's origin. """
if (cx, cy) != (None, None):
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.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 = (self.at.rotation - math.degrees(angle)) % 360
self.at.rotation = (self.at.rotation + math.degrees(angle)) % 360
for pad in self.pads:
pad.at.rotation = (pad.at.rotation - math.degrees(angle)) % 360
pad.at.rotation = (pad.at.rotation + math.degrees(angle)) % 360
for prop in self.properties:
if prop.at is not None:
prop.at.rotation = (prop.at.rotation - math.degrees(angle)) % 360
prop.at.rotation = (prop.at.rotation + math.degrees(angle)) % 360
for text in self.texts:
text.at.rotation = (text.at.rotation - math.degrees(angle)) % 360
text.at.rotation = (text.at.rotation + math.degrees(angle)) % 360
def set_rotation(self, angle):
old_deg = self.at.rotation