pcbnew: Add remaining Eagle pad types

This adds octagon and offset pad types to the Eagle pcb importer.

Fixes: lp:1814498
* https://bugs.launchpad.net/kicad/+bug/1814498
This commit is contained in:
Seth Hillbrand 2019-05-14 23:11:30 -07:00
parent b3b5ffe799
commit 44e111b37e
3 changed files with 21 additions and 12 deletions

View File

@ -41,13 +41,15 @@
// the position is relative to a pad with orientation = 0
// we can have 1 to 4 chamfered corners (0 corner = roundrect)
// The position list is the OR of corner to chamfer
enum RECT_CHAMFER_POSITIONS
enum RECT_CHAMFER_POSITIONS : int
{
RECT_NO_CHAMFER = 0,
RECT_CHAMFER_TOP_LEFT = 1,
RECT_CHAMFER_TOP_RIGHT = 2,
RECT_CHAMFER_BOTTOM_LEFT = 4,
RECT_CHAMFER_BOTTOM_RIGHT = 8,
RECT_CHAMFER_ALL = RECT_CHAMFER_BOTTOM_RIGHT | RECT_CHAMFER_BOTTOM_LEFT
| RECT_CHAMFER_TOP_RIGHT | RECT_CHAMFER_TOP_LEFT
};

View File

@ -697,8 +697,8 @@ public:
/**
* has meaning only for chamfered rect pads
* set the position of the chamfer for a 0 orientation, one of
* PAD_CHAMFER_TOP_LEFT, PAD_CHAMFER_TOP_RIGHT,
* PAD_CHAMFER_BOTTOM_LEFT, PAD_CHAMFER_BOTTOM_RIGHT
* RECT_CHAMFER_TOP_LEFT, RECT_CHAMFER_TOP_RIGHT,
* RECT_CHAMFER_BOTTOM_LEFT, RECT_CHAMFER_BOTTOM_RIGHT
*/
void SetChamferPositions( int aChamferPositions )
{

View File

@ -56,13 +56,13 @@ Load() TODO's
#include <wx/xml/xml.h>
#include <common.h>
#include <macros.h>
#include <convert_basic_shapes_to_polygon.h>
#include <fctsys.h>
#include <trigo.h>
#include <macros.h>
#include <geometry/geometry_utils.h>
#include <kicad_string.h>
#include <macros.h>
#include <properties.h>
#include <trigo.h>
#include <wx/filename.h>
#include <class_board.h>
@ -1454,24 +1454,24 @@ void EAGLE_PLUGIN::packagePad( MODULE* aModule, wxXmlNode* aTree ) const
pad->SetDrillSize( wxSize( e.drill.ToPcbUnits(), e.drill.ToPcbUnits() ) );
pad->SetLayerSet( LSET::AllCuMask().set( B_Mask ).set( F_Mask ) );
if( shape == EPAD::ROUND || shape == EPAD::SQUARE )
if( shape == EPAD::ROUND || shape == EPAD::SQUARE || shape == EPAD::OCTAGON )
e.shape = shape;
if( shape == EPAD::OCTAGON )
e.shape = EPAD::ROUND;
if( e.shape )
{
switch( *e.shape )
{
case EPAD::ROUND:
wxASSERT( pad->GetShape() == PAD_SHAPE_CIRCLE ); // verify set in D_PAD constructor
pad->SetShape( PAD_SHAPE_CIRCLE );
break;
case EPAD::OCTAGON:
// no KiCad octagonal pad shape, use PAD_CIRCLE for now.
// pad->SetShape( PAD_OCTAGON );
wxASSERT( pad->GetShape() == PAD_SHAPE_CIRCLE ); // verify set in D_PAD constructor
pad->SetShape( PAD_SHAPE_CHAMFERED_RECT );
pad->SetChamferPositions( RECT_CHAMFER_ALL );
pad->SetChamferRectRatio( 0.25 );
break;
case EPAD::LONG:
@ -1483,7 +1483,8 @@ void EAGLE_PLUGIN::packagePad( MODULE* aModule, wxXmlNode* aTree ) const
break;
case EPAD::OFFSET:
; // don't know what to do here.
pad->SetShape( PAD_SHAPE_OVAL );
break;
}
}
else
@ -1512,6 +1513,12 @@ void EAGLE_PLUGIN::packagePad( MODULE* aModule, wxXmlNode* aTree ) const
wxSize sz = pad->GetSize();
sz.x = ( sz.x * ( 100 + m_rules->psElongationLong ) ) / 100;
pad->SetSize( sz );
if( e.shape && *e.shape == EPAD::OFFSET )
{
int offset = KiROUND( ( sz.x - sz.y ) / 2.0 );
pad->SetOffset( wxPoint( offset, 0 ) );
}
}
if( e.rot )