CADSTAR PCB: Fix regression when loading pads in footprints

Zero sized pads can be valid - e.g. a through hole pad

(cherry picked from commit fa5dc23797)
This commit is contained in:
Roberto Fernandez Bautista 2022-09-04 00:21:56 +02:00
parent e593e0b014
commit 2393165ada
1 changed files with 6 additions and 9 deletions

View File

@ -832,12 +832,6 @@ void CADSTAR_PCB_ARCHIVE_LOADER::loadLibraryCoppers( const SYMDEF_PCB& aComponen
shapePolys.Move( aFootprint->GetPosition() - anchorPos ); shapePolys.Move( aFootprint->GetPosition() - anchorPos );
pad->AddPrimitivePoly( shapePolys, 0, true ); pad->AddPrimitivePoly( shapePolys, 0, true );
aFootprint->Add( pad.release(), ADD_MODE::APPEND ); // Append so that we get the correct behaviour
// when finding pads by PAD_ID. See loadNets()
m_librarycopperpads[aComponent.ID][anchorPad.ID].push_back( aFootprint->Pads().size() );
totalCopperPads++;
// Now renumber all the associated pads // Now renumber all the associated pads
COMPONENT_PAD associatedPad; COMPONENT_PAD associatedPad;
@ -846,6 +840,12 @@ void CADSTAR_PCB_ARCHIVE_LOADER::loadLibraryCoppers( const SYMDEF_PCB& aComponen
PAD* assocPad = getPadReference( aFootprint, padID ); PAD* assocPad = getPadReference( aFootprint, padID );
assocPad->SetNumber( pad->GetNumber() ); assocPad->SetNumber( pad->GetNumber() );
} }
aFootprint->Add( pad.release(), ADD_MODE::APPEND ); // Append so that we get the correct behaviour
// when finding pads by PAD_ID. See loadNets()
m_librarycopperpads[aComponent.ID][anchorPad.ID].push_back( aFootprint->Pads().size() );
totalCopperPads++;
} }
else else
{ {
@ -921,9 +921,6 @@ PAD* CADSTAR_PCB_ARCHIVE_LOADER::getKiCadPad( const COMPONENT_PAD& aCadstarPad,
PADCODE csPadcode = getPadCode( aCadstarPad.PadCodeID ); PADCODE csPadcode = getPadCode( aCadstarPad.PadCodeID );
wxString errorMSG; wxString errorMSG;
if( csPadcode.Shape.Size <= 0)
return nullptr;
std::unique_ptr<PAD> pad = std::make_unique<PAD>( aParent ); std::unique_ptr<PAD> pad = std::make_unique<PAD>( aParent );
LSET padLayerSet; LSET padLayerSet;