Fix issues with importing NPTH pads from CircuitStudio.

Fixes https://gitlab.com/kicad/code/kicad/issues/10493
This commit is contained in:
Jeff Young 2022-03-22 18:06:43 +00:00
parent 535ecb9b7b
commit 118a37f19f
1 changed files with 20 additions and 13 deletions

View File

@ -2463,23 +2463,23 @@ void ALTIUM_PCB::ConvertPads6ToFootprintItemOnCopper( FOOTPRINT* aFootprint, con
slotRotation.Normalize(); slotRotation.Normalize();
if( slotRotation == ANGLE_0 || slotRotation == ANGLE_180 ) if( slotRotation.IsHorizontal() )
{ {
pad->SetDrillSize( wxSize( aElem.sizeAndShape->slotsize, aElem.holesize ) ); pad->SetDrillSize( wxSize( aElem.sizeAndShape->slotsize, aElem.holesize ) );
} }
else if( slotRotation.IsVertical() )
{
pad->SetDrillSize( wxSize( aElem.holesize, aElem.sizeAndShape->slotsize ) );
}
else else
{ {
if( slotRotation != ANGLE_90 && slotRotation != ANGLE_270 ) wxLogWarning( _( "Footprint %s pad %s has a hole-rotation of %f degrees. "
{ "KiCad only supports 90 degree rotations." ),
wxLogWarning( _( "Footprint %s pad %s has a hole-rotation of %f "
"degrees. KiCad only supports 90 degree rotations." ),
aFootprint->GetReference(), aFootprint->GetReference(),
aElem.name, aElem.name,
slotRotation.AsDegrees() ); slotRotation.AsDegrees() );
} }
pad->SetDrillSize( wxSize( aElem.holesize, aElem.sizeAndShape->slotsize ) );
}
break; break;
} }
@ -2497,10 +2497,8 @@ void ALTIUM_PCB::ConvertPads6ToFootprintItemOnCopper( FOOTPRINT* aFootprint, con
} }
if( aElem.sizeAndShape ) if( aElem.sizeAndShape )
{
pad->SetOffset( aElem.sizeAndShape->holeoffset[0] ); pad->SetOffset( aElem.sizeAndShape->holeoffset[0] );
} }
}
if( aElem.padmode != ALTIUM_PAD_MODE::SIMPLE ) if( aElem.padmode != ALTIUM_PAD_MODE::SIMPLE )
{ {
@ -2530,6 +2528,7 @@ void ALTIUM_PCB::ConvertPads6ToFootprintItemOnCopper( FOOTPRINT* aFootprint, con
{ {
pad->SetShape( PAD_SHAPE::OVAL ); pad->SetShape( PAD_SHAPE::OVAL );
} }
break; break;
case ALTIUM_PAD_SHAPE::OCTAGONAL: case ALTIUM_PAD_SHAPE::OCTAGONAL:
@ -2545,6 +2544,14 @@ void ALTIUM_PCB::ConvertPads6ToFootprintItemOnCopper( FOOTPRINT* aFootprint, con
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( aElem.layer ) switch( aElem.layer )
{ {
case ALTIUM_LAYER::TOP_LAYER: case ALTIUM_LAYER::TOP_LAYER: