diff --git a/eeschema/tools/sch_editor_control.cpp b/eeschema/tools/sch_editor_control.cpp index e69a93d6a1..a3f47a0e55 100644 --- a/eeschema/tools/sch_editor_control.cpp +++ b/eeschema/tools/sch_editor_control.cpp @@ -637,19 +637,12 @@ int SCH_EDITOR_CONTROL::SimProbe( const TOOL_EVENT& aEvent ) if( !item ) return false; + SCH_SHEET_PATH& sheet = m_frame->GetCurrentSheet(); + if( item->IsType( wires ) ) { - // TODO(JE) Port to connection graph - std::unique_ptr netlist( m_frame->BuildNetListBase() ); - - for( NETLIST_OBJECT* obj : *netlist ) - { - if( obj->m_Comp == item ) - { - simFrame->AddVoltagePlot( UnescapeString( obj->GetNetName() ) ); - break; - } - } + if( SCH_CONNECTION* conn = static_cast( item )->Connection( sheet ) ) + simFrame->AddVoltagePlot( UnescapeString( conn->Name() ) ); } else if( item->Type() == SCH_PIN_T ) { @@ -668,7 +661,7 @@ int SCH_EDITOR_CONTROL::SimProbe( const TOOL_EVENT& aEvent ) else param = wxString::Format( wxT( "I%s" ), pin->GetName().Lower() ); - simFrame->AddCurrentPlot( comp->GetRef( &m_frame->GetCurrentSheet() ), param ); + simFrame->AddCurrentPlot( comp->GetRef( &sheet ), param ); } return true;