From 53770fec687e9686d5367c6a86db4c76465a0eb6 Mon Sep 17 00:00:00 2001 From: jean-pierre charras Date: Fri, 7 Jan 2022 16:38:27 +0100 Subject: [PATCH] Ensure thermal spoke widths are smaller than the pad size (fix a regression) This is needed to create good thermal reliefs, and ensure the DRC about thermal spoke count works. Fixes #10246 https://gitlab.com/kicad/code/kicad/issues/10246 --- pcbnew/zone_filler.cpp | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/pcbnew/zone_filler.cpp b/pcbnew/zone_filler.cpp index 916c62ddea..7c05bcefa5 100644 --- a/pcbnew/zone_filler.cpp +++ b/pcbnew/zone_filler.cpp @@ -1316,12 +1316,16 @@ void ZONE_FILLER::buildThermalSpokes( const ZONE* aZone, PCB_LAYER_ID aLayer, int spoke_w = constraint.GetValue().Opt(); // Spoke width should ideally be smaller than the pad minor axis. - spoke_w = std::min( spoke_w, pad->GetSize().x ); - spoke_w = std::min( spoke_w, pad->GetSize().y ); + // Otherwise the thermal shape is not really a thermal relief, + // and the algo to count the actual number of spokes can fail + int spoke_max_allowed_w = std::min( pad->GetSize().x, pad->GetSize().y ); spoke_w = std::max( spoke_w, constraint.Value().Min() ); spoke_w = std::min( spoke_w, constraint.Value().Max() ); + // ensure the spoke width is smaller than the pad minor size + spoke_w = std::min( spoke_w, spoke_max_allowed_w ); + // Cannot create stubs having a width < zone min thickness if( spoke_w < aZone->GetMinThickness() ) continue;