diff --git a/pcbnew/eagle_plugin.cpp b/pcbnew/eagle_plugin.cpp index c3abe8d383..baf47e9cb8 100644 --- a/pcbnew/eagle_plugin.cpp +++ b/pcbnew/eagle_plugin.cpp @@ -689,7 +689,7 @@ void EAGLE_PLUGIN::loadPlain( wxXmlNode* aGraphics ) module->SetReference( wxString::Format( "@HOLE%d", m_hole_count++ ) ); module->Reference().SetVisible( false ); - packageHole( module, gr ); + packageHole( module, gr, true ); m_xpath->pop(); } @@ -1372,7 +1372,7 @@ MODULE* EAGLE_PLUGIN::makeModule( wxXmlNode* aPackage, const wxString& aPkgName packageCircle( m.get(), packageItem ); else if( itemName == "hole" ) - packageHole( m.get(), packageItem ); + packageHole( m.get(), packageItem, false ); else if( itemName == "smd" ) packageSMD( m.get(), packageItem ); @@ -1785,7 +1785,7 @@ void EAGLE_PLUGIN::packageCircle( MODULE* aModule, wxXmlNode* aTree ) const } -void EAGLE_PLUGIN::packageHole( MODULE* aModule, wxXmlNode* aTree ) const +void EAGLE_PLUGIN::packageHole( MODULE* aModule, wxXmlNode* aTree, bool aCenter ) const { EHOLE e( aTree ); @@ -1803,8 +1803,17 @@ void EAGLE_PLUGIN::packageHole( MODULE* aModule, wxXmlNode* aTree ) const wxPoint padpos( kicad_x( e.x ), kicad_y( e.y ) ); - pad->SetPos0( padpos ); - pad->SetPosition( padpos + aModule->GetPosition() ); + if( aCenter ) + { + pad->SetPos0( wxPoint( 0, 0 ) ); + aModule->SetPosition( padpos ); + pad->SetPosition( padpos ); + } + else + { + pad->SetPos0( padpos ); + pad->SetPosition( padpos + aModule->GetPosition() ); + } wxSize sz( e.drill.ToPcbUnits(), e.drill.ToPcbUnits() ); diff --git a/pcbnew/eagle_plugin.h b/pcbnew/eagle_plugin.h index b945f5ea71..e3df6d5355 100644 --- a/pcbnew/eagle_plugin.h +++ b/pcbnew/eagle_plugin.h @@ -266,7 +266,15 @@ private: void packageRectangle( MODULE* aModule, wxXmlNode* aTree ) const; void packagePolygon( MODULE* aModule, wxXmlNode* aTree ) const; void packageCircle( MODULE* aModule, wxXmlNode* aTree ) const; - void packageHole( MODULE* aModule, wxXmlNode* aTree ) const; + + /** + * Function packageHole + * @parameter aModule - The KiCad module to which to assign the hole + * @parameter aTree - The Eagle XML node that is of type "hole" + * @parameter aCenter - If true, center the hole in the module and + * offset the module position + */ + void packageHole( MODULE* aModule, wxXmlNode* aTree, bool aCenter ) const; void packageSMD( MODULE* aModule, wxXmlNode* aTree ) const; ///> Handles common pad properties