From 89907a18cedddbd138b1ae5c35a6db1f3b7eaa59 Mon Sep 17 00:00:00 2001 From: Jeff Young Date: Fri, 18 Feb 2022 13:24:21 +0000 Subject: [PATCH] Don't ask for layer of multi-layer object. --- pcbnew/plugins/kicad/pcb_parser.cpp | 2 +- pcbnew/plugins/kicad/pcb_plugin.cpp | 26 ++++++++++++-------------- pcbnew/plugins/kicad/pcb_plugin.h | 2 +- 3 files changed, 14 insertions(+), 16 deletions(-) diff --git a/pcbnew/plugins/kicad/pcb_parser.cpp b/pcbnew/plugins/kicad/pcb_parser.cpp index 062181486d..d4079881af 100644 --- a/pcbnew/plugins/kicad/pcb_parser.cpp +++ b/pcbnew/plugins/kicad/pcb_parser.cpp @@ -5735,7 +5735,7 @@ ZONE* PCB_PARSER::parseZONE( BOARD_ITEM_CONTAINER* aParent ) } else { - filledLayer = zone->GetLayer(); + filledLayer = zone->GetFirstLayer(); } bool island = false; diff --git a/pcbnew/plugins/kicad/pcb_plugin.cpp b/pcbnew/plugins/kicad/pcb_plugin.cpp index 5fb475e1f9..09fe8509b9 100644 --- a/pcbnew/plugins/kicad/pcb_plugin.cpp +++ b/pcbnew/plugins/kicad/pcb_plugin.cpp @@ -471,11 +471,9 @@ void PCB_PLUGIN::Format( const BOARD_ITEM* aItem, int aNestLevel ) const } -void PCB_PLUGIN::formatLayer( const BOARD_ITEM* aItem ) const +void PCB_PLUGIN::formatLayer( PCB_LAYER_ID aLayer ) const { - PCB_LAYER_ID layer = aItem->GetLayer(); - - m_out->Print( 0, " (layer %s)", m_out->Quotew( LSET::Name( layer ) ).c_str() ); + m_out->Print( 0, " (layer %s)", m_out->Quotew( LSET::Name( aLayer ) ).c_str() ); } @@ -825,7 +823,7 @@ void PCB_PLUGIN::format( const PCB_DIMENSION_BASE* aDimension, int aNestLevel ) else wxFAIL_MSG( wxT( "Cannot format unknown dimension type!" ) ); - formatLayer( aDimension ); + formatLayer( aDimension->GetLayer() ); m_out->Print( 0, " (tstamp %s)", TO_UTF8( aDimension->m_Uuid.AsString() ) ); @@ -988,7 +986,7 @@ void PCB_PLUGIN::format( const PCB_SHAPE* aShape, int aNestLevel ) const m_out->Print( 0, " (fill none)" ); } - formatLayer( aShape ); + formatLayer( aShape->GetLayer() ); m_out->Print( 0, " (tstamp %s)", TO_UTF8( aShape->m_Uuid.AsString() ) ); @@ -1076,7 +1074,7 @@ void PCB_PLUGIN::format( const FP_SHAPE* aFPShape, int aNestLevel ) const m_out->Print( 0, " (fill none)" ); } - formatLayer( aFPShape ); + formatLayer( aFPShape->GetLayer() ); m_out->Print( 0, " (tstamp %s)", TO_UTF8( aFPShape->m_Uuid.AsString() ) ); @@ -1094,7 +1092,7 @@ void PCB_PLUGIN::format( const PCB_TARGET* aTarget, int aNestLevel ) const if( aTarget->GetWidth() != 0 ) m_out->Print( 0, " (width %s)", FormatInternalUnits( aTarget->GetWidth() ).c_str() ); - formatLayer( aTarget ); + formatLayer( aTarget->GetLayer() ); m_out->Print( 0, " (tstamp %s)", TO_UTF8( aTarget->m_Uuid.AsString() ) ); @@ -1133,7 +1131,7 @@ void PCB_PLUGIN::format( const FOOTPRINT* aFootprint, int aNestLevel ) const if( aFootprint->IsPlaced() ) m_out->Print( 0, " placed" ); - formatLayer( aFootprint ); + formatLayer( aFootprint->GetLayer() ); m_out->Print( 0, "\n" ); m_out->Print( aNestLevel+1, "(tedit %lX)", (unsigned long)aFootprint->GetLastEditTime() ); @@ -1734,7 +1732,7 @@ void PCB_PLUGIN::format( const PCB_TEXT* aText, int aNestLevel ) const m_out->Print( 0, ")" ); - formatLayer( aText ); + formatLayer( aText->GetLayer() ); m_out->Print( 0, " (tstamp %s)", TO_UTF8( aText->m_Uuid.AsString() ) ); @@ -1779,7 +1777,7 @@ void PCB_PLUGIN::format( const PCB_TEXTBOX* aTextBox, int aNestLevel ) const if( !aTextBox->GetTextAngle().IsZero() ) m_out->Print( 0, " (angle %s)", FormatAngle( aTextBox->GetTextAngle() ).c_str() ); - formatLayer( aTextBox ); + formatLayer( aTextBox->GetLayer() ); m_out->Print( 0, " (tstamp %s)", TO_UTF8( aTextBox->m_Uuid.AsString() ) ); @@ -1876,7 +1874,7 @@ void PCB_PLUGIN::format( const FP_TEXT* aText, int aNestLevel ) const m_out->Print( 0, " unlocked" ); m_out->Print( 0, ")" ); - formatLayer( aText ); + formatLayer( aText->GetLayer() ); if( !aText->IsVisible() ) m_out->Print( 0, " hide" ); @@ -1923,7 +1921,7 @@ void PCB_PLUGIN::format( const FP_TEXTBOX* aTextBox, int aNestLevel ) const if( !aTextBox->GetTextAngle().IsZero() ) m_out->Print( 0, " (angle %s)", FormatAngle( aTextBox->GetTextAngle() ).c_str() ); - formatLayer( aTextBox ); + formatLayer( aTextBox->GetLayer() ); m_out->Print( 0, " (tstamp %s)", TO_UTF8( aTextBox->m_Uuid.AsString() ) ); @@ -2061,7 +2059,7 @@ void PCB_PLUGIN::format( const ZONE* aZone, int aNestLevel ) const } else { - formatLayer( aZone ); + formatLayer( aZone->GetFirstLayer() ); } m_out->Print( 0, " (tstamp %s)", TO_UTF8( aZone->m_Uuid.AsString() ) ); diff --git a/pcbnew/plugins/kicad/pcb_plugin.h b/pcbnew/plugins/kicad/pcb_plugin.h index f15b9e731a..8def96dadf 100644 --- a/pcbnew/plugins/kicad/pcb_plugin.h +++ b/pcbnew/plugins/kicad/pcb_plugin.h @@ -299,7 +299,7 @@ private: void formatRenderCache( const EDA_TEXT* aText, int aNestLevel ) const; - void formatLayer( const BOARD_ITEM* aItem ) const; + void formatLayer( PCB_LAYER_ID aLayer ) const; void formatLayers( LSET aLayerMask, int aNestLevel = 0 ) const;