diff --git a/pcbnew/pad.cpp b/pcbnew/pad.cpp index 1b820d9000..253e2b88df 100644 --- a/pcbnew/pad.cpp +++ b/pcbnew/pad.cpp @@ -1310,9 +1310,15 @@ const BOX2I PAD::ViewBBox() const VECTOR2I solderPasteMargin = VECTOR2D( GetSolderPasteMargin() ); EDA_RECT bbox = GetBoundingBox(); + // get the biggest possible clearance + int clearance = 0; + + for( PCB_LAYER_ID layer : GetLayerSet().Seq() ) + clearance = std::max( clearance, GetOwnClearance( layer ) ); + // Look for the biggest possible bounding box - int xMargin = std::max( solderMaskMargin, solderPasteMargin.x ); - int yMargin = std::max( solderMaskMargin, solderPasteMargin.y ); + int xMargin = std::max( solderMaskMargin, solderPasteMargin.x ) + clearance; + int yMargin = std::max( solderMaskMargin, solderPasteMargin.y ) + clearance; return BOX2I( VECTOR2I( bbox.GetOrigin() ) - VECTOR2I( xMargin, yMargin ), VECTOR2I( bbox.GetSize() ) + VECTOR2I( 2 * xMargin, 2 * yMargin ) ); diff --git a/pcbnew/pcb_edit_frame.cpp b/pcbnew/pcb_edit_frame.cpp index c977afe36a..9b369b9f3f 100644 --- a/pcbnew/pcb_edit_frame.cpp +++ b/pcbnew/pcb_edit_frame.cpp @@ -1081,6 +1081,9 @@ void PCB_EDIT_FRAME::onBoardLoaded() // Display the loaded board: Zoom_Automatique( false ); + // Invalidate painting as loading the DRC engine will cause clearances to become valid + GetCanvas()->GetView()->UpdateAllItems( KIGFX::ALL ); + Refresh(); SetMsgPanel( GetBoard() );