diff --git a/pcbnew/tools/convert_tool.cpp b/pcbnew/tools/convert_tool.cpp index e296ed7809..608fca0997 100644 --- a/pcbnew/tools/convert_tool.cpp +++ b/pcbnew/tools/convert_tool.cpp @@ -644,7 +644,7 @@ int CONVERT_TOOL::CreateLines( const TOOL_EVENT& aEvent ) FOOTPRINT_EDIT_FRAME* fpEditor = dynamic_cast( m_frame ); FOOTPRINT* footprint = nullptr; PCB_LAYER_ID targetLayer = m_frame->GetActiveLayer(); - PCB_LAYER_ID copperLayer = UNSELECTED_LAYER; + PCB_LAYER_ID copperLayer = F_Cu; BOARD_ITEM_CONTAINER* parent = frame->GetModel(); if( fpEditor ) @@ -685,6 +685,20 @@ int CONVERT_TOOL::CreateLines( const TOOL_EVENT& aEvent ) return false; }; + if( aEvent.IsAction( &PCB_ACTIONS::convertToTracks ) ) + { + if( !IsCopperLayer( targetLayer ) ) + { + if( copperLayer == UNSELECTED_LAYER ) + copperLayer = frame->SelectOneLayer( F_Cu, LSET::AllNonCuMask() ); + + if( copperLayer == UNDEFINED_LAYER ) // User canceled + return true; + + targetLayer = copperLayer; + } + } + for( EDA_ITEM* item : selection ) { if( handleGraphicSeg( item ) ) @@ -721,19 +735,6 @@ int CONVERT_TOOL::CreateLines( const TOOL_EVENT& aEvent ) } else { - - - if( !IsCopperLayer( targetLayer ) ) - { - if( copperLayer == UNSELECTED_LAYER ) - copperLayer = frame->SelectOneLayer( F_Cu, LSET::AllNonCuMask() ); - - if( copperLayer == UNDEFINED_LAYER ) // User canceled - continue; - - targetLayer = copperLayer; - } - // I am really unsure converting a polygon to "tracks" (i.e. segments on // copper layers) make sense for footprints, but anyway this code exists if( fpEditor )