Gerbview, Excellon reader: use Leading Zeros format when not specified in file.

Some very poor files do not specify the coordinates format.
In this case, the default is INCH,LZ that looks like the more usual.
From master branch, commit b1fd462
This commit is contained in:
jean-pierre charras 2021-08-01 11:44:45 +02:00
parent 6aed98f795
commit 8dab9041e4
3 changed files with 21 additions and 8 deletions

View File

@ -155,11 +155,10 @@ public: EXCELLON_IMAGE( int layer ) :
~EXCELLON_IMAGE() {};
virtual void ResetDefaultValues() override
{
GERBER_FILE_IMAGE::ResetDefaultValues();
SelectUnits( false );
}
/**
* Set all parameters to a default value, before reading a file
*/
virtual void ResetDefaultValues() override;
/**

View File

@ -300,6 +300,19 @@ bool GERBVIEW_FRAME::Read_EXCELLON_File( const wxString& aFullFileName )
return success;
}
void EXCELLON_IMAGE::ResetDefaultValues()
{
GERBER_FILE_IMAGE::ResetDefaultValues();
SelectUnits( false ); // Default unit = inch
// Files using non decimal can use No Trailing zeros or No leading Zeros
// Unfortunately, the identifier (INCH,TZ or INCH,LZ for instance) is not
// always set in drill files.
// The option leading zeros looks like more frequent, so use this default
m_NoTrailingZeros = true;
}
/*
* Read a EXCELLON file.
* Gerber classes are used because there is likeness between Gerber files
@ -312,7 +325,6 @@ bool GERBVIEW_FRAME::Read_EXCELLON_File( const wxString& aFullFileName )
* integer 2.4 format in imperial units,
* integer 3.2 or 3.3 format (metric units).
*/
bool EXCELLON_IMAGE::LoadFile( const wxString & aFullFileName )
{
// Set the default parmeter values:
@ -480,8 +492,7 @@ bool EXCELLON_IMAGE::Execute_HEADER_And_M_Command( char*& text )
if( *text != ',' )
{
// No TZ or LZ specified. Should be a decimal format
// but this is not always the case. Use default TZ setting as default
m_NoTrailingZeros = false;
// but this is not always the case. Use our default setting
break;
}

View File

@ -267,6 +267,9 @@ public:
*/
int GetDcodesCount();
/**
* Set all parameters to a default value, before reading a file
*/
virtual void ResetDefaultValues();
COLOR4D GetPositiveDrawColor() const { return m_PositiveDrawColor; }