Fix Pcbnew Python: LoadBoard does not rebuild connectivity database, and later, SaveBoard does not save net class memberships
Fixes: lp:1711268 https://bugs.launchpad.net/kicad/+bug/1711268
This commit is contained in:
parent
352919658d
commit
4d0c1577d2
|
@ -123,6 +123,12 @@ BOARD::~BOARD()
|
|||
}
|
||||
|
||||
|
||||
void BOARD::BuildConnectivity()
|
||||
{
|
||||
GetConnectivity()->Build( this );
|
||||
}
|
||||
|
||||
|
||||
const wxPoint& BOARD::GetPosition() const
|
||||
{
|
||||
wxLogWarning( wxT( "This should not be called on the BOARD object") );
|
||||
|
|
|
@ -292,6 +292,14 @@ public:
|
|||
return m_connectivity;
|
||||
}
|
||||
|
||||
/**
|
||||
* Builds or rebuilds the board connectivity database for the board,
|
||||
* especially the list of connected items, list of nets and rastnest data
|
||||
* Needed after loading a board to have the connectivity database updated.
|
||||
*/
|
||||
void BuildConnectivity();
|
||||
|
||||
|
||||
/**
|
||||
* Function DeleteMARKERs
|
||||
* deletes ALL MARKERS from the board.
|
||||
|
|
|
@ -579,11 +579,8 @@ bool PCB_EDIT_FRAME::OpenProjectFiles( const std::vector<wxString>& aFileSet, in
|
|||
SetCurrentNetClass( NETCLASS::Default );
|
||||
|
||||
// Rebuild list of nets (full ratsnest rebuild)
|
||||
{
|
||||
wxBusyCursor dummy; // Displays an Hourglass while building connectivity
|
||||
Compile_Ratsnest( NULL, true );
|
||||
GetBoard()->GetConnectivity()->Build( GetBoard() );
|
||||
}
|
||||
Compile_Ratsnest( NULL, true );
|
||||
GetBoard()->BuildConnectivity();
|
||||
|
||||
// Update info shown by the horizontal toolbars
|
||||
ReFillLayerWidget();
|
||||
|
|
|
@ -6,9 +6,9 @@ filename=sys.argv[1]
|
|||
|
||||
pcb = LoadBoard(filename)
|
||||
|
||||
for module in pcb.GetModules():
|
||||
for module in pcb.GetModules():
|
||||
print "* Module: %s"%module.GetReference()
|
||||
module.Value().SetVisible(False) # set Value as Hidden
|
||||
module.Reference().SetVisible(True) # set Reference as Visible
|
||||
|
||||
pcb.Save("mod_"+filename)
|
||||
|
||||
SaveBoard("mod_"+filename, pcb)
|
||||
|
|
|
@ -72,12 +72,18 @@ BOARD* LoadBoard( wxString& aFileName )
|
|||
|
||||
BOARD* LoadBoard( wxString& aFileName, IO_MGR::PCB_FILE_T aFormat )
|
||||
{
|
||||
return IO_MGR::Load( aFormat, aFileName );
|
||||
BOARD* brd = IO_MGR::Load( aFormat, aFileName );
|
||||
|
||||
if( brd )
|
||||
brd->BuildConnectivity();
|
||||
|
||||
return brd;
|
||||
}
|
||||
|
||||
|
||||
bool SaveBoard( wxString& aFileName, BOARD* aBoard, IO_MGR::PCB_FILE_T aFormat )
|
||||
{
|
||||
aBoard->BuildConnectivity();
|
||||
aBoard->SynchronizeNetsAndNetClasses();
|
||||
aBoard->GetDesignSettings().SetCurrentNetClass( NETCLASS::Default );
|
||||
|
||||
|
|
Loading…
Reference in New Issue