Excellon drill file exporter: minor enhancements.

This commit is contained in:
jean-pierre charras 2018-09-24 13:49:46 +02:00
parent 12ed6ab9e3
commit 6a02f788fd
1 changed files with 15 additions and 4 deletions

View File

@ -377,9 +377,15 @@ void EXCELLON_WRITER::writeCoordinates( char* aLine, double aCoordX, double aCoo
while( xs.Last() == '0' ) while( xs.Last() == '0' )
xs.RemoveLast(); xs.RemoveLast();
if( xs.Last() == '.' ) // however keep a trailing 0 after the floating point separator
xs << '0';
while( ys.Last() == '0' ) while( ys.Last() == '0' )
ys.RemoveLast(); ys.RemoveLast();
if( ys.Last() == '.' )
ys << '0';
sprintf( aLine, "X%sY%s\n", TO_UTF8( xs ), TO_UTF8( ys ) ); sprintf( aLine, "X%sY%s\n", TO_UTF8( xs ), TO_UTF8( ys ) );
break; break;
@ -457,6 +463,8 @@ void EXCELLON_WRITER::writeEXCELLONHeader()
msg = wxT( ";FORMAT={" ); msg = wxT( ";FORMAT={" );
// Print precision: // Print precision:
// Note in decimal format the precision is not used.
// the floating point notation has higher priority than the precision.
if( m_zeroFormat != DECIMAL_FORMAT ) if( m_zeroFormat != DECIMAL_FORMAT )
msg << m_precision.GetPrecisionString(); msg << m_precision.GetPrecisionString();
else else
@ -482,8 +490,7 @@ void EXCELLON_WRITER::writeEXCELLONHeader()
wxT( "keep zeros" ) wxT( "keep zeros" )
}; };
msg << zero_fmt[m_zeroFormat]; msg << zero_fmt[m_zeroFormat] << wxT( "}\n" );
msg << wxT( "}\n" );
fputs( TO_UTF8( msg ), m_file ); fputs( TO_UTF8( msg ), m_file );
fputs( "FMAT,2\n", m_file ); // Use Format 2 commands (version used since 1979) fputs( "FMAT,2\n", m_file ); // Use Format 2 commands (version used since 1979)
} }
@ -492,8 +499,11 @@ void EXCELLON_WRITER::writeEXCELLONHeader()
switch( m_zeroFormat ) switch( m_zeroFormat )
{ {
case SUPPRESS_LEADING:
case DECIMAL_FORMAT: case DECIMAL_FORMAT:
fputs( "\n", m_file );
break;
case SUPPRESS_LEADING:
fputs( ",TZ\n", m_file ); fputs( ",TZ\n", m_file );
break; break;
@ -502,7 +512,8 @@ void EXCELLON_WRITER::writeEXCELLONHeader()
break; break;
case KEEP_ZEROS: case KEEP_ZEROS:
fputs( ",TZ\n", m_file ); // TZ is acceptable when all zeros are kept // write nothing, but TZ is acceptable when all zeros are kept
fputs( "\n", m_file );
break; break;
} }
} }