From c23c5b7f18c8016ebb90e5fe001a8bfc42b00f21 Mon Sep 17 00:00:00 2001 From: Jeff Young Date: Wed, 16 Jun 2021 22:02:50 +0100 Subject: [PATCH] Allow import of Eagle schematics without libraries. --- .../sch_plugins/eagle/sch_eagle_plugin.cpp | 24 ++++++++++--------- 1 file changed, 13 insertions(+), 11 deletions(-) diff --git a/eeschema/sch_plugins/eagle/sch_eagle_plugin.cpp b/eeschema/sch_plugins/eagle/sch_eagle_plugin.cpp index f7f7b50927..8d3fda1163 100644 --- a/eeschema/sch_plugins/eagle/sch_eagle_plugin.cpp +++ b/eeschema/sch_plugins/eagle/sch_eagle_plugin.cpp @@ -559,7 +559,7 @@ void SCH_EAGLE_PLUGIN::loadSchematic( wxXmlNode* aSchematicNode ) wxXmlNode* libraryNode = getChildrenNodes( schematicChildren, "libraries" ); wxXmlNode* sheetNode = getChildrenNodes( schematicChildren, "sheets" ); - if( !partNode || !libraryNode || !sheetNode ) + if( !sheetNode ) return; while( partNode ) @@ -571,22 +571,24 @@ void SCH_EAGLE_PLUGIN::loadSchematic( wxXmlNode* aSchematicNode ) partNode = partNode->GetNext(); } - // Loop through all the libraries - while( libraryNode ) + if( libraryNode ) { - // Read the library name - wxString libName = libraryNode->GetAttribute( "name" ); + while( libraryNode ) + { + // Read the library name + wxString libName = libraryNode->GetAttribute( "name" ); - EAGLE_LIBRARY* elib = &m_eagleLibs[libName]; - elib->name = libName; + EAGLE_LIBRARY* elib = &m_eagleLibs[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. // local labels will be used for nets found only on that sheet. countNets( aSchematicNode );