Eeschema: speed up netlist creation.

This commit is contained in:
jean-pierre charras 2017-04-12 08:18:46 +02:00
parent 57ded58231
commit 02abf18046
4 changed files with 22 additions and 14 deletions

View File

@ -55,8 +55,13 @@ int TestDuplicateSheetNames( bool aCreateMarker );
bool SCH_EDIT_FRAME::prepareForNetlist()
{
SCH_SHEET_LIST sheets( g_RootSheet );
SCH_SCREENS schematic;
// Ensure all symbol library links for all sheets valid:
schematic.UpdateSymbolLinks();
// Ensure all power symbols have a valid reference
SCH_SHEET_LIST sheets( g_RootSheet );
sheets.AnnotatePowerSymbols( Prj().SchLibs() );
// Performs some controls:
@ -79,9 +84,7 @@ bool SCH_EDIT_FRAME::prepareForNetlist()
}
// Cleanup the entire hierarchy
SCH_SCREENS screens;
screens.SchematicCleanUp();
schematic.SchematicCleanUp();
return true;
}

View File

@ -1,7 +1,7 @@
/*
* This program source code file is part of KiCad, a free EDA CAD application.
*
* Copyright (C) 1992-2013 jp.charras at wanadoo.fr
* Copyright (C) 1992-2017 jp.charras at wanadoo.fr
* Copyright (C) 2013 SoftPLC Corporation, Dick Hollenbeck <dick@softplc.com>
* Copyright (C) 1992-2017 KiCad Developers, see AUTHORS.TXT for contributors.
*
@ -116,6 +116,7 @@ SCH_COMPONENT* NETLIST_EXPORTER::findNextComponent( EDA_ITEM* aItem, SCH_SHEET_P
// Power symbols and other components which have the reference starting
// with "#" are not included in netlist (pseudo or virtual components)
ref = comp->GetRef( aSheetPath );
if( ref[0] == wxChar( '#' ) )
continue;
@ -125,7 +126,8 @@ SCH_COMPONENT* NETLIST_EXPORTER::findNextComponent( EDA_ITEM* aItem, SCH_SHEET_P
// (several sheets pointing to 1 screen), this will be erroneously be
// toggled.
LIB_PART* part = m_libs->FindLibPart( comp->GetLibId() );
LIB_PART* part = comp->GetPartRef().lock().get();
if( !part )
continue;
@ -184,7 +186,7 @@ SCH_COMPONENT* NETLIST_EXPORTER::findNextComponentAndCreatePinList( EDA_ITEM*
// (several sheets pointing to 1 screen), this will be erroneously be
// toggled.
LIB_PART* part = m_libs->FindLibPart( comp->GetLibId() );
LIB_PART* part = comp->GetPartRef().lock().get();
if( !part )
continue;

View File

@ -1,9 +1,9 @@
/*
* This program source code file is part of KiCad, a free EDA CAD application.
*
* Copyright (C) 2009 Jean-Pierre Charras, jaen-pierre.charras@gipsa-lab.inpg.com
* Copyright (C) 2011-2016 Wayne Stambaugh <stambaughw@verizon.net>
* Copyright (C) 1992-2016 KiCad Developers, see AUTHORS.txt for contributors.
* Copyright (C) 2017 Jean-Pierre Charras, jp.charras at wanadoo.fr
* Copyright (C) 2011-2017 Wayne Stambaugh <stambaughw@verizon.net>
* Copyright (C) 1992-2017 KiCad Developers, see AUTHORS.txt for contributors.
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
@ -194,7 +194,7 @@ void SCH_SHEET_PATH::AnnotatePowerSymbols( PART_LIBS* aLibs, int* aReference )
continue;
SCH_COMPONENT* component = (SCH_COMPONENT*) item;
LIB_PART* part = aLibs->FindLibPart( component->GetLibId() );
LIB_PART* part = component->GetPartRef().lock().get();
if( !part || !part->IsPower() )
continue;
@ -232,7 +232,7 @@ void SCH_SHEET_PATH::GetComponents( PART_LIBS* aLibs, SCH_REFERENCE_LIST& aRefer
if( !aIncludePowerSymbols && component->GetRef( this )[0] == wxT( '#' ) )
continue;
LIB_PART* part = aLibs->FindLibPart( component->GetLibId() );
LIB_PART* part = component->GetPartRef().lock().get();
if( part )
{
@ -263,7 +263,7 @@ void SCH_SHEET_PATH::GetMultiUnitComponents( PART_LIBS* aLibs,
if( !aIncludePowerSymbols && component->GetRef( this )[0] == wxT( '#' ) )
continue;
LIB_PART* part = aLibs->FindLibPart( component->GetLibId() );
LIB_PART* part = component->GetPartRef().lock().get();
if( part && part->GetUnitCount() > 1 )
{

View File

@ -111,7 +111,10 @@ public:
std::chrono::duration<double, std::milli> elapsed = display_stoptime - m_starttime;
wxString msg;
msg << m_name << " took " << elapsed.count() << " ms.";
if( elapsed.count() < 1000.0 )
msg << m_name << " took " << elapsed.count() << " ms.";
else
msg << m_name << " took " << elapsed.count()/1000.0 << " sec.";
wxLogMessage( msg );
}