From 783dd8f0d1f3a88e0471a2f31da18fbd0dd5facd Mon Sep 17 00:00:00 2001 From: Ryan Malloy Date: Mon, 28 Sep 2026 21:09:43 -0600 Subject: [PATCH] Test: a pad inside a via keepout reaches the plane past it --- tests/route/test_real_board_geometry.py | 26 +++++++++++++++++++++++++ 1 file changed, 26 insertions(+) diff --git a/tests/route/test_real_board_geometry.py b/tests/route/test_real_board_geometry.py index bd519b7..c193cc6 100644 --- a/tests/route/test_real_board_geometry.py +++ b/tests/route/test_real_board_geometry.py @@ -223,3 +223,29 @@ def test_a_through_hole_pad_inside_a_plane_needs_no_route(): groups = _connected_groups(gnd_pins, plane, frozenset(id(z) for z in plane)) hub = next(g for g in groups if g[1]) assert [p.component_ref for p in hub[0]] == ["GT"] + + +def test_a_pad_inside_a_via_keepout_reaches_the_plane_by_a_via_outside_it(): + # a sensor's GND pad: vias are forbidden under the body, so the route + # has to leave on the top layer and drop to the plane past the keepout + dsn = parse_dsn("""(pcb repro (parser) (resolution um 10) (unit um) + (structure + (layer F.Cu (type signal)) (layer In1.Cu (type power)) (layer In2.Cu (type power)) + (layer B.Cu (type signal)) + (boundary (path pcb 0 0 0 20000 0 20000 -20000 0 -20000 0 0)) + (plane GND (polygon In1.Cu 0 500 -500 19500 -500 19500 -19500 500 -19500 500 -500)) + (via_keepout "" (polygon signal 0 8500 -8500 11500 -8500 11500 -11500 8500 -11500 8500 -8500)) + (via "Via[0-3]_600:300_um") (rule (width 150) (clearance 150))) + (placement (component S (place G1 10000 -10000 front 0))) + (library + (image S (pin smd 1 0 0)) + (padstack smd (shape (rect F.Cu -175 -300 175 300)) (attach off)) + (padstack "Via[0-3]_600:300_um" (shape (circle F.Cu 600)) (shape (circle B.Cu 600)) (attach off))) + (network (net GND (pins G1-1))))""") + exact, scale, _names = route_dsn_board_exact(dsn, resolution=2) + assert exact.result.failed == [] + (via,) = exact.result.vias[1] + half = 300 * scale # the via's radius + outside = (via.x + half <= 8500 * scale or via.x - half >= 11500 * scale + or via.y - half >= -8500 * scale or via.y + half <= -11500 * scale) + assert outside, f"via at {via} is inside the via keepout"