CADSTAR PCB: Add imported nets to the imported netclass.

This commit is contained in:
Roberto Fernandez Bautista 2021-10-08 20:24:42 +01:00
parent 58fc4f512d
commit ae0229b7c9
1 changed files with 8 additions and 5 deletions

View File

@ -3085,6 +3085,8 @@ std::vector<PCB_TRACK*> CADSTAR_PCB_ARCHIVE_LOADER::makeTracksFromShapes(
if( aNet != nullptr ) if( aNet != nullptr )
track->SetNet( aNet ); track->SetNet( aNet );
else
track->SetNetCode( -1 );
track->SetLocked( shape->IsLocked() ); track->SetLocked( shape->IsLocked() );
@ -3815,23 +3817,24 @@ NETINFO_ITEM* CADSTAR_PCB_ARCHIVE_LOADER::getKiCadNet( const NET_ID& aCadstarNet
} }
NETINFO_ITEM* netInfo = new NETINFO_ITEM( m_board, newName, ++m_numNets ); NETINFO_ITEM* netInfo = new NETINFO_ITEM( m_board, newName, ++m_numNets );
m_board->Add( netInfo, ADD_MODE::APPEND ); NETCLASSPTR netclass;
if( m_netClassMap.find( csNet.RouteCodeID ) != m_netClassMap.end() ) if( m_netClassMap.find( csNet.RouteCodeID ) != m_netClassMap.end() )
{ {
NETCLASSPTR netclass = m_netClassMap.at( csNet.RouteCodeID ); netclass = m_netClassMap.at( csNet.RouteCodeID );
netInfo->SetNetClass( netclass );
} }
else else
{ {
ROUTECODE rc = getRouteCode( csNet.RouteCodeID ); ROUTECODE rc = getRouteCode( csNet.RouteCodeID );
NETCLASSPTR netclass( new NETCLASS( rc.Name ) ); netclass.reset( new NETCLASS( rc.Name ) );
m_board->GetDesignSettings().GetNetClasses().Add( netclass ); m_board->GetDesignSettings().GetNetClasses().Add( netclass );
netclass->SetTrackWidth( getKiCadLength( rc.OptimalWidth ) ); netclass->SetTrackWidth( getKiCadLength( rc.OptimalWidth ) );
netInfo->SetNetClass( netclass );
m_netClassMap.insert( { csNet.RouteCodeID, netclass } ); m_netClassMap.insert( { csNet.RouteCodeID, netclass } );
} }
netclass->Add( newName );
netInfo->SetNetClass( netclass );
m_board->Add( netInfo, ADD_MODE::APPEND );
m_netMap.insert( { aCadstarNetID, netInfo } ); m_netMap.insert( { aCadstarNetID, netInfo } );
return netInfo; return netInfo;
} }