From 8de776616ce9d7b30ef84c29a9ee05f353690ff1 Mon Sep 17 00:00:00 2001 From: jaseg Date: Sun, 8 Mar 2026 15:03:11 +0100 Subject: [PATCH] Fix aperture macro thermal primitive Fixes gitlab issues #10 and #11 --- src/gerbonara/aperture_macros/primitive.py | 8 ++++---- tests/test_rs274x.py | 2 ++ 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/src/gerbonara/aperture_macros/primitive.py b/src/gerbonara/aperture_macros/primitive.py index 0c0d54c..da10cc9 100644 --- a/src/gerbonara/aperture_macros/primitive.py +++ b/src/gerbonara/aperture_macros/primitive.py @@ -280,7 +280,7 @@ class Moire(Primitive): @dataclass(frozen=True, slots=True) class Thermal(Primitive): code = 7 - exposure : Expression + # Note: Thermal primitives according to spec don't have an exposure variable # center x/y x : UnitExpression y : UnitExpression @@ -295,13 +295,13 @@ class Thermal(Primitive): x, y = rotate_point(calc.x, calc.y, -rotation, 0, 0) x, y = x+offset[0], y+offset[1] - dark = (bool(calc.exposure) == polarity_dark) + dark = True return [ gp.Circle(x, y, calc.d_outer/2, polarity_dark=dark), gp.Circle(x, y, calc.d_inner/2, polarity_dark=not dark), - gp.Rectangle(x, y, d_outer, gap_w, rotation=rotation, polarity_dark=not dark), - gp.Rectangle(x, y, gap_w, d_outer, rotation=rotation, polarity_dark=not dark), + gp.Rectangle(x, y, calc.d_outer, calc.gap_w, rotation=rotation, polarity_dark=not dark), + gp.Rectangle(x, y, calc.gap_w, calc.d_outer, rotation=rotation, polarity_dark=not dark), ] def dilate(self, offset, unit): diff --git a/tests/test_rs274x.py b/tests/test_rs274x.py index 2613f9a..08a0161 100644 --- a/tests/test_rs274x.py +++ b/tests/test_rs274x.py @@ -29,6 +29,8 @@ from gerbonara.cam import FileSettings from .image_support import * from .utils import * +# Note: We have a testcase for gitlab issues #10/#11 in therm_1.gbr, but we can't test for that at this time because +# gerbv chokes on that gerber file and does'nt produce any output. REFERENCE_FILES = [ l.strip() for l in ''' board_outline.GKO example_outline_with_arcs.gbr