Add missing degree/radian conversion for polygon aperture rotation

This commit is contained in:
jaseg 2026-03-08 13:17:16 +01:00
parent 2647709215
commit 8a2599f5f4
2 changed files with 4 additions and 1 deletions

View file

@ -396,6 +396,8 @@ class PolygonAperture(Aperture):
rotation = self.rotation % (2*math.pi / self.n_vertices)
if math.isclose(rotation, 0, abs_tol=1e-6):
rotation = None
else:
rotation = math.degrees(rotation)
if self.hole_dia is not None:
return self.unit.convert_to(unit, self.diameter), self.n_vertices, rotation, self.unit.convert_to(unit, self.hole_dia)

View file

@ -880,7 +880,8 @@ class GerberParser:
# Polygon aperture rotation is specified in degrees, but radians are easier to work with
if match['shape'] == 'P':
modifiers[2] = math.radians(modifiers[2])
if len(modifiers) > 2:
modifiers[2] = math.radians(modifiers[2])
new_aperture = kls(*modifiers, unit=self.file_settings.unit, attrs=tuple(self.aperture_attrs.items()),
original_number=number)