diff --git a/src/gerbonara/apertures.py b/src/gerbonara/apertures.py index 747da37..0896873 100644 --- a/src/gerbonara/apertures.py +++ b/src/gerbonara/apertures.py @@ -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) diff --git a/src/gerbonara/rs274x.py b/src/gerbonara/rs274x.py index 144cba5..08eb8c2 100644 --- a/src/gerbonara/rs274x.py +++ b/src/gerbonara/rs274x.py @@ -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)