Respect "exclude DNP" setting for Gerber X3.

Fixes https://gitlab.com/kicad/code/kicad/-/issues/21201
This commit is contained in:
Jeff Young
2025-07-02 14:11:52 -06:00
parent 90f5cbf003
commit fa9a588683
4 changed files with 25 additions and 20 deletions
@@ -352,7 +352,8 @@ bool DIALOG_GEN_FOOTPRINT_POSITION::CreateGerberFiles()
PLACEFILE_GERBER_WRITER exporter( brd );
wxString filename = exporter.GetPlaceFileName( fn.GetFullPath(), F_Cu );
int fpcount = exporter.CreatePlaceFile( filename, F_Cu, m_cbIncludeBoardEdge->GetValue() );
int fpcount = exporter.CreatePlaceFile( filename, F_Cu, m_cbIncludeBoardEdge->GetValue(),
m_excludeDNP->GetValue() );
if( fpcount < 0 )
{
@@ -373,7 +374,8 @@ bool DIALOG_GEN_FOOTPRINT_POSITION::CreateGerberFiles()
filename = exporter.GetPlaceFileName( fn.GetFullPath(), B_Cu );
fpcount = exporter.CreatePlaceFile( filename, B_Cu, m_cbIncludeBoardEdge->GetValue() );
fpcount = exporter.CreatePlaceFile( filename, B_Cu, m_cbIncludeBoardEdge->GetValue(),
m_excludeDNP->GetValue() );
if( fpcount < 0 )
{
@@ -468,9 +470,8 @@ bool DIALOG_GEN_FOOTPRINT_POSITION::CreateAsciiFiles()
}
int fpcount = m_editFrame->DoGenFootprintsPositionFile( fn.GetFullPath(), UnitsMM(), OnlySMD(),
ExcludeAllTH(), ExcludeDNP(), topSide,
bottomSide, useCSVfmt, useAuxOrigin,
negateBottomX );
ExcludeAllTH(), ExcludeDNP(), topSide, bottomSide,
useCSVfmt, useAuxOrigin, negateBottomX );
if( fpcount < 0 )
{
msg.Printf( _( "Failed to create file '%s'." ), fn.GetFullPath() );
@@ -511,9 +512,8 @@ bool DIALOG_GEN_FOOTPRINT_POSITION::CreateAsciiFiles()
}
fpcount = m_editFrame->DoGenFootprintsPositionFile( fn.GetFullPath(), UnitsMM(), OnlySMD(),
ExcludeAllTH(), ExcludeDNP(), topSide,
bottomSide, useCSVfmt,
useAuxOrigin, negateBottomX );
ExcludeAllTH(), ExcludeDNP(), topSide, bottomSide,
useCSVfmt, useAuxOrigin, negateBottomX );
if( fpcount < 0 )
{
@@ -616,10 +616,13 @@ int BOARD_EDITOR_CONTROL::GenFootprintsReport( const TOOL_EVENT& aEvent )
std::string data;
PLACE_FILE_EXPORTER exporter( board, m_frame->GetUserUnits() == EDA_UNITS::MM,
false, false, // SMD aOnlySMD, aNoTHItems
false, // aExcludeDNP
true, true, // aTopSide, aBottomSide
false, true, false ); // aFormatCSV, aUseAuxOrigin, aNegateBottomX
false, // aOnlySMD
false, // aNoTHItems
false, // aExcludeDNP
true, true, // aTopSide, aBottomSide
false, // aFormatCSV
true, // aUseAuxOrigin
false ); // aNegateBottomX
data = exporter.GenReportData();
fputs( data.c_str(), rptfile );
+4 -1
View File
@@ -49,7 +49,7 @@ PLACEFILE_GERBER_WRITER::PLACEFILE_GERBER_WRITER( BOARD* aPcb )
int PLACEFILE_GERBER_WRITER::CreatePlaceFile( const wxString& aFullFilename, PCB_LAYER_ID aLayer,
bool aIncludeBrdEdges )
bool aIncludeBrdEdges, bool aExcludeDNP )
{
m_layer = aLayer;
@@ -66,6 +66,9 @@ int PLACEFILE_GERBER_WRITER::CreatePlaceFile( const wxString& aFullFilename, PCB
if( footprint->GetAttributes() & FP_EXCLUDE_FROM_POS_FILES )
continue;
if( aExcludeDNP && ( footprint->GetAttributes() & FP_DNP ) )
continue;
if( footprint->GetLayer() == aLayer )
fp_list.push_back( footprint );
}
+2 -1
View File
@@ -66,7 +66,8 @@ public:
* @param aIncludeBrdEdges use true to include board outlines.
* @return component count, or -1 if the file cannot be created.
*/
int CreatePlaceFile( const wxString& aFullFilename, PCB_LAYER_ID aLayer, bool aIncludeBrdEdges );
int CreatePlaceFile( const wxString& aFullFilename, PCB_LAYER_ID aLayer, bool aIncludeBrdEdges,
bool aExcludeDNP );
/**
* @param aFullBaseFilename = a full filename. it will be modified
+4 -6
View File
@@ -1732,10 +1732,9 @@ int PCBNEW_JOBS_HANDLER::JobExportPos( JOB* aJob )
if( aPosJob->m_side == JOB_EXPORT_PCB_POS::SIDE::BOTH || !aPosJob->m_nakedFilename )
outPath = exporter.GetPlaceFileName( outPath, gbrLayer );
if( exporter.CreatePlaceFile( outPath, gbrLayer, aPosJob->m_gerberBoardEdge ) >= 0 )
if( exporter.CreatePlaceFile( outPath, gbrLayer, aPosJob->m_gerberBoardEdge, aPosJob->m_excludeDNP ) >= 0 )
{
m_reporter->Report( wxString::Format( _( "Wrote front position data to '%s'.\n" ),
outPath ),
m_reporter->Report( wxString::Format( _( "Wrote front position data to '%s'.\n" ), outPath ),
RPT_SEVERITY_ACTION );
aPosJob->AddOutput( outPath );
@@ -1756,10 +1755,9 @@ int PCBNEW_JOBS_HANDLER::JobExportPos( JOB* aJob )
if( aPosJob->m_side == JOB_EXPORT_PCB_POS::SIDE::BOTH || !aPosJob->m_nakedFilename )
outPath = exporter.GetPlaceFileName( outPath, gbrLayer );
if( exporter.CreatePlaceFile( outPath, gbrLayer, aPosJob->m_gerberBoardEdge ) >= 0 )
if( exporter.CreatePlaceFile( outPath, gbrLayer, aPosJob->m_gerberBoardEdge, aPosJob->m_excludeDNP ) >= 0 )
{
m_reporter->Report( wxString::Format( _( "Wrote back position data to '%s'.\n" ),
outPath ),
m_reporter->Report( wxString::Format( _( "Wrote back position data to '%s'.\n" ), outPath ),
RPT_SEVERITY_ACTION );
aPosJob->AddOutput( outPath );