Fix bug caused by setting default drill size in D_PAD (fixes lp:1123392).

* Add check for pad type and force drill size to zero if pad is surface
  mount in PCB_PARSER.
* Modify the D_PAD SetAttribute method to clear drill size if pad type is
  set to surface mount.
This commit is contained in:
Wayne Stambaugh 2013-02-12 20:01:22 -05:00
parent e1addadb4d
commit 330b8bff30
3 changed files with 22 additions and 2 deletions

View File

@ -135,6 +135,15 @@ EDA_RECT D_PAD::GetBoundingBox() const
} }
void D_PAD::SetAttribute( PAD_ATTR_T aAttribute )
{
m_Attribute = aAttribute;
if( aAttribute == PAD_SMD )
m_Drill = wxSize( 0, 0 );
}
void D_PAD::SetOrientation( double aAngle ) void D_PAD::SetOrientation( double aAngle )
{ {
NORMALIZE_ANGLE_POS( aAngle ); NORMALIZE_ANGLE_POS( aAngle );

View File

@ -189,7 +189,7 @@ public:
void SetLayerMask( int aLayerMask ) { m_layerMask = aLayerMask; } void SetLayerMask( int aLayerMask ) { m_layerMask = aLayerMask; }
int GetLayerMask() const { return m_layerMask; } int GetLayerMask() const { return m_layerMask; }
void SetAttribute( PAD_ATTR_T aAttribute ) { m_Attribute = aAttribute; } void SetAttribute( PAD_ATTR_T aAttribute );
PAD_ATTR_T GetAttribute() const { return m_Attribute; } PAD_ATTR_T GetAttribute() const { return m_Attribute; }
void SetPadToDieLength( int aLength ) { m_LengthPadToDie = aLength; } void SetPadToDieLength( int aLength ) { m_LengthPadToDie = aLength; }

View File

@ -2002,6 +2002,9 @@ D_PAD* PCB_PARSER::parseD_PAD() throw( IO_ERROR, PARSE_ERROR )
case T_smd: case T_smd:
pad->SetAttribute( PAD_SMD ); pad->SetAttribute( PAD_SMD );
// Default D_PAD object is thru hole with drill.
pad->SetDrillSize( wxSize( 0, 0 ) );
break; break;
case T_connect: case T_connect:
@ -2130,7 +2133,15 @@ D_PAD* PCB_PARSER::parseD_PAD() throw( IO_ERROR, PARSE_ERROR )
} }
} }
pad->SetDrillSize( drillSize ); // This fixes a bug caused by setting the default D_PAD drill size to a value
// other than 0 used to fix a bunch of debug assertions even though it is defined
// as a through hole pad. Wouldn't a though hole pad with no drill be a surface
// mount pad?
if( pad->GetAttribute() != PAD_SMD )
pad->SetDrillSize( drillSize );
else
pad->SetDrillSize( wxSize( 0, 0 ) );
break; break;
} }