Map nets (if possible) from clipboard to destination.
Fixes: lp:1795057 * https://bugs.launchpad.net/kicad/+bug/1795057
This commit is contained in:
parent
a3229c455d
commit
0995433601
|
@ -1729,17 +1729,6 @@ D_PAD* BOARD::GetPad( unsigned aIndex ) const
|
|||
return nullptr;
|
||||
}
|
||||
|
||||
void BOARD::ClearAllNetCodes()
|
||||
{
|
||||
for( auto zone : Zones() )
|
||||
zone->SetNetCode( 0 );
|
||||
|
||||
for( auto pad : GetPads() )
|
||||
pad->SetNetCode( 0 );
|
||||
|
||||
for( auto track : Tracks() )
|
||||
track->SetNetCode( 0 );
|
||||
}
|
||||
|
||||
const std::vector<BOARD_CONNECTED_ITEM*> BOARD::AllConnectedItems()
|
||||
{
|
||||
|
@ -1767,9 +1756,31 @@ const std::vector<BOARD_CONNECTED_ITEM*> BOARD::AllConnectedItems()
|
|||
return items;
|
||||
}
|
||||
|
||||
|
||||
void BOARD::ClearAllNetCodes()
|
||||
{
|
||||
for ( BOARD_CONNECTED_ITEM* item : AllConnectedItems() )
|
||||
item->SetNetCode( 0 );
|
||||
}
|
||||
|
||||
|
||||
void BOARD::MapNets( const BOARD* aDestBoard )
|
||||
{
|
||||
for ( BOARD_CONNECTED_ITEM* item : AllConnectedItems() )
|
||||
{
|
||||
NETINFO_ITEM* netInfo = aDestBoard->FindNet( item->GetNetname() );
|
||||
|
||||
if( netInfo )
|
||||
item->SetNetCode( netInfo->GetNet() );
|
||||
else
|
||||
item->SetNetCode( 0 );
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void BOARD::SanitizeNetcodes()
|
||||
{
|
||||
for ( auto item : AllConnectedItems() )
|
||||
for ( BOARD_CONNECTED_ITEM* item : AllConnectedItems() )
|
||||
{
|
||||
if( FindNet( item->GetNetCode() ) == nullptr )
|
||||
item->SetNetCode( NETINFO_LIST::ORPHANED );
|
||||
|
|
|
@ -1181,6 +1181,13 @@ public:
|
|||
*/
|
||||
void ClearAllNetCodes();
|
||||
|
||||
/**
|
||||
* Map all nets in the given board to nets with the same name (if any) in the destination
|
||||
* board. This allows us to share layouts which came from the same hierarchical sheet in
|
||||
* the schematic.
|
||||
*/
|
||||
void MapNets( const BOARD* aDestBoard );
|
||||
|
||||
void SanitizeNetcodes();
|
||||
};
|
||||
|
||||
|
|
|
@ -584,7 +584,7 @@ int PCBNEW_CONTROL::Paste( const TOOL_EVENT& aEvent )
|
|||
return 0;
|
||||
|
||||
if( clipItem->Type() == PCB_T )
|
||||
static_cast<BOARD*>( clipItem )->ClearAllNetCodes();
|
||||
static_cast<BOARD*>( clipItem )->MapNets( m_frame->GetBoard() );
|
||||
|
||||
bool editModules = m_editModules || frame()->IsType( FRAME_FOOTPRINT_EDITOR );
|
||||
|
||||
|
@ -608,6 +608,9 @@ int PCBNEW_CONTROL::Paste( const TOOL_EVENT& aEvent )
|
|||
}
|
||||
|
||||
placeBoardItems( static_cast<BOARD*>( clipItem ), true );
|
||||
|
||||
m_frame->Compile_Ratsnest( true );
|
||||
m_frame->GetBoard()->BuildConnectivity();
|
||||
break;
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue