From 08fb05e522adc8651114225d68e58bb0547fc110 Mon Sep 17 00:00:00 2001 From: Jeff Young Date: Sun, 27 Jun 2021 17:39:09 +0100 Subject: [PATCH] Make sure HPGL and DXF drill map generators honour origin setting. ADDED: also adds origin setting to Footprint Position File dialog and generators. Fixes https://gitlab.com/kicad/code/kicad/issues/8669 --- ...ialog_gen_footprint_position_file_base.cpp | 3 + ...ialog_gen_footprint_position_file_base.fbp | 64 +++++++++++++++++++ .../dialog_gen_footprint_position_file_base.h | 1 + pcbnew/dialogs/dialog_gendrill.cpp | 22 ++++--- pcbnew/dialogs/dialog_gendrill.h | 2 +- pcbnew/dialogs/dialog_plot.cpp | 9 ++- .../exporters/export_footprints_placefile.cpp | 10 ++- .../exporters/export_footprints_placefile.h | 4 +- pcbnew/exporters/gen_drill_report_files.cpp | 40 ++++++------ pcbnew/exporters/gen_footprints_placefile.cpp | 57 +++++++++-------- pcbnew/exporters/gendrill_Excellon_writer.cpp | 14 ++-- pcbnew/exporters/gendrill_file_writer_base.h | 2 +- pcbnew/pcb_edit_frame.h | 2 +- pcbnew/pcbnew_settings.cpp | 3 + pcbnew/pcbnew_settings.h | 1 + 15 files changed, 159 insertions(+), 75 deletions(-) diff --git a/pcbnew/dialogs/dialog_gen_footprint_position_file_base.cpp b/pcbnew/dialogs/dialog_gen_footprint_position_file_base.cpp index 50fecbf962..8db888adda 100644 --- a/pcbnew/dialogs/dialog_gen_footprint_position_file_base.cpp +++ b/pcbnew/dialogs/dialog_gen_footprint_position_file_base.cpp @@ -77,6 +77,9 @@ DIALOG_GEN_FOOTPRINT_POSITION_BASE::DIALOG_GEN_FOOTPRINT_POSITION_BASE( wxWindow m_cbIncludeBoardEdge = new wxCheckBox( this, wxID_ANY, _("Include board edge layer"), wxDefaultPosition, wxDefaultSize, 0 ); bSizerLower->Add( m_cbIncludeBoardEdge, 0, wxBOTTOM|wxRIGHT|wxLEFT, 5 ); + m_useDrillPlaceOrigin = new wxCheckBox( this, wxID_ANY, _("Use drill/place file origin"), wxDefaultPosition, wxDefaultSize, 0 ); + bSizerLower->Add( m_useDrillPlaceOrigin, 0, wxBOTTOM|wxRIGHT|wxLEFT, 5 ); + m_messagesPanel = new WX_HTML_REPORT_PANEL( this, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxTAB_TRAVERSAL ); m_messagesPanel->SetMinSize( wxSize( 350,300 ) ); diff --git a/pcbnew/dialogs/dialog_gen_footprint_position_file_base.fbp b/pcbnew/dialogs/dialog_gen_footprint_position_file_base.fbp index 29bfd42fcc..f2c1db101a 100644 --- a/pcbnew/dialogs/dialog_gen_footprint_position_file_base.fbp +++ b/pcbnew/dialogs/dialog_gen_footprint_position_file_base.fbp @@ -629,6 +629,70 @@ onUpdateUIincludeBoardEdge + + 5 + wxBOTTOM|wxRIGHT|wxLEFT + 0 + + 1 + 1 + 1 + 1 + + + + + + + + 1 + 0 + 0 + 1 + + 1 + 0 + Dock + 0 + Left + 1 + + 1 + + 0 + 0 + wxID_ANY + Use drill/place file origin + + 0 + + + 0 + + 1 + m_useDrillPlaceOrigin + 1 + + + protected + 1 + + Resizable + 1 + + + ; ; forward_declare + 0 + + + wxFILTER_NONE + wxDefaultValidator + + + + + + 5 wxEXPAND | wxALL diff --git a/pcbnew/dialogs/dialog_gen_footprint_position_file_base.h b/pcbnew/dialogs/dialog_gen_footprint_position_file_base.h index b2ce634868..8e133caba3 100644 --- a/pcbnew/dialogs/dialog_gen_footprint_position_file_base.h +++ b/pcbnew/dialogs/dialog_gen_footprint_position_file_base.h @@ -51,6 +51,7 @@ class DIALOG_GEN_FOOTPRINT_POSITION_BASE : public DIALOG_SHIM wxRadioBox* m_radioBoxFilesCount; wxCheckBox* m_excludeTH; wxCheckBox* m_cbIncludeBoardEdge; + wxCheckBox* m_useDrillPlaceOrigin; WX_HTML_REPORT_PANEL* m_messagesPanel; wxStaticLine* m_staticline; wxStdDialogButtonSizer* m_sdbSizer; diff --git a/pcbnew/dialogs/dialog_gendrill.cpp b/pcbnew/dialogs/dialog_gendrill.cpp index e7c9c869b1..581b955eb4 100644 --- a/pcbnew/dialogs/dialog_gendrill.cpp +++ b/pcbnew/dialogs/dialog_gendrill.cpp @@ -340,9 +340,9 @@ void DIALOG_GENDRILL::UpdateDrillParams() m_UseRouteModeForOvalHoles = m_radioBoxOvalHoleMode->GetSelection() == 0; if( m_Choice_Drill_Offset->GetSelection() == 0 ) - m_FileDrillOffset = wxPoint( 0, 0 ); + m_DrillFileOffset = wxPoint( 0, 0 ); else - m_FileDrillOffset = m_board->GetDesignSettings().m_AuxOrigin; + m_DrillFileOffset = m_board->GetDesignSettings().m_AuxOrigin; if( m_UnitDrillIsInch ) m_Precision = precisionListForInches; @@ -366,8 +366,12 @@ void DIALOG_GENDRILL::GenDrillAndMapFiles( bool aGenDrill, bool aGenMap ) const PLOT_FORMAT filefmt[6] = { // Keep these format ids in the same order than m_Choice_Drill_Map choices - PLOT_FORMAT::HPGL, PLOT_FORMAT::POST, PLOT_FORMAT::GERBER, PLOT_FORMAT::DXF, - PLOT_FORMAT::SVG, PLOT_FORMAT::PDF + PLOT_FORMAT::HPGL, + PLOT_FORMAT::POST, + PLOT_FORMAT::GERBER, + PLOT_FORMAT::DXF, + PLOT_FORMAT::SVG, + PLOT_FORMAT::PDF }; unsigned choice = (unsigned) m_Choice_Drill_Map->GetSelection(); @@ -385,7 +389,7 @@ void DIALOG_GENDRILL::GenDrillAndMapFiles( bool aGenDrill, bool aGenMap ) { wxString msg; msg.Printf( _( "Could not write drill and/or map files to folder '%s'." ), - outputDir.GetPath() ); + outputDir.GetPath() ); DisplayError( this, msg ); return; } @@ -395,7 +399,7 @@ void DIALOG_GENDRILL::GenDrillAndMapFiles( bool aGenDrill, bool aGenMap ) EXCELLON_WRITER excellonWriter( m_board ); excellonWriter.SetFormat( !m_UnitDrillIsInch, (EXCELLON_WRITER::ZEROS_FMT) m_ZerosFormat, m_Precision.m_Lhs, m_Precision.m_Rhs ); - excellonWriter.SetOptions( m_Mirror, m_MinimalHeader, m_FileDrillOffset, m_Merge_PTH_NPTH ); + excellonWriter.SetOptions( m_Mirror, m_MinimalHeader, m_DrillFileOffset, m_Merge_PTH_NPTH ); excellonWriter.SetRouteModeForOvalHoles( m_UseRouteModeForOvalHoles ); excellonWriter.SetMapFileFormat( filefmt[choice] ); @@ -409,11 +413,11 @@ void DIALOG_GENDRILL::GenDrillAndMapFiles( bool aGenDrill, bool aGenMap ) // (SetFormat() accept 5 or 6, and any other value set the precision to 5) // the integer part precision is always 4, and units always mm gerberWriter.SetFormat( m_plotOpts.GetGerberPrecision() ); - gerberWriter.SetOptions( m_FileDrillOffset ); + gerberWriter.SetOptions( m_DrillFileOffset ); gerberWriter.SetMapFileFormat( filefmt[choice] ); - gerberWriter.CreateDrillandMapFilesSet( outputDir.GetFullPath(), - aGenDrill, aGenMap, &reporter ); + gerberWriter.CreateDrillandMapFilesSet( outputDir.GetFullPath(), aGenDrill, aGenMap, + &reporter ); } } diff --git a/pcbnew/dialogs/dialog_gendrill.h b/pcbnew/dialogs/dialog_gendrill.h index 19049a6f11..ce9cb6947a 100644 --- a/pcbnew/dialogs/dialog_gendrill.h +++ b/pcbnew/dialogs/dialog_gendrill.h @@ -99,7 +99,7 @@ public: static bool m_Mirror; static bool m_Merge_PTH_NPTH; DRILL_PRECISION m_Precision; // Precision for drill files, in non decimal format - wxPoint m_FileDrillOffset; // Drill offset: 0,0 for absolute coordinates, + wxPoint m_DrillFileOffset; // Drill offset: 0,0 for absolute coordinates, // or origin of the auxiliary axis static bool m_UseRouteModeForOvalHoles; // True to use a G00 route command for oval holes // False to use a G85 canned mode for oval holes diff --git a/pcbnew/dialogs/dialog_plot.cpp b/pcbnew/dialogs/dialog_plot.cpp index 6d5588485f..96ec522b61 100644 --- a/pcbnew/dialogs/dialog_plot.cpp +++ b/pcbnew/dialogs/dialog_plot.cpp @@ -411,8 +411,13 @@ void DIALOG_PLOT::OnOutputDirectoryBrowseClicked( wxCommandEvent& event ) PLOT_FORMAT DIALOG_PLOT::getPlotFormat() { // plot format id's are ordered like displayed in m_plotFormatOpt - static const PLOT_FORMAT plotFmt[] = { PLOT_FORMAT::GERBER, PLOT_FORMAT::POST, PLOT_FORMAT::SVG, - PLOT_FORMAT::DXF, PLOT_FORMAT::HPGL, PLOT_FORMAT::PDF }; + static const PLOT_FORMAT plotFmt[] = { + PLOT_FORMAT::GERBER, + PLOT_FORMAT::POST, + PLOT_FORMAT::SVG, + PLOT_FORMAT::DXF, + PLOT_FORMAT::HPGL, + PLOT_FORMAT::PDF }; return plotFmt[m_plotFormatOpt->GetSelection()]; } diff --git a/pcbnew/exporters/export_footprints_placefile.cpp b/pcbnew/exporters/export_footprints_placefile.cpp index 95c9a1676c..c1cd42f140 100644 --- a/pcbnew/exporters/export_footprints_placefile.cpp +++ b/pcbnew/exporters/export_footprints_placefile.cpp @@ -74,7 +74,8 @@ enum SELECT_SIDE }; PLACE_FILE_EXPORTER::PLACE_FILE_EXPORTER( BOARD* aBoard, bool aUnitsMM, bool aExcludeAllTH, - bool aTopSide, bool aBottomSide, bool aFormatCSV ) + bool aTopSide, bool aBottomSide, bool aFormatCSV, + bool aUseAuxOrigin ) { m_board = aBoard; m_unitsMM = aUnitsMM; @@ -91,6 +92,11 @@ PLACE_FILE_EXPORTER::PLACE_FILE_EXPORTER( BOARD* aBoard, bool aUnitsMM, bool aEx m_side = PCB_NO_SIDE; m_formatCSV = aFormatCSV; + + if( aUseAuxOrigin ) + m_place_Offset = m_board->GetDesignSettings().m_AuxOrigin; + else + m_place_Offset = wxPoint( 0, 0 ); } @@ -105,8 +111,6 @@ std::string PLACE_FILE_EXPORTER::GenPositionData() int lenValText = 8; int lenPkgText = 16; - m_place_Offset = m_board->GetDesignSettings().m_AuxOrigin; - // Calculating the number of useful footprints (CMS attribute, not VIRTUAL) m_fpCount = 0; diff --git a/pcbnew/exporters/export_footprints_placefile.h b/pcbnew/exporters/export_footprints_placefile.h index 72d7d46320..e55a2b8800 100644 --- a/pcbnew/exporters/export_footprints_placefile.h +++ b/pcbnew/exporters/export_footprints_placefile.h @@ -61,8 +61,8 @@ public: * @param aBottomSide true to generate bottom side info * @param aFormatCSV true to generate a csv format info, false to generate a ascii info */ - PLACE_FILE_EXPORTER( BOARD* aBoard, bool aUnitsMM, - bool aForceSmdItems, bool aTopSide, bool aBottomSide, bool aFormatCSV ); + PLACE_FILE_EXPORTER( BOARD* aBoard, bool aUnitsMM, bool aForceSmdItems, bool aTopSide, + bool aBottomSide, bool aFormatCSV, bool useAuxOrigin ); /** * build a string filled with the position data diff --git a/pcbnew/exporters/gen_drill_report_files.cpp b/pcbnew/exporters/gen_drill_report_files.cpp index 832ce8a0e2..0249413f7a 100644 --- a/pcbnew/exporters/gen_drill_report_files.cpp +++ b/pcbnew/exporters/gen_drill_report_files.cpp @@ -71,10 +71,10 @@ bool GENDRILL_WRITER_BASE::genDrillMapFile( const wxString& aFullFileName, PLOT_ // for the right holes set (PTH, NPTH, buried/blind vias ...) double scale = 1.0; - wxPoint offset; + wxPoint offset = GetOffset(); PLOTTER* plotter = NULL; PAGE_INFO dummy( PAGE_INFO::A4, false ); - int bottom_limit = 0; // Y coord limit of page. 0 mean do not use + int bottom_limit = 0; // Y coord limit of page. 0 mean do not use PCB_PLOT_PARAMS plot_opts; // starts plotting with default options @@ -94,7 +94,6 @@ bool GENDRILL_WRITER_BASE::genDrillMapFile( const wxString& aFullFileName, PLOT_ switch( aFormat ) { case PLOT_FORMAT::GERBER: - offset = GetOffset(); plotter = new GERBER_PLOTTER(); plotter->SetViewport( offset, IU_PER_MILS / 10, scale, false ); plotter->SetGerberCoordinatesFormat( 5 ); // format x.5 unit = mm @@ -251,8 +250,8 @@ bool GENDRILL_WRITER_BASE::genDrillMapFile( const wxString& aFullFileName, PLOT_ // Plot title "Info" wxString Text = wxT( "Drill Map:" ); plotter->Text( wxPoint( plotX, plotY ), COLOR4D::UNSPECIFIED, Text, 0, - wxSize( KiROUND( charSize * charScale ), KiROUND( charSize * charScale ) ), - GR_TEXT_HJUSTIFY_LEFT, GR_TEXT_VJUSTIFY_CENTER, TextWidth, false, false ); + wxSize( KiROUND( charSize * charScale ), KiROUND( charSize * charScale ) ), + GR_TEXT_HJUSTIFY_LEFT, GR_TEXT_VJUSTIFY_CENTER, TextWidth, false, false ); // For some formats (PS, PDF SVG) we plot the drill size list on more than one column // because the list must be contained inside the printed page @@ -288,7 +287,7 @@ bool GENDRILL_WRITER_BASE::genDrillMapFile( const wxString& aFullFileName, PLOT_ // List the diameter of each drill in mm and inches. sprintf( line, "%3.3fmm / %2.4f\" ", diameter_in_mm( tool.m_Diameter ), - diameter_in_inches( tool.m_Diameter ) ); + diameter_in_inches( tool.m_Diameter ) ); msg = FROM_UTF8( line ); @@ -311,8 +310,8 @@ bool GENDRILL_WRITER_BASE::genDrillMapFile( const wxString& aFullFileName, PLOT_ msg += wxT( " (not plated)" ); plotter->Text( wxPoint( plotX, y ), COLOR4D::UNSPECIFIED, msg, 0, - wxSize( KiROUND( charSize * charScale ), KiROUND( charSize * charScale ) ), - GR_TEXT_HJUSTIFY_LEFT, GR_TEXT_VJUSTIFY_CENTER, TextWidth, false, false ); + wxSize( KiROUND( charSize * charScale ), KiROUND( charSize * charScale ) ), + GR_TEXT_HJUSTIFY_LEFT, GR_TEXT_VJUSTIFY_CENTER, TextWidth, false, false ); intervalle = KiROUND( ( ( charSize * charScale ) + TextWidth ) * 1.2 ); @@ -360,10 +359,9 @@ bool GENDRILL_WRITER_BASE::GenDrillReportFile( const wxString& aFullFileName ) for( LSEQ seq = cu.Seq(); seq; ++seq, ++conventional_layer_num ) { out.Print( 0, " L%-2d: %-25s %s\n", - conventional_layer_num, - TO_UTF8( m_pcb->GetLayerName( *seq ) ), - layerName( *seq ).c_str() // generic layer name - ); + conventional_layer_num, + TO_UTF8( m_pcb->GetLayerName( *seq ) ), + layerName( *seq ).c_str() ); // generic layer name } out.Print( 0, "\n\n" ); @@ -386,7 +384,7 @@ bool GENDRILL_WRITER_BASE::GenDrillReportFile( const wxString& aFullFileName ) if( pair == DRILL_LAYER_PAIR( F_Cu, B_Cu ) ) { out.Print( 0, "Drill file '%s' contains\n", - TO_UTF8( getDrillFileName( pair, false, m_merge_PTH_NPTH ) ) ); + TO_UTF8( getDrillFileName( pair, false, m_merge_PTH_NPTH ) ) ); out.Print( 0, " plated through holes:\n" ); out.Print( 0, separator ); @@ -396,13 +394,12 @@ bool GENDRILL_WRITER_BASE::GenDrillReportFile( const wxString& aFullFileName ) else // blind/buried { out.Print( 0, "Drill file '%s' contains\n", - TO_UTF8( getDrillFileName( pair, false, m_merge_PTH_NPTH ) ) ); + TO_UTF8( getDrillFileName( pair, false, m_merge_PTH_NPTH ) ) ); out.Print( 0, " holes connecting layer pair: '%s and %s' (%s vias):\n", - TO_UTF8( m_pcb->GetLayerName( ToLAYER_ID( pair.first ) ) ), - TO_UTF8( m_pcb->GetLayerName( ToLAYER_ID( pair.second ) ) ), - pair.first == F_Cu || pair.second == B_Cu ? "blind" : "buried" - ); + TO_UTF8( m_pcb->GetLayerName( ToLAYER_ID( pair.first ) ) ), + TO_UTF8( m_pcb->GetLayerName( ToLAYER_ID( pair.second ) ) ), + pair.first == F_Cu || pair.second == B_Cu ? "blind" : "buried" ); out.Print( 0, separator ); totalHoleCount = printToolSummary( out, false ); @@ -483,8 +480,8 @@ unsigned GENDRILL_WRITER_BASE::printToolSummary( OUTPUTFORMATTER& out, bool aSum // in mm then in inches. int tool_number = ii+1; out.Print( 0, " T%d %2.3fmm %2.4f\" ", tool_number, - diameter_in_mm( tool.m_Diameter ), - diameter_in_inches( tool.m_Diameter ) ); + diameter_in_mm( tool.m_Diameter ), + diameter_in_inches( tool.m_Diameter ) ); // Now list how many holes and ovals are associated with each drill. if( ( tool.m_TotalCount == 1 ) && ( tool.m_OvalCount == 0 ) ) @@ -496,8 +493,7 @@ unsigned GENDRILL_WRITER_BASE::printToolSummary( OUTPUTFORMATTER& out, bool aSum else if( tool.m_OvalCount == 1 ) out.Print( 0, "(%d holes) (with 1 slot)\n", tool.m_TotalCount ); else // tool.m_OvalCount > 1 - out.Print( 0, "(%d holes) (with %d slots)\n", - tool.m_TotalCount, tool.m_OvalCount ); + out.Print( 0, "(%d holes) (with %d slots)\n", tool.m_TotalCount, tool.m_OvalCount ); totalHoleCount += tool.m_TotalCount; } diff --git a/pcbnew/exporters/gen_footprints_placefile.cpp b/pcbnew/exporters/gen_footprints_placefile.cpp index 7dc945996c..a9309b2a35 100644 --- a/pcbnew/exporters/gen_footprints_placefile.cpp +++ b/pcbnew/exporters/gen_footprints_placefile.cpp @@ -153,7 +153,7 @@ void DIALOG_GEN_FOOTPRINT_POSITION::initDialog() { m_browseButton->SetBitmap( KiBitmap( BITMAPS::small_folder ) ); - auto cfg = m_parent->GetPcbNewSettings(); + PCBNEW_SETTINGS* cfg = m_parent->GetPcbNewSettings(); m_units = cfg->m_PlaceFile.units == 0 ? EDA_UNITS::INCHES : EDA_UNITS::MILLIMETRES; m_fileOpt = cfg->m_PlaceFile.file_options; @@ -168,7 +168,7 @@ void DIALOG_GEN_FOOTPRINT_POSITION::initDialog() m_radioBoxFilesCount->SetSelection( m_fileOpt ); m_rbFormat->SetSelection( m_fileFormat ); m_cbIncludeBoardEdge->SetValue( m_includeBoardEdge ); - + m_useDrillPlaceOrigin->SetValue( cfg->m_PlaceFile.use_aux_origin ); // Update sizes and sizers: m_messagesPanel->MsgPanelSetMinSize( wxSize( -1, 160 ) ); @@ -217,6 +217,7 @@ void DIALOG_GEN_FOOTPRINT_POSITION::OnGenerate( wxCommandEvent& event ) cfg->m_PlaceFile.file_options = m_fileOpt; cfg->m_PlaceFile.file_format = m_fileFormat; cfg->m_PlaceFile.include_board_edge = m_includeBoardEdge; + cfg->m_PlaceFile.use_aux_origin = m_useDrillPlaceOrigin->GetValue(); // Set output directory and replace backslashes with forward ones // (Keep unix convention in cfg files) @@ -235,10 +236,10 @@ void DIALOG_GEN_FOOTPRINT_POSITION::OnGenerate( wxCommandEvent& event ) bool DIALOG_GEN_FOOTPRINT_POSITION::CreateGerberFiles() { - BOARD* brd = m_parent->GetBoard(); - wxFileName fn; - wxString msg; - int fullcount = 0; + BOARD* brd = m_parent->GetBoard(); + wxFileName fn; + wxString msg; + int fullcount = 0; // Create output directory if it does not exist. Also transform it in absolute path. // Bail if it fails @@ -315,19 +316,20 @@ bool DIALOG_GEN_FOOTPRINT_POSITION::CreateGerberFiles() bool DIALOG_GEN_FOOTPRINT_POSITION::CreateAsciiFiles() { - BOARD * brd = m_parent->GetBoard(); - wxFileName fn; - wxString msg; - bool singleFile = OneFileOnly(); - bool useCSVfmt = m_fileFormat == 1; - int fullcount = 0; - int top_side = true; - int bottom_side = true; + BOARD * brd = m_parent->GetBoard(); + wxFileName fn; + wxString msg; + bool singleFile = OneFileOnly(); + bool useCSVfmt = m_fileFormat == 1; + bool useAuxOrigin = m_useDrillPlaceOrigin->GetValue(); + int fullcount = 0; + int topSide = true; + int bottomSide = true; // Test for any footprint candidate in list. { - PLACE_FILE_EXPORTER exporter( brd, UnitsMM(), ExcludeAllTH(), top_side, bottom_side, - useCSVfmt ); + PLACE_FILE_EXPORTER exporter( brd, UnitsMM(), ExcludeAllTH(), topSide, bottomSide, + useCSVfmt, useAuxOrigin ); exporter.GenPositionData(); if( exporter.GetFootprintCount() == 0 ) @@ -357,12 +359,12 @@ bool DIALOG_GEN_FOOTPRINT_POSITION::CreateAsciiFiles() fn.SetPath( outputDir.GetPath() ); // Create the Front or Top side placement file, or a single file - top_side = true; - bottom_side = false; + topSide = true; + bottomSide = false; if( singleFile ) { - bottom_side = true; + bottomSide = true; fn.SetName( fn.GetName() + wxT( "-" ) + wxT("all") ); } else @@ -378,8 +380,8 @@ bool DIALOG_GEN_FOOTPRINT_POSITION::CreateAsciiFiles() fn.SetExt( FootprintPlaceFileExtension ); int fpcount = m_parent->DoGenFootprintsPositionFile( fn.GetFullPath(), UnitsMM(), - ExcludeAllTH(), top_side, bottom_side, - useCSVfmt ); + ExcludeAllTH(), topSide, bottomSide, + useCSVfmt, useAuxOrigin ); if( fpcount < 0 ) { msg.Printf( _( "Unable to create '%s'." ), fn.GetFullPath() ); @@ -406,8 +408,8 @@ bool DIALOG_GEN_FOOTPRINT_POSITION::CreateAsciiFiles() // Create the Back or Bottom side placement file fullcount = fpcount; - top_side = false; - bottom_side = true; + topSide = false; + bottomSide = true; fn = brd->GetFileName(); fn.SetPath( outputDir.GetPath() ); fn.SetName( fn.GetName() + wxT( "-" ) + PLACE_FILE_EXPORTER::GetBackSideName().c_str() ); @@ -421,7 +423,7 @@ bool DIALOG_GEN_FOOTPRINT_POSITION::CreateAsciiFiles() fn.SetExt( FootprintPlaceFileExtension ); fpcount = m_parent->DoGenFootprintsPositionFile( fn.GetFullPath(), UnitsMM(), ExcludeAllTH(), - top_side, bottom_side, useCSVfmt ); + topSide, bottomSide, useCSVfmt, useAuxOrigin ); if( fpcount < 0 ) { @@ -467,7 +469,8 @@ int BOARD_EDITOR_CONTROL::GeneratePosFile( const TOOL_EVENT& aEvent ) int PCB_EDIT_FRAME::DoGenFootprintsPositionFile( const wxString& aFullFileName, bool aUnitsMM, bool aForceSmdItems, bool aTopSide, - bool aBottomSide, bool aFormatCSV ) + bool aBottomSide, bool aFormatCSV, + bool aUseAuxOrigin ) { FILE * file = NULL; @@ -481,7 +484,7 @@ int PCB_EDIT_FRAME::DoGenFootprintsPositionFile( const wxString& aFullFileName, std::string data; PLACE_FILE_EXPORTER exporter( GetBoard(), aUnitsMM, aForceSmdItems, aTopSide, aBottomSide, - aFormatCSV ); + aFormatCSV, aUseAuxOrigin ); data = exporter.GenPositionData(); // if aFullFileName is empty, the file is not created, only the @@ -541,7 +544,7 @@ bool PCB_EDIT_FRAME::DoGenFootprintsReport( const wxString& aFullFilename, bool return false; std::string data; - PLACE_FILE_EXPORTER exporter( GetBoard(), aUnitsMM, false, true, true, false ); + PLACE_FILE_EXPORTER exporter( GetBoard(), aUnitsMM, false, true, true, false, true ); data = exporter.GenReportData(); fputs( data.c_str(), rptfile ); diff --git a/pcbnew/exporters/gendrill_Excellon_writer.cpp b/pcbnew/exporters/gendrill_Excellon_writer.cpp index f777116cd5..3598bc9390 100644 --- a/pcbnew/exporters/gendrill_Excellon_writer.cpp +++ b/pcbnew/exporters/gendrill_Excellon_writer.cpp @@ -71,9 +71,8 @@ EXCELLON_WRITER::EXCELLON_WRITER( BOARD* aPcb ) } -void EXCELLON_WRITER::CreateDrillandMapFilesSet( const wxString& aPlotDirectory, - bool aGenDrill, bool aGenMap, - REPORTER * aReporter ) +void EXCELLON_WRITER::CreateDrillandMapFilesSet( const wxString& aPlotDirectory, bool aGenDrill, + bool aGenMap, REPORTER * aReporter ) { wxFileName fn; wxString msg; @@ -93,10 +92,11 @@ void EXCELLON_WRITER::CreateDrillandMapFilesSet( const wxString& aPlotDirectory, buildHolesList( pair, doing_npth ); - // The file is created if it has holes, or if it is the non plated drill file - // to be sure the NPTH file is up to date in separate files mode. - // Also a PTH drill/map file is always created, to be sure at least one plated hole drill file - // is created (do not create any PTH drill file can be seen as not working drill generator). + // The file is created if it has holes, or if it is the non plated drill file to be + // sure the NPTH file is up to date in separate files mode. + // Also a PTH drill/map file is always created, to be sure at least one plated hole + // drill file is created (do not create any PTH drill file can be seen as not working + // drill generator). if( getHolesCount() > 0 || doing_npth || pair == DRILL_LAYER_PAIR( F_Cu, B_Cu ) ) { fn = getDrillFileName( pair, doing_npth, m_merge_PTH_NPTH ); diff --git a/pcbnew/exporters/gendrill_file_writer_base.h b/pcbnew/exporters/gendrill_file_writer_base.h index 010a8ff648..b2e7efca21 100644 --- a/pcbnew/exporters/gendrill_file_writer_base.h +++ b/pcbnew/exporters/gendrill_file_writer_base.h @@ -178,7 +178,7 @@ public: void SetMergeOption( bool aMerge ) { m_merge_PTH_NPTH = aMerge; } /** - * Return the plot offset (usually the position of the auxiliary axis. + * Return the plot offset (usually the position of the drill/place origin). */ wxPoint GetOffset() { return m_offset; } diff --git a/pcbnew/pcb_edit_frame.h b/pcbnew/pcb_edit_frame.h index d8e83b49a7..9b6646531a 100644 --- a/pcbnew/pcb_edit_frame.h +++ b/pcbnew/pcb_edit_frame.h @@ -292,7 +292,7 @@ public: */ int DoGenFootprintsPositionFile( const wxString& aFullFileName, bool aUnitsMM, bool aForceSmdItems, bool aTopSide, bool aBottomSide, - bool aFormatCSV = false ); + bool aFormatCSV, bool aUseAuxOrigin ); /** * Call #DoGenFootprintsReport to create a footprint report file diff --git a/pcbnew/pcbnew_settings.cpp b/pcbnew/pcbnew_settings.cpp index 53b27ab43b..d2db2c38d3 100644 --- a/pcbnew/pcbnew_settings.cpp +++ b/pcbnew/pcbnew_settings.cpp @@ -402,6 +402,9 @@ PCBNEW_SETTINGS::PCBNEW_SETTINGS() m_params.emplace_back( new PARAM( "place_file.include_board_edge", &m_PlaceFile.include_board_edge, false ) ); + m_params.emplace_back( new PARAM( "place_file.use_place_file_origin", + &m_PlaceFile.use_aux_origin, true ) ); + m_params.emplace_back( new PARAM( "plot.all_layers_on_one_page", &m_Plot.all_layers_on_one_page, 1 ) ); diff --git a/pcbnew/pcbnew_settings.h b/pcbnew/pcbnew_settings.h index 59a5ccecd9..f64d281cdc 100644 --- a/pcbnew/pcbnew_settings.h +++ b/pcbnew/pcbnew_settings.h @@ -177,6 +177,7 @@ public: int file_options; int file_format; bool include_board_edge; + bool use_aux_origin; }; struct DIALOG_PLOT