Fixes ability for Export to PCB new to handle plain Gerber drill files (gbr).

In addition to Excellon.

Also fixes issue with layer mapping dialogue text colors not updating on selection.


Signed-off-by: Bevan Weiss <bevan.weiss@gmail.com>
This commit is contained in:
Bevan Weiss 2022-10-31 22:01:09 +11:00 committed by jean-pierre charras
parent aeef215ffb
commit 38b54b62e0
2 changed files with 24 additions and 6 deletions

View File

@ -229,7 +229,7 @@ void LAYERS_MAP_DIALOG::initDialog()
int currLayer = gerber2KicadMapping[ii];
// Default to "Do Not Export" for unselected or undefined layer
if( ( currLayer == UNSELECTED_LAYER ) || ( currLayer == UNDEFINED_LAYER ) )
if( ( currLayer == UNSELECTED_LAYER ) )
{
m_layersList[ii]->SetLabel( _( "Do not export" ) );
m_layersList[ii]->SetForegroundColour( *wxBLUE );
@ -281,6 +281,10 @@ void LAYERS_MAP_DIALOG::OnResetClick( wxCommandEvent& event )
m_layersList[ii]->SetForegroundColour( *wxBLUE );
m_buttonTable[ii] = ii;
}
// wxWidgets doesn't appear to invalidate / update the StaticText displays for color change
// so we do it manually
Refresh();
Update();
}
@ -398,6 +402,10 @@ void LAYERS_MAP_DIALOG::OnSelectLayer( wxCommandEvent& event )
m_layersList[ii]->SetForegroundColour( wxColour( 255, 0, 128 ) );
}
}
// wxWidgets doesn't appear to invalidate / update the StaticText displays for color change
// so we do it manually
Refresh();
Update();
}

View File

@ -81,13 +81,23 @@ bool GBR_TO_PCB_EXPORTER::ExportPcb( const int* aLayerLookUpTable, int aCopperLa
// First collect all the holes. We'll use these to generate pads, vias, etc.
for( unsigned layer = 0; layer < images->ImagesMaxCount(); ++layer )
{
int pcb_layer_number = aLayerLookUpTable[layer];
EXCELLON_IMAGE* excellon = dynamic_cast<EXCELLON_IMAGE*>( images->GetGbrImage( layer ) );
if( excellon == nullptr ) // Layer not yet used or not a drill image
GERBER_FILE_IMAGE* gerb = dynamic_cast<GERBER_FILE_IMAGE*>( images->GetGbrImage( layer ) );
if( excellon )
{
for( GERBER_DRAW_ITEM* gerb_item : excellon->GetItems() )
collect_hole( gerb_item );
}
else if( gerb and pcb_layer_number == UNDEFINED_LAYER ) // PCB_LAYER_ID doesn't have an entry for Hole Data, but the dialog returns UNDEFINED_LAYER for it
{
for( GERBER_DRAW_ITEM* gerb_item : gerb->GetItems() )
collect_hole( gerb_item );
}
else
{
continue;
for( GERBER_DRAW_ITEM* gerb_item : excellon->GetItems() )
collect_hole( gerb_item );
}
}
// Next: non copper layers: