From 164eff1a3b114eb4e6a61df245b70870ded5da99 Mon Sep 17 00:00:00 2001 From: Jeff Young Date: Sun, 2 Mar 2025 17:51:44 +0000 Subject: [PATCH] Handle circular holes with y==0. (Because legacy code assumed this.) --- pcbnew/pad.cpp | 24 +++++++++++++++++------- 1 file changed, 17 insertions(+), 7 deletions(-) diff --git a/pcbnew/pad.cpp b/pcbnew/pad.cpp index 439a17e0e9..de49d4af47 100644 --- a/pcbnew/pad.cpp +++ b/pcbnew/pad.cpp @@ -597,18 +597,28 @@ void PAD::BuildEffectiveShapes() const m_effectiveBoundingBox = BOX2I(); Padstack().ForEachUniqueLayer( - [&]( PCB_LAYER_ID aLayer ) - { - const SHAPE_COMPOUND& layerShape = buildEffectiveShape( aLayer ); - m_effectiveBoundingBox.Merge( layerShape.BBox() ); - } ); + [&]( PCB_LAYER_ID aLayer ) + { + const SHAPE_COMPOUND& layerShape = buildEffectiveShape( aLayer ); + m_effectiveBoundingBox.Merge( layerShape.BBox() ); + } ); // Hole shape m_effectiveHoleShape = nullptr; VECTOR2I half_size = m_padStack.Drill().size / 2; - int half_width = std::min( half_size.x, half_size.y ); - VECTOR2I half_len( half_size.x - half_width, half_size.y - half_width ); + int half_width; + VECTOR2I half_len; + + if( m_padStack.Drill().shape == PAD_DRILL_SHAPE::CIRCLE ) + { + half_width = half_size.x; + } + else + { + half_width = std::min( half_size.x, half_size.y ); + half_len = VECTOR2I( half_size.x - half_width, half_size.y - half_width ); + } RotatePoint( half_len, GetOrientation() );