diff --git a/pcbnew/router/router_tool.cpp b/pcbnew/router/router_tool.cpp index 957f88955d..966d343cdb 100644 --- a/pcbnew/router/router_tool.cpp +++ b/pcbnew/router/router_tool.cpp @@ -62,6 +62,7 @@ using namespace std::placeholders; #include #include +#include #include "router_tool.h" #include "pns_segment.h" @@ -602,12 +603,12 @@ void ROUTER_TOOL::saveRouterDebugLog() if( !rv ) return; - FILE* f = fopen( fname_settings.GetFullPath().c_str(), "wb" ); + FILE* f = wxFopen( fname_settings.GetFullPath(), "wb" ); std::string settingsStr = m_router->Settings().FormatAsString(); fprintf( f, "%s\n", settingsStr.c_str() ); fclose( f ); - f = fopen( fname_log.GetFullPath().c_str(), "wb" ); + f = wxFopen( fname_log.GetFullPath(), "wb" ); fprintf(f, "mode %d\n", m_router->Mode() ); @@ -635,6 +636,7 @@ void ROUTER_TOOL::saveRouterDebugLog() PROJECT* prj = m_iface->GetBoard()->GetProject(); prj->GetProjectFile().SaveAs( cwd, "pns" ); + prj->GetLocalSettings().SaveAs( cwd, "pns" ); std::vector added, removed, heads; m_router->GetUpdatedItems( removed, added, heads ); diff --git a/qa/tools/pns/pns_log_file.cpp b/qa/tools/pns/pns_log_file.cpp index c4b6fc5fe3..bef1264700 100644 --- a/qa/tools/pns/pns_log_file.cpp +++ b/qa/tools/pns/pns_log_file.cpp @@ -34,6 +34,9 @@ #include #include +#include +#include + #include <../../tests/common/console_log.h> BOARD_CONNECTED_ITEM* PNS_LOG_FILE::ItemById( const PNS_LOG_FILE::EVENT_ENTRY& evt ) @@ -383,6 +386,7 @@ bool PNS_LOG_FILE::Load( const wxFileName& logFileName, REPORTER* aRpt ) BOARD_DESIGN_SETTINGS& bds = m_board->GetDesignSettings(); bds.m_DRCEngine = drcEngine; + bds.m_UseConnectedTrackWidth = m_board->GetProject()->GetLocalSettings().m_AutoTrackWidth; m_board->SynchronizeNetsAndNetClasses( true ); diff --git a/qa/tools/pns/pns_log_player.cpp b/qa/tools/pns/pns_log_player.cpp index d3ded7b838..87c9120af0 100644 --- a/qa/tools/pns/pns_log_player.cpp +++ b/qa/tools/pns/pns_log_player.cpp @@ -56,8 +56,6 @@ void PNS_LOG_PLAYER::createRouter() m_router->Settings().SetMode( PNS::RM_Walkaround ); m_router->Sizes().SetTrackWidth( 250000 ); - //m_router->Settings().SetOptimizeDraggedTrack( true ); - m_debugDecorator = new PNS_TEST_DEBUG_DECORATOR; m_debugDecorator->Clear(); m_iface->SetDebugDecorator( m_debugDecorator ); @@ -107,6 +105,7 @@ void PNS_LOG_PLAYER::ReplayLog( PNS_LOG_FILE* aLog, int aStartEventIndex, int aF auto item = aLog->ItemById( evt ); ITEM* ritem = item ? m_router->GetWorld()->FindItemByParent( item ) : nullptr; + int routingLayer = ritem ? ritem->Layers().Start() : F_Cu; eventIdx++; @@ -114,24 +113,36 @@ void PNS_LOG_PLAYER::ReplayLog( PNS_LOG_FILE* aLog, int aStartEventIndex, int aF { case LOGGER::EVT_START_ROUTE: { + PNS::SIZES_SETTINGS sizes( m_router->Sizes() ); + m_iface->SetStartLayer( routingLayer ); + m_iface->ImportSizes( sizes, ritem, -1 ); + m_router->UpdateSizes( sizes ); + m_debugDecorator->NewStage( "route-start", 0, PNSLOGINFO ); m_viewTracker->SetStage( m_debugDecorator->GetStageCount() - 1 ); - auto msg = wxString::Format( "event [%d/%d]: route-start (%d, %d)", eventIdx, totalEvents, evt.p.x, evt.p.y ); + auto msg = wxString::Format( "event [%d/%d]: route-start (%d, %d)", eventIdx, + totalEvents, evt.p.x, evt.p.y ); m_debugDecorator->Message( msg ); m_reporter->Report( msg ); - m_router->StartRouting( evt.p, ritem, ritem ? ritem->Layers().Start() : F_Cu ); + m_router->StartRouting( evt.p, ritem, routingLayer ); break; } case LOGGER::EVT_START_DRAG: { + PNS::SIZES_SETTINGS sizes( m_router->Sizes() ); + m_iface->SetStartLayer( routingLayer ); + m_iface->ImportSizes( sizes, ritem, -1 ); + m_router->UpdateSizes( sizes ); + m_debugDecorator->NewStage( "drag-start", 0, PNSLOGINFO ); m_viewTracker->SetStage( m_debugDecorator->GetStageCount() - 1 ); - auto msg = wxString::Format( "event [%d/%d]: drag-start (%d, %d)", eventIdx, totalEvents, evt.p.x, evt.p.y ); + auto msg = wxString::Format( "event [%d/%d]: drag-start (%d, %d)", eventIdx, + totalEvents, evt.p.x, evt.p.y ); m_debugDecorator->Message( msg ); m_reporter->Report( msg );