Handle Altium dimension angles and non-unit suffixes.

Fixes https://gitlab.com/kicad/code/kicad/-/issues/13751
This commit is contained in:
Jeff Young 2023-06-02 18:25:31 +01:00
parent 3c8d2bfca5
commit 97cf7c874e
1 changed files with 13 additions and 8 deletions

View File

@ -1247,7 +1247,7 @@ void ALTIUM_PCB::HelperParseDimensions6Linear( const ADIMENSION6& aElem )
int height = static_cast<int>( EuclideanNorm( direction ) );
if( direction.x <= 0 && direction.y <= 0 ) // TODO: I suspect this is not always correct
if( ( direction.x > 0 || direction.y < 0 ) != ( aElem.angle >= 180.0 ) )
height = -height;
dimension->SetHeight( height );
@ -1259,11 +1259,16 @@ void ALTIUM_PCB::HelperParseDimensions6Linear( const ADIMENSION6& aElem )
dimension->SetLineThickness( aElem.linewidth );
dimension->SetUnitsFormat( DIM_UNITS_FORMAT::NO_SUFFIX );
dimension->SetPrefix( aElem.textprefix );
// Suffix normally holds the units
dimension->SetUnitsFormat( aElem.textsuffix.IsEmpty() ? DIM_UNITS_FORMAT::NO_SUFFIX
: DIM_UNITS_FORMAT::BARE_SUFFIX );
// Suffix normally (but not always) holds the units
wxRegEx units( wxS( "(mm)|(in)|(mils)|(thou)|(')|(\")" ), wxRE_ADVANCED );
if( units.Matches( aElem.textsuffix ) )
dimension->SetUnitsFormat( DIM_UNITS_FORMAT::BARE_SUFFIX );
else
dimension->SetSuffix( aElem.textsuffix );
dimension->SetTextThickness( aElem.textlinewidth );
dimension->SetTextSize( VECTOR2I( aElem.textheight, aElem.textheight ) );