diff --git a/libs/kimath/include/md5_hash.h b/libs/kimath/include/md5_hash.h index 56fa39786a..3eea52a8ad 100644 --- a/libs/kimath/include/md5_hash.h +++ b/libs/kimath/include/md5_hash.h @@ -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 { diff --git a/libs/kimath/src/md5_hash.cpp b/libs/kimath/src/md5_hash.cpp index db2f7c9f35..c8c1071859 100644 --- a/libs/kimath/src/md5_hash.cpp +++ b/libs/kimath/src/md5_hash.cpp @@ -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; diff --git a/pcbnew/specctra_import_export/specctra_export.cpp b/pcbnew/specctra_import_export/specctra_export.cpp index 1815a4ac49..3faf11fe16 100644 --- a/pcbnew/specctra_import_export/specctra_export.cpp +++ b/pcbnew/specctra_import_export/specctra_export.cpp @@ -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 );