Fix issues with importing NPTH pads from CircuitStudio.

Fixes https://gitlab.com/kicad/code/kicad/issues/10493

(cherry picked from commit 118a37f19f)
This commit is contained in:
Jeff Young 2022-03-22 18:06:43 +00:00
parent e3e52d055a
commit f8ff9705ff
1 changed files with 19 additions and 11 deletions

View File

@ -2144,9 +2144,11 @@ void ALTIUM_PCB::ParsePads6Data( const CFB::CompoundFileReader& aReader,
{ {
pad->SetDrillSize( wxSize( elem.sizeAndShape->slotsize, elem.holesize ) ); pad->SetDrillSize( wxSize( elem.sizeAndShape->slotsize, elem.holesize ) );
} }
else else if( normalizedSlotrotation == 90. || normalizedSlotrotation == 270. )
{ {
if( normalizedSlotrotation != 90. && normalizedSlotrotation != 270. ) pad->SetDrillSize( wxSize( elem.holesize, elem.sizeAndShape->slotsize ) );
}
else
{ {
wxLogWarning( _( "Footprint %s pad %s has a hole-rotation of %f " wxLogWarning( _( "Footprint %s pad %s has a hole-rotation of %f "
"degrees. KiCad only supports 90 degree rotations." ), "degrees. KiCad only supports 90 degree rotations." ),
@ -2155,8 +2157,6 @@ void ALTIUM_PCB::ParsePads6Data( const CFB::CompoundFileReader& aReader,
normalizedSlotrotation ); normalizedSlotrotation );
} }
pad->SetDrillSize( wxSize( elem.holesize, elem.sizeAndShape->slotsize ) );
}
} }
break; break;
@ -2220,6 +2220,14 @@ void ALTIUM_PCB::ParsePads6Data( const CFB::CompoundFileReader& aReader,
break; 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 ) switch( elem.layer )
{ {
case ALTIUM_LAYER::TOP_LAYER: case ALTIUM_LAYER::TOP_LAYER: