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
|
const wxPoint& BOARD::GetPosition() const
|
||||||
{
|
{
|
||||||
wxLogWarning( wxT( "This should not be called on the BOARD object") );
|
wxLogWarning( wxT( "This should not be called on the BOARD object") );
|
||||||
|
|
|
@ -292,6 +292,14 @@ public:
|
||||||
return m_connectivity;
|
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
|
* Function DeleteMARKERs
|
||||||
* deletes ALL MARKERS from the board.
|
* deletes ALL MARKERS from the board.
|
||||||
|
|
|
@ -579,11 +579,8 @@ bool PCB_EDIT_FRAME::OpenProjectFiles( const std::vector<wxString>& aFileSet, in
|
||||||
SetCurrentNetClass( NETCLASS::Default );
|
SetCurrentNetClass( NETCLASS::Default );
|
||||||
|
|
||||||
// Rebuild list of nets (full ratsnest rebuild)
|
// Rebuild list of nets (full ratsnest rebuild)
|
||||||
{
|
Compile_Ratsnest( NULL, true );
|
||||||
wxBusyCursor dummy; // Displays an Hourglass while building connectivity
|
GetBoard()->BuildConnectivity();
|
||||||
Compile_Ratsnest( NULL, true );
|
|
||||||
GetBoard()->GetConnectivity()->Build( GetBoard() );
|
|
||||||
}
|
|
||||||
|
|
||||||
// Update info shown by the horizontal toolbars
|
// Update info shown by the horizontal toolbars
|
||||||
ReFillLayerWidget();
|
ReFillLayerWidget();
|
||||||
|
|
|
@ -6,9 +6,9 @@ filename=sys.argv[1]
|
||||||
|
|
||||||
pcb = LoadBoard(filename)
|
pcb = LoadBoard(filename)
|
||||||
|
|
||||||
for module in pcb.GetModules():
|
for module in pcb.GetModules():
|
||||||
print "* Module: %s"%module.GetReference()
|
print "* Module: %s"%module.GetReference()
|
||||||
module.Value().SetVisible(False) # set Value as Hidden
|
module.Value().SetVisible(False) # set Value as Hidden
|
||||||
module.Reference().SetVisible(True) # set Reference as Visible
|
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 )
|
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 )
|
bool SaveBoard( wxString& aFileName, BOARD* aBoard, IO_MGR::PCB_FILE_T aFormat )
|
||||||
{
|
{
|
||||||
|
aBoard->BuildConnectivity();
|
||||||
aBoard->SynchronizeNetsAndNetClasses();
|
aBoard->SynchronizeNetsAndNetClasses();
|
||||||
aBoard->GetDesignSettings().SetCurrentNetClass( NETCLASS::Default );
|
aBoard->GetDesignSettings().SetCurrentNetClass( NETCLASS::Default );
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue