From 2523c6b5d79ddea51cfe875f8659d6ceb737268f Mon Sep 17 00:00:00 2001 From: Russell Oliver Date: Thu, 6 Jul 2017 21:54:38 +1000 Subject: [PATCH] Eeeschema Eagle Plugin: Set footprint field using Eagle device package value. --- eeschema/sch_eagle_plugin.cpp | 4 ++++ eeschema/sch_eagle_plugin.h | 1 + 2 files changed, 5 insertions(+) diff --git a/eeschema/sch_eagle_plugin.cpp b/eeschema/sch_eagle_plugin.cpp index ae5a83ce12..414eccfff3 100644 --- a/eeschema/sch_eagle_plugin.cpp +++ b/eeschema/sch_eagle_plugin.cpp @@ -28,6 +28,7 @@ #include #include +#include #include #include #include @@ -617,6 +618,7 @@ void SCH_EAGLE_PLUGIN::loadInstance( wxXmlNode* aInstanceNode ) //std::cout << gatename << '\n'; //std::cout << "Gate to unit number " << m_eaglelibraries[epart->library]->gate_unit[gatename] << '\n'; int unit = m_eaglelibraries[epart->library]->gate_unit[gatename]; + std::string package = m_eaglelibraries[epart->library]->package[symbolname]; //LIB_PART* part = m_eaglelibraries[epart->library]->kicadsymbols[symbolname]; @@ -630,6 +632,7 @@ void SCH_EAGLE_PLUGIN::loadInstance( wxXmlNode* aInstanceNode ) component->SetUnit( unit ); component->SetConvert( 0 ); component->SetPosition( wxPoint( einstance.x * EUNIT_TO_MIL, -einstance.y * EUNIT_TO_MIL ) ); + component->GetField( FOOTPRINT )->SetText( wxString(package) ); //component->SetTimeStamp( parseHex( aReader, line, &line ) ); // TODO we need to find a way // to correlate symbols and footprints //component->AddHierarchicalReference( path, reference, (int)tmp ); // TODO ?? @@ -716,6 +719,7 @@ EAGLE_LIBRARY* SCH_EAGLE_PLUGIN::loadLibrary( wxXmlNode* aLibraryNode ) // Create symbol name from deviceset and device names. wxString symbolName = wxString( edeviceset.name+ edevice.name); ////std::cout << "Creating Kicad Symbol: " << symbolName.ToStdString() << '\n'; + elib.get()->package[symbolName.ToStdString()] = edevice.package.Get(); // Create kicad symbol. unique_ptr kpart ( new LIB_PART(symbolName)); diff --git a/eeschema/sch_eagle_plugin.h b/eeschema/sch_eagle_plugin.h index a0a137cc6b..bdc6b58f8d 100644 --- a/eeschema/sch_eagle_plugin.h +++ b/eeschema/sch_eagle_plugin.h @@ -69,6 +69,7 @@ typedef struct EAGLE_LIBRARY std::unordered_map kicadsymbols; std::unordered_map symbolnodes; std::unordered_map gate_unit; + std::unordered_map package; } EAGLE_LIBRARY;