Allow import of Eagle schematics without libraries.

This commit is contained in:
Jeff Young 2021-06-16 22:02:50 +01:00
parent 4b28bac89a
commit c23c5b7f18
1 changed files with 13 additions and 11 deletions

View File

@ -559,7 +559,7 @@ void SCH_EAGLE_PLUGIN::loadSchematic( wxXmlNode* aSchematicNode )
wxXmlNode* libraryNode = getChildrenNodes( schematicChildren, "libraries" ); wxXmlNode* libraryNode = getChildrenNodes( schematicChildren, "libraries" );
wxXmlNode* sheetNode = getChildrenNodes( schematicChildren, "sheets" ); wxXmlNode* sheetNode = getChildrenNodes( schematicChildren, "sheets" );
if( !partNode || !libraryNode || !sheetNode ) if( !sheetNode )
return; return;
while( partNode ) while( partNode )
@ -571,22 +571,24 @@ void SCH_EAGLE_PLUGIN::loadSchematic( wxXmlNode* aSchematicNode )
partNode = partNode->GetNext(); partNode = partNode->GetNext();
} }
// Loop through all the libraries if( libraryNode )
while( libraryNode )
{ {
// Read the library name while( libraryNode )
wxString libName = libraryNode->GetAttribute( "name" ); {
// Read the library name
wxString libName = libraryNode->GetAttribute( "name" );
EAGLE_LIBRARY* elib = &m_eagleLibs[libName]; EAGLE_LIBRARY* elib = &m_eagleLibs[libName];
elib->name = libName; elib->name = libName;
loadLibrary( libraryNode, &m_eagleLibs[libName] ); loadLibrary( libraryNode, &m_eagleLibs[libName] );
libraryNode = libraryNode->GetNext(); libraryNode = libraryNode->GetNext();
}
m_pi->SaveLibrary( getLibFileName().GetFullPath() );
} }
m_pi->SaveLibrary( getLibFileName().GetFullPath() );
// find all nets and count how many sheets they appear on. // find all nets and count how many sheets they appear on.
// local labels will be used for nets found only on that sheet. // local labels will be used for nets found only on that sheet.
countNets( aSchematicNode ); countNets( aSchematicNode );