mirror of
https://gitlab.com/kicad/code/kicad.git
synced 2025-09-14 10:13:19 +02:00
Generating footprint positions if one file at a time for jobs.
(The GUI can create separate files for front and back, or one file for both. A job always creates a single file, though it can have front, back, or both in it.)
This commit is contained in:
parent
232542f42b
commit
c30f8626d6
@ -95,6 +95,9 @@ void DIALOG_GEN_FOOTPRINT_POSITION::initDialog()
|
|||||||
// Output directory
|
// Output directory
|
||||||
m_outputDirectoryName->SetValue( projectFile.m_PcbLastPath[LAST_PATH_POS_FILES] );
|
m_outputDirectoryName->SetValue( projectFile.m_PcbLastPath[LAST_PATH_POS_FILES] );
|
||||||
|
|
||||||
|
m_sideLabel->Hide();
|
||||||
|
m_sideCtrl->Hide();
|
||||||
|
|
||||||
// Update Options
|
// Update Options
|
||||||
m_unitsCtrl->SetSelection( cfg->m_PlaceFile.units );
|
m_unitsCtrl->SetSelection( cfg->m_PlaceFile.units );
|
||||||
m_singleFile->SetValue( cfg->m_PlaceFile.file_options == 1 );
|
m_singleFile->SetValue( cfg->m_PlaceFile.file_options == 1 );
|
||||||
@ -117,8 +120,18 @@ void DIALOG_GEN_FOOTPRINT_POSITION::initDialog()
|
|||||||
m_units = m_job->m_units == JOB_EXPORT_PCB_POS::UNITS::INCHES ? EDA_UNITS::INCHES
|
m_units = m_job->m_units == JOB_EXPORT_PCB_POS::UNITS::INCHES ? EDA_UNITS::INCHES
|
||||||
: EDA_UNITS::MILLIMETRES;
|
: EDA_UNITS::MILLIMETRES;
|
||||||
|
|
||||||
|
m_staticTextDir->SetLabel( _( "Output file:" ) );
|
||||||
m_outputDirectoryName->SetValue( m_job->GetConfiguredOutputPath() );
|
m_outputDirectoryName->SetValue( m_job->GetConfiguredOutputPath() );
|
||||||
|
|
||||||
|
switch( m_job->m_side )
|
||||||
|
{
|
||||||
|
case JOB_EXPORT_PCB_POS::SIDE::FRONT: m_sideCtrl->SetSelection( 0 ); break;
|
||||||
|
case JOB_EXPORT_PCB_POS::SIDE::BACK: m_sideCtrl->SetSelection( 1 ); break;
|
||||||
|
default: m_sideCtrl->SetSelection( 2 ); break;
|
||||||
|
}
|
||||||
|
|
||||||
|
m_singleFile->Hide();
|
||||||
|
|
||||||
m_unitsCtrl->SetSelection( static_cast<int>( m_job->m_units ) );
|
m_unitsCtrl->SetSelection( static_cast<int>( m_job->m_units ) );
|
||||||
m_formatCtrl->SetSelection( static_cast<int>( m_job->m_format ) );
|
m_formatCtrl->SetSelection( static_cast<int>( m_job->m_format ) );
|
||||||
m_cbIncludeBoardEdge->SetValue( m_job->m_gerberBoardEdge );
|
m_cbIncludeBoardEdge->SetValue( m_job->m_gerberBoardEdge );
|
||||||
@ -149,6 +162,8 @@ void DIALOG_GEN_FOOTPRINT_POSITION::onUpdateUIUnits( wxUpdateUIEvent& event )
|
|||||||
void DIALOG_GEN_FOOTPRINT_POSITION::onUpdateUIFileOpt( wxUpdateUIEvent& event )
|
void DIALOG_GEN_FOOTPRINT_POSITION::onUpdateUIFileOpt( wxUpdateUIEvent& event )
|
||||||
{
|
{
|
||||||
m_singleFile->Enable( m_formatCtrl->GetSelection() != 2 );
|
m_singleFile->Enable( m_formatCtrl->GetSelection() != 2 );
|
||||||
|
m_sideLabel->Enable( m_formatCtrl->GetSelection() != 2 );
|
||||||
|
m_sideCtrl->Enable( m_formatCtrl->GetSelection() != 2 );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -295,6 +310,14 @@ void DIALOG_GEN_FOOTPRINT_POSITION::onGenerate( wxCommandEvent& event )
|
|||||||
m_job->m_units = m_unitsCtrl->GetSelection() == 0 ? JOB_EXPORT_PCB_POS::UNITS::INCHES
|
m_job->m_units = m_unitsCtrl->GetSelection() == 0 ? JOB_EXPORT_PCB_POS::UNITS::INCHES
|
||||||
: JOB_EXPORT_PCB_POS::UNITS::MILLIMETERS;
|
: JOB_EXPORT_PCB_POS::UNITS::MILLIMETERS;
|
||||||
m_job->m_format = static_cast<JOB_EXPORT_PCB_POS::FORMAT>( m_formatCtrl->GetSelection() );
|
m_job->m_format = static_cast<JOB_EXPORT_PCB_POS::FORMAT>( m_formatCtrl->GetSelection() );
|
||||||
|
|
||||||
|
switch( m_sideCtrl->GetSelection() )
|
||||||
|
{
|
||||||
|
case 0: m_job->m_side = JOB_EXPORT_PCB_POS::SIDE::FRONT; break;
|
||||||
|
case 1: m_job->m_side = JOB_EXPORT_PCB_POS::SIDE::BACK; break;
|
||||||
|
default: m_job->m_side = JOB_EXPORT_PCB_POS::SIDE::BOTH; break;
|
||||||
|
}
|
||||||
|
|
||||||
m_job->m_gerberBoardEdge = m_cbIncludeBoardEdge->GetValue();
|
m_job->m_gerberBoardEdge = m_cbIncludeBoardEdge->GetValue();
|
||||||
m_job->m_excludeFootprintsWithTh = m_excludeTH->GetValue();
|
m_job->m_excludeFootprintsWithTh = m_excludeTH->GetValue();
|
||||||
m_job->m_smdOnly = m_onlySMD->GetValue();
|
m_job->m_smdOnly = m_onlySMD->GetValue();
|
||||||
|
@ -62,6 +62,16 @@ DIALOG_GEN_FOOTPRINT_POSITION_BASE::DIALOG_GEN_FOOTPRINT_POSITION_BASE( wxWindow
|
|||||||
m_formatCtrl->SetSelection( 0 );
|
m_formatCtrl->SetSelection( 0 );
|
||||||
fgSizer1->Add( m_formatCtrl, 0, wxRIGHT|wxLEFT|wxEXPAND, 5 );
|
fgSizer1->Add( m_formatCtrl, 0, wxRIGHT|wxLEFT|wxEXPAND, 5 );
|
||||||
|
|
||||||
|
m_sideLabel = new wxStaticText( this, wxID_ANY, _("Side:"), wxDefaultPosition, wxDefaultSize, 0 );
|
||||||
|
m_sideLabel->Wrap( -1 );
|
||||||
|
fgSizer1->Add( m_sideLabel, 0, wxALIGN_CENTER_VERTICAL, 5 );
|
||||||
|
|
||||||
|
wxString m_sideCtrlChoices[] = { _("Front"), _("Back"), _("Both") };
|
||||||
|
int m_sideCtrlNChoices = sizeof( m_sideCtrlChoices ) / sizeof( wxString );
|
||||||
|
m_sideCtrl = new wxChoice( this, wxID_ANY, wxDefaultPosition, wxDefaultSize, m_sideCtrlNChoices, m_sideCtrlChoices, 0 );
|
||||||
|
m_sideCtrl->SetSelection( 0 );
|
||||||
|
fgSizer1->Add( m_sideCtrl, 0, wxEXPAND|wxRIGHT|wxLEFT, 5 );
|
||||||
|
|
||||||
m_unitsLabel = new wxStaticText( this, wxID_ANY, _("Units:"), wxDefaultPosition, wxDefaultSize, 0 );
|
m_unitsLabel = new wxStaticText( this, wxID_ANY, _("Units:"), wxDefaultPosition, wxDefaultSize, 0 );
|
||||||
m_unitsLabel->Wrap( -1 );
|
m_unitsLabel->Wrap( -1 );
|
||||||
fgSizer1->Add( m_unitsLabel, 0, wxRIGHT, 5 );
|
fgSizer1->Add( m_unitsLabel, 0, wxRIGHT, 5 );
|
||||||
|
@ -48,6 +48,8 @@ class DIALOG_GEN_FOOTPRINT_POSITION_BASE : public DIALOG_SHIM
|
|||||||
STD_BITMAP_BUTTON* m_browseButton;
|
STD_BITMAP_BUTTON* m_browseButton;
|
||||||
wxStaticText* m_formatLabel;
|
wxStaticText* m_formatLabel;
|
||||||
wxChoice* m_formatCtrl;
|
wxChoice* m_formatCtrl;
|
||||||
|
wxStaticText* m_sideLabel;
|
||||||
|
wxChoice* m_sideCtrl;
|
||||||
wxStaticText* m_unitsLabel;
|
wxStaticText* m_unitsLabel;
|
||||||
wxChoice* m_unitsCtrl;
|
wxChoice* m_unitsCtrl;
|
||||||
wxCheckBox* m_onlySMD;
|
wxCheckBox* m_onlySMD;
|
||||||
|
@ -1391,7 +1391,7 @@ int PCBNEW_JOBS_HANDLER::JobExportPos( JOB* aJob )
|
|||||||
if( file == nullptr )
|
if( file == nullptr )
|
||||||
return CLI::EXIT_CODES::ERR_INVALID_OUTPUT_CONFLICT;
|
return CLI::EXIT_CODES::ERR_INVALID_OUTPUT_CONFLICT;
|
||||||
|
|
||||||
std::string data;
|
std::string data;
|
||||||
|
|
||||||
bool frontSide = aPosJob->m_side == JOB_EXPORT_PCB_POS::SIDE::FRONT
|
bool frontSide = aPosJob->m_side == JOB_EXPORT_PCB_POS::SIDE::FRONT
|
||||||
|| aPosJob->m_side == JOB_EXPORT_PCB_POS::SIDE::BOTH;
|
|| aPosJob->m_side == JOB_EXPORT_PCB_POS::SIDE::BOTH;
|
||||||
@ -1412,21 +1412,30 @@ int PCBNEW_JOBS_HANDLER::JobExportPos( JOB* aJob )
|
|||||||
fputs( data.c_str(), file );
|
fputs( data.c_str(), file );
|
||||||
fclose( file );
|
fclose( file );
|
||||||
|
|
||||||
|
m_reporter->Report( wxString::Format( _( "Wrote position data to '%s'.\n" ), outPath ),
|
||||||
|
RPT_SEVERITY_ACTION );
|
||||||
|
|
||||||
aPosJob->AddOutput( outPath );
|
aPosJob->AddOutput( outPath );
|
||||||
}
|
}
|
||||||
else if( aPosJob->m_format == JOB_EXPORT_PCB_POS::FORMAT::GERBER )
|
else if( aPosJob->m_format == JOB_EXPORT_PCB_POS::FORMAT::GERBER )
|
||||||
{
|
{
|
||||||
PLACEFILE_GERBER_WRITER exporter( brd );
|
PLACEFILE_GERBER_WRITER exporter( brd );
|
||||||
|
PCB_LAYER_ID gbrLayer = F_Cu;
|
||||||
PCB_LAYER_ID gbrLayer = F_Cu;
|
|
||||||
|
|
||||||
if( aPosJob->m_side == JOB_EXPORT_PCB_POS::SIDE::BACK )
|
if( aPosJob->m_side == JOB_EXPORT_PCB_POS::SIDE::BACK )
|
||||||
gbrLayer = B_Cu;
|
gbrLayer = B_Cu;
|
||||||
|
|
||||||
if( exporter.CreatePlaceFile( outPath, gbrLayer, aPosJob->m_gerberBoardEdge ) >= 0 )
|
if( exporter.CreatePlaceFile( outPath, gbrLayer, aPosJob->m_gerberBoardEdge ) >= 0 )
|
||||||
|
{
|
||||||
|
m_reporter->Report( wxString::Format( _( "Wrote position data to '%s'.\n" ), outPath ),
|
||||||
|
RPT_SEVERITY_ACTION );
|
||||||
|
|
||||||
aPosJob->AddOutput( outPath );
|
aPosJob->AddOutput( outPath );
|
||||||
|
}
|
||||||
else
|
else
|
||||||
|
{
|
||||||
return CLI::EXIT_CODES::ERR_INVALID_OUTPUT_CONFLICT;
|
return CLI::EXIT_CODES::ERR_INVALID_OUTPUT_CONFLICT;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return CLI::EXIT_CODES::OK;
|
return CLI::EXIT_CODES::OK;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user