Eagle import: improve rot field parsing.

This commit is contained in:
Alex Shvartzkop
2025-11-03 02:10:44 +03:00
parent 1770ce0557
commit 378b7ef2cb
+23 -5
View File
@@ -407,11 +407,29 @@ EROT Convert<EROT>( const wxString& aRot )
value.spin = aRot.find( 'S' ) != aRot.npos;
value.mirror = aRot.find( 'M' ) != aRot.npos;
value.degrees = strtod( aRot.c_str()
+ 1 // skip leading 'R'
+ int( value.spin ) // skip optional leading 'S'
+ int( value.mirror ), // skip optional leading 'M'
nullptr );
size_t rPos = aRot.find( 'R' );
if( rPos == wxString::npos )
{
value.degrees = 0.0;
return value;
}
// Calculate the offset after 'R', 'S', and 'M'
size_t offset;
for( offset = 0; offset < aRot.size(); offset++ )
{
if( wxIsdigit( aRot[offset] ) )
break;
}
wxString degreesStr = aRot.Mid( offset );
// Use locale-independent conversion
if( !degreesStr.ToCDouble( &value.degrees ) )
value.degrees = 0.0;
return value;
}