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:
parent
b3b5ffe799
commit
44e111b37e
|
@ -41,13 +41,15 @@
|
||||||
// the position is relative to a pad with orientation = 0
|
// the position is relative to a pad with orientation = 0
|
||||||
// we can have 1 to 4 chamfered corners (0 corner = roundrect)
|
// we can have 1 to 4 chamfered corners (0 corner = roundrect)
|
||||||
// The position list is the OR of corner to chamfer
|
// The position list is the OR of corner to chamfer
|
||||||
enum RECT_CHAMFER_POSITIONS
|
enum RECT_CHAMFER_POSITIONS : int
|
||||||
{
|
{
|
||||||
RECT_NO_CHAMFER = 0,
|
RECT_NO_CHAMFER = 0,
|
||||||
RECT_CHAMFER_TOP_LEFT = 1,
|
RECT_CHAMFER_TOP_LEFT = 1,
|
||||||
RECT_CHAMFER_TOP_RIGHT = 2,
|
RECT_CHAMFER_TOP_RIGHT = 2,
|
||||||
RECT_CHAMFER_BOTTOM_LEFT = 4,
|
RECT_CHAMFER_BOTTOM_LEFT = 4,
|
||||||
RECT_CHAMFER_BOTTOM_RIGHT = 8,
|
RECT_CHAMFER_BOTTOM_RIGHT = 8,
|
||||||
|
RECT_CHAMFER_ALL = RECT_CHAMFER_BOTTOM_RIGHT | RECT_CHAMFER_BOTTOM_LEFT
|
||||||
|
| RECT_CHAMFER_TOP_RIGHT | RECT_CHAMFER_TOP_LEFT
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -697,8 +697,8 @@ public:
|
||||||
/**
|
/**
|
||||||
* has meaning only for chamfered rect pads
|
* has meaning only for chamfered rect pads
|
||||||
* set the position of the chamfer for a 0 orientation, one of
|
* set the position of the chamfer for a 0 orientation, one of
|
||||||
* PAD_CHAMFER_TOP_LEFT, PAD_CHAMFER_TOP_RIGHT,
|
* RECT_CHAMFER_TOP_LEFT, RECT_CHAMFER_TOP_RIGHT,
|
||||||
* PAD_CHAMFER_BOTTOM_LEFT, PAD_CHAMFER_BOTTOM_RIGHT
|
* RECT_CHAMFER_BOTTOM_LEFT, RECT_CHAMFER_BOTTOM_RIGHT
|
||||||
*/
|
*/
|
||||||
void SetChamferPositions( int aChamferPositions )
|
void SetChamferPositions( int aChamferPositions )
|
||||||
{
|
{
|
||||||
|
|
|
@ -56,13 +56,13 @@ Load() TODO's
|
||||||
#include <wx/xml/xml.h>
|
#include <wx/xml/xml.h>
|
||||||
|
|
||||||
#include <common.h>
|
#include <common.h>
|
||||||
#include <macros.h>
|
#include <convert_basic_shapes_to_polygon.h>
|
||||||
#include <fctsys.h>
|
#include <fctsys.h>
|
||||||
#include <trigo.h>
|
|
||||||
#include <macros.h>
|
|
||||||
#include <geometry/geometry_utils.h>
|
#include <geometry/geometry_utils.h>
|
||||||
#include <kicad_string.h>
|
#include <kicad_string.h>
|
||||||
|
#include <macros.h>
|
||||||
#include <properties.h>
|
#include <properties.h>
|
||||||
|
#include <trigo.h>
|
||||||
#include <wx/filename.h>
|
#include <wx/filename.h>
|
||||||
|
|
||||||
#include <class_board.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->SetDrillSize( wxSize( e.drill.ToPcbUnits(), e.drill.ToPcbUnits() ) );
|
||||||
pad->SetLayerSet( LSET::AllCuMask().set( B_Mask ).set( F_Mask ) );
|
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;
|
e.shape = shape;
|
||||||
|
|
||||||
if( shape == EPAD::OCTAGON )
|
|
||||||
e.shape = EPAD::ROUND;
|
|
||||||
|
|
||||||
if( e.shape )
|
if( e.shape )
|
||||||
{
|
{
|
||||||
switch( *e.shape )
|
switch( *e.shape )
|
||||||
{
|
{
|
||||||
case EPAD::ROUND:
|
case EPAD::ROUND:
|
||||||
wxASSERT( pad->GetShape() == PAD_SHAPE_CIRCLE ); // verify set in D_PAD constructor
|
pad->SetShape( PAD_SHAPE_CIRCLE );
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case EPAD::OCTAGON:
|
case EPAD::OCTAGON:
|
||||||
// no KiCad octagonal pad shape, use PAD_CIRCLE for now.
|
// no KiCad octagonal pad shape, use PAD_CIRCLE for now.
|
||||||
// pad->SetShape( PAD_OCTAGON );
|
// pad->SetShape( PAD_OCTAGON );
|
||||||
wxASSERT( pad->GetShape() == PAD_SHAPE_CIRCLE ); // verify set in D_PAD constructor
|
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;
|
break;
|
||||||
|
|
||||||
case EPAD::LONG:
|
case EPAD::LONG:
|
||||||
|
@ -1483,7 +1483,8 @@ void EAGLE_PLUGIN::packagePad( MODULE* aModule, wxXmlNode* aTree ) const
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case EPAD::OFFSET:
|
case EPAD::OFFSET:
|
||||||
; // don't know what to do here.
|
pad->SetShape( PAD_SHAPE_OVAL );
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
@ -1512,6 +1513,12 @@ void EAGLE_PLUGIN::packagePad( MODULE* aModule, wxXmlNode* aTree ) const
|
||||||
wxSize sz = pad->GetSize();
|
wxSize sz = pad->GetSize();
|
||||||
sz.x = ( sz.x * ( 100 + m_rules->psElongationLong ) ) / 100;
|
sz.x = ( sz.x * ( 100 + m_rules->psElongationLong ) ) / 100;
|
||||||
pad->SetSize( sz );
|
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 )
|
if( e.rot )
|
||||||
|
|
Loading…
Reference in New Issue