CADSTAR PCB Archive Importer: Fix loading of old CADSTAR designs and Do Not Keep Upright

Older CADSTAR versions used 1/10 degree whereas newer versions use 1/1000 degree.
Fixes https://gitlab.com/kicad/code/kicad/-/issues/6437
This commit is contained in:
Roberto Fernandez Bautista 2020-11-19 15:25:20 +00:00 committed by jean-pierre charras
parent f2ba9f7ac3
commit 78e3f917d9
2 changed files with 13 additions and 2 deletions

View File

@ -2416,6 +2416,7 @@ void CADSTAR_PCB_ARCHIVE_LOADER::addAttribute( const ATTRIBUTE_LOCATION& aCadsta
txtSize.x = getKiCadLength( tc.Width );
txtSize.y = KiROUND( TXT_HEIGHT_RATIO * (double) getKiCadLength( tc.Height ) );
txt->SetTextSize( txtSize );
txt->SetKeepUpright( false ); //Keeping it upright seems to result in incorrect orientation
switch( aCadstarAttrLoc.Alignment )
{

View File

@ -391,7 +391,17 @@ private:
*/
double getAngleTenthDegree( const long long& aCadstarAngle )
{
return (double) aCadstarAngle / 100.0;
// CADSTAR v6 (which outputted Format Version 8) and earlier versions used 1/10 degree
// as the unit for angles/orientations. It is assumed that CADSTAR version 7 (i.e. Format
// Version 9 and later) is the version that introduced 1/1000 degree for angles.
if( Header.Format.Version > 8 )
{
return (double) aCadstarAngle / 100.0;
}
else
{
return (double) aCadstarAngle;
}
}
/**
@ -401,7 +411,7 @@ private:
*/
double getAngleDegrees( const long long& aCadstarAngle )
{
return (double) aCadstarAngle / 1000.0;
return getAngleTenthDegree( aCadstarAngle ) / 10.0;
}
/**