specctra_export: fix an issue with custom and chamfered/round rect pads.
Is some cases a created pad stack name had the same name as an other pad stack having a slightly different shape, thus creating pads with a incorrect shape on board. Fixes #6495 https://gitlab.com/kicad/code/kicad/issues/6495
This commit is contained in:
parent
5607420339
commit
68625494f3
|
@ -32,8 +32,10 @@ public:
|
|||
|
||||
/** @return Build a hexadecimal string from the 16 bytes of MD5_HASH
|
||||
* Mainly for debug purposes.
|
||||
* @param aCompactForm = false to generate a string with spaces between each byte (2 chars)
|
||||
* = true to generate a string filled with 32 hexadecimal chars
|
||||
*/
|
||||
std::string Format();
|
||||
std::string Format( bool aCompactForm = false );
|
||||
|
||||
private:
|
||||
struct MD5_CTX {
|
||||
|
|
|
@ -90,7 +90,7 @@ bool MD5_HASH::operator!=( const MD5_HASH& aOther ) const
|
|||
}
|
||||
|
||||
|
||||
std::string MD5_HASH::Format()
|
||||
std::string MD5_HASH::Format( bool aCompactForm )
|
||||
{
|
||||
std::string data;
|
||||
|
||||
|
@ -109,7 +109,9 @@ std::string MD5_HASH::Format()
|
|||
|
||||
data += msb;
|
||||
data += lsb;
|
||||
data += ' ';
|
||||
|
||||
if( !aCompactForm )
|
||||
data += ' ';
|
||||
}
|
||||
|
||||
return data;
|
||||
|
|
|
@ -521,10 +521,12 @@ PADSTACK* SPECCTRA_DB::makePADSTACK( BOARD* aBoard, PAD* aPad )
|
|||
}
|
||||
|
||||
// this string _must_ be unique for a given physical shape
|
||||
snprintf( name, sizeof(name), "RoundRect%sPad_%.6gx%.6g_%.6g_um",
|
||||
snprintf( name, sizeof(name), "RoundRect%sPad_%.6gx%.6g_%.6g_um_%f_%X",
|
||||
uniqifier.c_str(),
|
||||
IU2um( aPad->GetSize().x ),
|
||||
IU2um( aPad->GetSize().y ), IU2um( rradius ) );
|
||||
IU2um( aPad->GetSize().y ), IU2um( rradius ),
|
||||
doChamfer ? aPad->GetChamferRectRatio() : 0.0,
|
||||
doChamfer ? aPad->GetChamferPositions() : 0 );
|
||||
|
||||
name[ sizeof(name) - 1 ] = 0;
|
||||
|
||||
|
@ -573,11 +575,12 @@ PADSTACK* SPECCTRA_DB::makePADSTACK( BOARD* aBoard, PAD* aPad )
|
|||
}
|
||||
|
||||
// this string _must_ be unique for a given physical shape, so try to make it unique
|
||||
MD5_HASH hash = pad_shape.GetHash();
|
||||
EDA_RECT rect = aPad->GetBoundingBox();
|
||||
snprintf( name, sizeof(name), "Cust%sPad_%.6gx%.6g_%.6gx_%.6g_%d_um",
|
||||
snprintf( name, sizeof(name), "Cust%sPad_%.6gx%.6g_%.6gx_%.6g_%d_um_%s",
|
||||
uniqifier.c_str(), IU2um( aPad->GetSize().x ), IU2um( aPad->GetSize().y ),
|
||||
IU2um( rect.GetWidth() ), IU2um( rect.GetHeight() ),
|
||||
(int)polygonal_shape.size() );
|
||||
(int)polygonal_shape.size(), hash.Format( true ).c_str() );
|
||||
name[ sizeof(name)-1 ] = 0;
|
||||
|
||||
padstack->SetPadstackId( name );
|
||||
|
|
Loading…
Reference in New Issue