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.
This commit is contained in:
jean-pierre charras 2021-08-01 11:44:45 +02:00
parent 70b5e26ff3
commit b1fd462d28
3 changed files with 21 additions and 8 deletions

View File

@ -142,11 +142,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

@ -293,6 +293,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
@ -305,7 +318,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 parameter values:
@ -473,8 +485,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

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