Eagle PCB import: handle 'roundness' DRC rule (SMD rounded rectangles)
Fixes: lp:1754138 * https://bugs.launchpad.net/kicad/+bug/1754138
This commit is contained in:
parent
5896723c60
commit
d432a985ab
|
@ -135,6 +135,13 @@ void ERULES::parse( wxXmlNode* aRules )
|
||||||
else if( name == "mlMaxCreamFrame" )
|
else if( name == "mlMaxCreamFrame" )
|
||||||
mlMaxCreamFrame = parseEagle( value );
|
mlMaxCreamFrame = parseEagle( value );
|
||||||
|
|
||||||
|
else if( name == "srRoundness" )
|
||||||
|
value.ToDouble( &srRoundness );
|
||||||
|
else if( name == "srMinRoundness" )
|
||||||
|
srMinRoundness = parseEagle( value );
|
||||||
|
else if( name == "srMaxRoundness" )
|
||||||
|
srMaxRoundness = parseEagle( value );
|
||||||
|
|
||||||
else if( name == "rvPadTop" )
|
else if( name == "rvPadTop" )
|
||||||
value.ToDouble( &rvPadTop );
|
value.ToDouble( &rvPadTop );
|
||||||
else if( name == "rlMinPadTop" )
|
else if( name == "rlMinPadTop" )
|
||||||
|
@ -1660,12 +1667,22 @@ void EAGLE_PLUGIN::packageSMD( MODULE* aModule, wxXmlNode* aTree ) const
|
||||||
else if( layer == B_Cu )
|
else if( layer == B_Cu )
|
||||||
pad->SetLayerSet( back );
|
pad->SetLayerSet( back );
|
||||||
|
|
||||||
|
int minPadSize = std::min( padSize.x, padSize.y );
|
||||||
|
|
||||||
// Rounded rectangle pads
|
// Rounded rectangle pads
|
||||||
if( e.roundness )
|
int roundRadius = Clamp( m_rules->srMinRoundness * 2,
|
||||||
|
(int)( minPadSize * m_rules->srRoundness ), m_rules->srMaxRoundness * 2 );
|
||||||
|
|
||||||
|
if( e.roundness || roundRadius > 0 )
|
||||||
{
|
{
|
||||||
|
double roundRatio = (double) roundRadius / minPadSize / 2.0;
|
||||||
|
|
||||||
// Eagle uses a different definition of roundness, hence division by 200
|
// Eagle uses a different definition of roundness, hence division by 200
|
||||||
pad->SetRoundRectRadiusRatio( *e.roundness / 200.0 );
|
if( e.roundness )
|
||||||
|
roundRatio = std::fmax( *e.roundness / 200.0, roundRatio );
|
||||||
|
|
||||||
pad->SetShape( PAD_SHAPE_ROUNDRECT );
|
pad->SetShape( PAD_SHAPE_ROUNDRECT );
|
||||||
|
pad->SetRoundRectRadiusRatio( roundRatio );
|
||||||
}
|
}
|
||||||
|
|
||||||
if( e.rot )
|
if( e.rot )
|
||||||
|
|
|
@ -54,6 +54,10 @@ struct ERULES
|
||||||
int mlMinCreamFrame; ///< solder paste mask, minimum size (Eagle mils, here nanometers)
|
int mlMinCreamFrame; ///< solder paste mask, minimum size (Eagle mils, here nanometers)
|
||||||
int mlMaxCreamFrame; ///< solder paste mask, maximum size (Eagle mils, here nanometers)
|
int mlMaxCreamFrame; ///< solder paste mask, maximum size (Eagle mils, here nanometers)
|
||||||
|
|
||||||
|
double srRoundness; ///< corner rounding ratio for SMD pads (percentage)
|
||||||
|
int srMinRoundness; ///< corner rounding radius, minimum size (Eagle mils, here nanometers)
|
||||||
|
int srMaxRoundness; ///< corner rounding radius, maximum size (Eagle mils, here nanometers)
|
||||||
|
|
||||||
double rvPadTop; ///< top pad size as percent of drill size
|
double rvPadTop; ///< top pad size as percent of drill size
|
||||||
// double rvPadBottom; ///< bottom pad size as percent of drill size
|
// double rvPadBottom; ///< bottom pad size as percent of drill size
|
||||||
|
|
||||||
|
@ -77,6 +81,10 @@ struct ERULES
|
||||||
mlMinCreamFrame ( Mils2iu( 0.0 ) ),
|
mlMinCreamFrame ( Mils2iu( 0.0 ) ),
|
||||||
mlMaxCreamFrame ( Mils2iu( 0.0 ) ),
|
mlMaxCreamFrame ( Mils2iu( 0.0 ) ),
|
||||||
|
|
||||||
|
srRoundness ( 0.0 ),
|
||||||
|
srMinRoundness ( Mils2iu( 0.0 ) ),
|
||||||
|
srMaxRoundness ( Mils2iu( 0.0 ) ),
|
||||||
|
|
||||||
rvPadTop ( 0.25 ),
|
rvPadTop ( 0.25 ),
|
||||||
// rvPadBottom ( 0.25 ),
|
// rvPadBottom ( 0.25 ),
|
||||||
rlMinPadTop ( Mils2iu( 10 ) ),
|
rlMinPadTop ( Mils2iu( 10 ) ),
|
||||||
|
|
Loading…
Reference in New Issue