From f8ff9705ffce89d733d0abe8c4c1e2cf57d15a0d Mon Sep 17 00:00:00 2001 From: Jeff Young Date: Tue, 22 Mar 2022 18:06:43 +0000 Subject: [PATCH] Fix issues with importing NPTH pads from CircuitStudio. Fixes https://gitlab.com/kicad/code/kicad/issues/10493 (cherry picked from commit 118a37f19f641547dfb47cc93322914c97ca7c6f) --- pcbnew/plugins/altium/altium_pcb.cpp | 30 ++++++++++++++++++---------- 1 file changed, 19 insertions(+), 11 deletions(-) diff --git a/pcbnew/plugins/altium/altium_pcb.cpp b/pcbnew/plugins/altium/altium_pcb.cpp index ece6c03375..1b6e2a0c94 100644 --- a/pcbnew/plugins/altium/altium_pcb.cpp +++ b/pcbnew/plugins/altium/altium_pcb.cpp @@ -2144,19 +2144,19 @@ void ALTIUM_PCB::ParsePads6Data( const CFB::CompoundFileReader& aReader, { pad->SetDrillSize( wxSize( elem.sizeAndShape->slotsize, elem.holesize ) ); } - else + else if( normalizedSlotrotation == 90. || normalizedSlotrotation == 270. ) { - if( normalizedSlotrotation != 90. && normalizedSlotrotation != 270. ) - { - wxLogWarning( _( "Footprint %s pad %s has a hole-rotation of %f " - "degrees. KiCad only supports 90 degree rotations." ), - footprint->GetReference(), - elem.name, - normalizedSlotrotation ); - } - pad->SetDrillSize( wxSize( elem.holesize, elem.sizeAndShape->slotsize ) ); } + else + { + wxLogWarning( _( "Footprint %s pad %s has a hole-rotation of %f " + "degrees. KiCad only supports 90 degree rotations." ), + footprint->GetReference(), + elem.name, + normalizedSlotrotation ); + } + } break; @@ -2220,6 +2220,14 @@ void ALTIUM_PCB::ParsePads6Data( const CFB::CompoundFileReader& aReader, break; } + if( pad->GetAttribute() == PAD_ATTRIB::NPTH && pad->GetDrillSizeX() ) + { + // KiCad likes NPTH pads to be the same size & shape as their holes + pad->SetShape( pad->GetDrillShape() == PAD_DRILL_SHAPE_CIRCLE ? PAD_SHAPE::CIRCLE + : PAD_SHAPE::OVAL ); + pad->SetSize( pad->GetDrillSize() ); + } + switch( elem.layer ) { case ALTIUM_LAYER::TOP_LAYER: @@ -2629,7 +2637,7 @@ void ALTIUM_PCB::ParseWideStrings6Data( const CFB::CompoundFileReader& aReader, m_progressReporter->Report( _( "Loading unicode strings..." ) ); ALTIUM_PARSER reader( aReader, aEntry ); - + m_unicodeStrings = reader.ReadWideStringTable(); if( reader.GetRemainingBytes() != 0 )