Support for De Morgan variants in symbol plotting CLI.

This commit is contained in:
Jeff Young 2023-05-09 13:09:12 +01:00
parent 4e420f3cf6
commit 8cd1f8d905
1 changed files with 71 additions and 59 deletions

View File

@ -475,8 +475,8 @@ int EESCHEMA_JOBS_HANDLER::doSymExportSvg( JOB_SYM_EXPORT_SVG* aSvgJob,
// iterate from unit 1, unit 0 would be "all units" which we don't want
for( int unit = 1; unit < symbol->GetUnitCount() + 1; unit++ )
{
int convert = 0;
for( int convert = 1; convert < ( symbol->HasConversion() ? 2 : 1 ) + 1; ++convert )
{
wxFileName fn;
fn.SetPath( aSvgJob->m_outputDirectory );
@ -485,14 +485,25 @@ int EESCHEMA_JOBS_HANDLER::doSymExportSvg( JOB_SYM_EXPORT_SVG* aSvgJob,
//simplify the name if its single unit
if( symbol->IsMulti() )
{
fn.SetName( wxString::Format( "%s_%d", symbol->GetName().Lower(), unit ) );
wxPrintf( _( "Plotting symbol '%s' unit %d to '%s'\n" ), symbol->GetName(), unit,
fn.SetName( wxString::Format( wxS( "%s_%d%s" ),
symbol->GetName().Lower(),
unit,
convert == 2 ? wxS( "_demorgan" ) : wxS( "" ) ) );
wxPrintf( _( "Plotting symbol '%s' unit %d %sto '%s'\n" ),
symbol->GetName(),
unit,
convert == 2 ? _( "(De Morgan) " ) : _( "" ),
fn.GetFullPath() );
}
else
{
fn.SetName( symbol->GetName().Lower() );
wxPrintf( _( "Plotting symbol '%s' to '%s'\n" ), symbol->GetName(), fn.GetFullPath() );
fn.SetName( wxString::Format( wxS( "%s%s" ),
symbol->GetName().Lower(),
convert == 2 ? wxS( "_demorgan" ) : wxS( "" ) ) );
wxPrintf( _( "Plotting symbol '%s' %sto '%s'\n" ),
symbol->GetName(),
convert == 2 ? _( "(De Morgan) " ) : _( "" ),
fn.GetFullPath() );
}
// Get the symbol bounding box to fit the plot page to it
@ -533,7 +544,7 @@ int EESCHEMA_JOBS_HANDLER::doSymExportSvg( JOB_SYM_EXPORT_SVG* aSvgJob,
plotPos.x = pageInfo.GetWidthIU( schIUScale.IU_PER_MILS ) / 2;
plotPos.y = pageInfo.GetHeightIU( schIUScale.IU_PER_MILS ) / 2;
// note, we want to use the fields from the original symbol pointer (in case of non-alias)
// note, we want the fields from the original symbol pointer (in case of non-alias)
symbolToPlot->Plot( plotter, unit, convert, background, plotPos, temp, false );
symbol->PlotLibFields( plotter, unit, convert, background, plotPos, temp, false,
aSvgJob->m_includeHiddenFields );
@ -545,6 +556,7 @@ int EESCHEMA_JOBS_HANDLER::doSymExportSvg( JOB_SYM_EXPORT_SVG* aSvgJob,
plotter->EndPlot();
delete plotter;
}
}
return CLI::EXIT_CODES::OK;
}