Eagle PCB import: handle solder mask & paste for pads

Fixes: lp:1754138
* https://bugs.launchpad.net/kicad/+bug/1754138
This commit is contained in:
Maciej Suminski 2018-03-13 14:42:01 +01:00
parent 4055c435a5
commit aeb999b9ae
2 changed files with 44 additions and 2 deletions

View File

@ -121,6 +121,20 @@ void ERULES::parse( wxXmlNode* aRules )
psElongationLong = wxAtoi( value );
else if( name == "psElongationOffset" )
psElongationOffset = wxAtoi( value );
else if( name == "mvStopFrame" )
value.ToDouble( &mvStopFrame );
else if( name == "mvCreamFrame" )
value.ToDouble( &mvCreamFrame );
else if( name == "mlMinStopFrame" )
mlMinStopFrame = parseEagle( value );
else if( name == "mlMaxStopFrame" )
mlMaxStopFrame = parseEagle( value );
else if( name == "mlMinCreamFrame" )
mlMinCreamFrame = parseEagle( value );
else if( name == "mlMaxCreamFrame" )
mlMaxCreamFrame = parseEagle( value );
else if( name == "rvPadTop" )
value.ToDouble( &rvPadTop );
else if( name == "rlMinPadTop" )
@ -1634,7 +1648,8 @@ void EAGLE_PLUGIN::packageSMD( MODULE* aModule, wxXmlNode* aTree ) const
pad->SetShape( PAD_SHAPE_RECT );
pad->SetAttribute( PAD_ATTRIB_SMD );
pad->SetSize( wxSize( e.dx.ToPcbUnits(), e.dy.ToPcbUnits() ) );
wxSize padSize( e.dx.ToPcbUnits(), e.dy.ToPcbUnits() );
pad->SetSize( padSize );
pad->SetLayer( layer );
const LSET front( 3, F_Cu, F_Paste, F_Mask );
@ -1658,8 +1673,14 @@ void EAGLE_PLUGIN::packageSMD( MODULE* aModule, wxXmlNode* aTree ) const
pad->SetOrientation( e.rot->degrees * 10 );
}
// don't know what stop, thermals, and cream should look like now.
// Solder paste (only for SMD pads)
int solderPasteSize = m_rules->mvCreamFrame * std::min( padSize.x, padSize.y );
solderPasteSize = std::min( solderPasteSize, m_rules->mlMaxCreamFrame );
solderPasteSize = std::max( solderPasteSize, m_rules->mlMinCreamFrame );
pad->SetLocalSolderPasteMargin( solderPasteSize );
// @todo: handle thermal
}
void EAGLE_PLUGIN::transferPad( const EPAD_COMMON& aEaglePad, D_PAD* aPad ) const
@ -1671,6 +1692,13 @@ void EAGLE_PLUGIN::transferPad( const EPAD_COMMON& aEaglePad, D_PAD* aPad ) cons
wxPoint padPos( kicad_x( aEaglePad.x ), kicad_y( aEaglePad.y ) );
aPad->SetPos0( padPos );
// Solder mask
const wxSize& padSize( aPad->GetSize() );
int solderMaskSize = m_rules->mvStopFrame * std::min( padSize.x, padSize.y );
solderMaskSize = std::min( solderMaskSize, m_rules->mlMaxStopFrame );
solderMaskSize = std::max( solderMaskSize, m_rules->mlMinStopFrame );
aPad->SetLocalSolderMaskMargin( solderMaskSize );
MODULE* module = aPad->GetParent();
wxCHECK( module, /* void */ );
RotatePoint( &padPos, module->GetOrientation() );

View File

@ -47,6 +47,12 @@ struct ERULES
int psElongationOffset; ///< the offset of the hole within the "long" pad.
double mvStopFrame; ///< solder mask, expressed as percentage of the smaller pad/via dimension
double mvCreamFrame; ///< solderpaste mask, expressed as percentage of the smaller pad/via dimension
int mlMinStopFrame; ///< solder mask, minimum size (mils)
int mlMaxStopFrame; ///< solder mask, maximum size (mils)
int mlMinCreamFrame; ///< solder paste mask, minimum size (mils)
int mlMaxCreamFrame; ///< solder paste mask, maximum size (mils)
double rvPadTop; ///< top pad size as percent of drill size
// double rvPadBottom; ///< bottom pad size as percent of drill size
@ -63,6 +69,14 @@ struct ERULES
ERULES() :
psElongationLong ( 100 ),
psElongationOffset ( 0 ),
mvStopFrame ( 1.0 ),
mvCreamFrame ( 0.0 ),
mlMinStopFrame ( Mils2iu( 4.0 ) ),
mlMaxStopFrame ( Mils2iu( 4.0 ) ),
mlMinCreamFrame ( Mils2iu( 0.0 ) ),
mlMaxCreamFrame ( Mils2iu( 0.0 ) ),
rvPadTop ( 0.25 ),
// rvPadBottom ( 0.25 ),
rlMinPadTop ( Mils2iu( 10 ) ),