diff --git a/pcbnew/board_connected_item.cpp b/pcbnew/board_connected_item.cpp index 26eb9ba7ad..32637cb675 100644 --- a/pcbnew/board_connected_item.cpp +++ b/pcbnew/board_connected_item.cpp @@ -36,6 +36,10 @@ #include + +const wxChar* const traceMask = wxT( "BOARD_CONNECTED_ITEM" ); + + BOARD_CONNECTED_ITEM::BOARD_CONNECTED_ITEM( BOARD_ITEM* aParent, KICAD_T idtype ) : BOARD_ITEM( aParent, idtype ), m_netinfo( &NETINFO_LIST::ORPHANED_ITEM ) { @@ -94,7 +98,7 @@ int BOARD_CONNECTED_ITEM::GetClearance( BOARD_CONNECTED_ITEM* aItem ) const } else { - DBG(printf( "%s: NULL netclass,type %d", __func__, Type() );) + wxLogTrace( traceMask, "%s: NULL netclass,type %d", __func__, Type() ); } return 0; @@ -112,7 +116,7 @@ NETCLASSPTR BOARD_CONNECTED_ITEM::GetNetClass() const if( board == NULL ) // Should not occur { - DBG(printf( "%s: NULL board,type %d", __func__, Type() );) + wxLogTrace( traceMask, "%s: NULL board,type %d", __func__, Type() ); return NETCLASSPTR(); } diff --git a/pcbnew/tools/pcb_editor_control.cpp b/pcbnew/tools/pcb_editor_control.cpp index 9a455d61ae..eacc731d8c 100644 --- a/pcbnew/tools/pcb_editor_control.cpp +++ b/pcbnew/tools/pcb_editor_control.cpp @@ -430,6 +430,7 @@ int PCB_EDITOR_CONTROL::PlaceModule( const TOOL_EVENT& aEvent ) SELECTION_TOOL* selTool = m_toolMgr->GetTool(); SELECTION& selection = selTool->GetSelection(); BOARD_COMMIT commit( m_frame ); + BOARD* board = getModel(); m_toolMgr->RunAction( PCB_ACTIONS::selectionClear, true ); controls->ShowCursor( true ); @@ -487,6 +488,9 @@ int PCB_EDITOR_CONTROL::PlaceModule( const TOOL_EVENT& aEvent ) module->SetFlags( IS_NEW ); // whatever module->SetTimeStamp( GetNewTimeStamp() ); + // Set parent so that clearance can be loaded + module->SetParent( board ); + // Put it on FRONT layer, // (Can be stored flipped if the lib is an archive built from a board) if( module->IsFlipped() )