From 446a9ca866489bf1af54488db075d8d8874dd281 Mon Sep 17 00:00:00 2001 From: jean-pierre charras Date: Thu, 24 Sep 2020 11:05:56 +0200 Subject: [PATCH] Round-rect pads: use a circle to draw degenerated shapes. A degenerated shape is a round-rect pads with same X and Y size, and a radius very near 50% of the size. Fixes #5768 https://gitlab.com/kicad/code/kicad/issues/5768 --- pcbnew/class_pad.cpp | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/pcbnew/class_pad.cpp b/pcbnew/class_pad.cpp index 5227cc31de..a8e76a1ad2 100644 --- a/pcbnew/class_pad.cpp +++ b/pcbnew/class_pad.cpp @@ -347,7 +347,19 @@ void D_PAD::BuildEffectiveShapes( PCB_LAYER_ID aLayer ) const wxSize trap_delta( 0, 0 ); if( effectiveShape == PAD_SHAPE_ROUNDRECT ) + { half_size -= wxPoint( r, r ); + + // Avoid degenerated shapes (0 length segments) that always create issues + // For roundrect pad very near a circle, use only a circle + const int min_len = Millimeter2iu( 0.0001); + + if( half_size.x < min_len && half_size.y < min_len ) + { + add( new SHAPE_CIRCLE( shapePos, r ) ); + break; + } + } else if( effectiveShape == PAD_SHAPE_TRAPEZOID ) trap_delta = m_deltaSize / 2;