diff --git a/pcbnew/python/scripting/pcbnew_scripting_helpers.cpp b/pcbnew/python/scripting/pcbnew_scripting_helpers.cpp index acb3db074b..73038fcb99 100644 --- a/pcbnew/python/scripting/pcbnew_scripting_helpers.cpp +++ b/pcbnew/python/scripting/pcbnew_scripting_helpers.cpp @@ -32,6 +32,7 @@ #include "pcbnew_scripting_helpers.h" +#include #include #include #include @@ -358,12 +359,27 @@ void Refresh() { if( s_PcbEditFrame ) { - auto board = s_PcbEditFrame->GetBoard(); + TOOL_MANAGER* toolMgr = s_PcbEditFrame->GetToolManager(); + BOARD* board = s_PcbEditFrame->GetBoard(); + PCB_DRAW_PANEL_GAL* canvas = s_PcbEditFrame->GetCanvas(); + + canvas->SyncLayersVisibility( board ); + + canvas->GetView()->Clear(); + canvas->GetView()->InitPreview(); + canvas->GetGAL()->SetGridOrigin( VECTOR2D( board->GetDesignSettings().GetGridOrigin() ) ); + canvas->DisplayBoard( board ); + + // allow tools to re-add their view items (selection previews, grids, etc.) + if( toolMgr ) + toolMgr->ResetTools( TOOL_BASE::GAL_SWITCH ); + + // reload the drawing-sheet + s_PcbEditFrame->SetPageSettings( board->GetPageSettings() ); + board->BuildConnectivity(); - // Re-init everything: this is the easy way to do that - s_PcbEditFrame->ActivateGalCanvas(); - s_PcbEditFrame->GetCanvas()->Refresh(); + canvas->Refresh(); } }