diff --git a/include/convert_basic_shapes_to_polygon.h b/include/convert_basic_shapes_to_polygon.h index 2755a0a431..806cec8394 100644 --- a/include/convert_basic_shapes_to_polygon.h +++ b/include/convert_basic_shapes_to_polygon.h @@ -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 }; diff --git a/pcbnew/class_pad.h b/pcbnew/class_pad.h index 50ddc972c6..05244e5ade 100644 --- a/pcbnew/class_pad.h +++ b/pcbnew/class_pad.h @@ -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 ) { diff --git a/pcbnew/eagle_plugin.cpp b/pcbnew/eagle_plugin.cpp index 97d0cb6976..3c0bc8e3b6 100644 --- a/pcbnew/eagle_plugin.cpp +++ b/pcbnew/eagle_plugin.cpp @@ -56,13 +56,13 @@ Load() TODO's #include #include -#include +#include #include -#include -#include #include #include +#include #include +#include #include #include @@ -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 )