More source reporting for clearance rules.

This commit is contained in:
Jeff Young 2020-09-10 19:35:11 +01:00
parent 2a2b842707
commit e31705d4b3
10 changed files with 100 additions and 41 deletions

View File

@ -748,36 +748,62 @@ wxSize D_PAD::GetSolderPasteMargin() const
}
ZONE_CONNECTION D_PAD::GetEffectiveZoneConnection() const
ZONE_CONNECTION D_PAD::GetEffectiveZoneConnection( wxString* aSource ) const
{
MODULE* module = GetParent();
if( m_zoneConnection == ZONE_CONNECTION::INHERITED && module )
{
if( aSource )
*aSource = _( "parent footprint" );
return module->GetZoneConnection();
}
else
{
if( aSource )
*aSource = _( "pad" );
return m_zoneConnection;
}
}
int D_PAD::GetThermalWidth() const
int D_PAD::GetEffectiveThermalSpokeWidth( wxString* aSource ) const
{
MODULE* module = GetParent();
if( m_thermalWidth == 0 && module )
{
if( aSource )
*aSource = _( "parent footprint" );
return module->GetThermalWidth();
else
return m_thermalWidth;
}
if( aSource )
*aSource = _( "pad" );
return m_thermalWidth;
}
int D_PAD::GetThermalGap() const
int D_PAD::GetEffectiveThermalGap( wxString* aSource ) const
{
MODULE* module = GetParent();
if( m_thermalGap == 0 && module )
{
if( aSource )
*aSource = _( "parent footprint" );
return module->GetThermalGap();
else
return m_thermalGap;
}
if( aSource )
*aSource = _( "pad" );
return m_thermalGap;
}
@ -1300,7 +1326,7 @@ void D_PAD::ImportSettingsFrom( const D_PAD& aMasterPad )
SetLocalSolderPasteMarginRatio( aMasterPad.GetLocalSolderPasteMarginRatio() );
SetZoneConnection( aMasterPad.GetEffectiveZoneConnection() );
SetThermalWidth( aMasterPad.GetThermalWidth() );
SetThermalSpokeWidth( aMasterPad.GetThermalSpokeWidth() );
SetThermalGap( aMasterPad.GetThermalGap() );
SetCustomShapeInZoneOpt( aMasterPad.GetCustomShapeInZoneOpt() );
@ -1367,10 +1393,10 @@ static struct PAD_DESC
PROPERTY_DISPLAY::DISTANCE ) );
propMgr.AddProperty( new PROPERTY<D_PAD, double>( _( "Local Solderpaste Margin Ratio" ),
&D_PAD::SetLocalSolderPasteMarginRatio, &D_PAD::GetLocalSolderPasteMarginRatio ) );
propMgr.AddProperty( new PROPERTY<D_PAD, int>( _( "Thermal Width" ),
&D_PAD::SetThermalWidth, &D_PAD::GetThermalWidth,
propMgr.AddProperty( new PROPERTY<D_PAD, int>( _( "Thermal Relief Spoke Width" ),
&D_PAD::SetThermalSpokeWidth, &D_PAD::GetThermalSpokeWidth,
PROPERTY_DISPLAY::DISTANCE ) );
propMgr.AddProperty( new PROPERTY<D_PAD, int>( _( "Thermal Gap" ),
propMgr.AddProperty( new PROPERTY<D_PAD, int>( _( "Thermal Relief" ),
&D_PAD::SetThermalGap, &D_PAD::GetThermalGap,
PROPERTY_DISPLAY::DISTANCE ) );
propMgr.AddProperty( new PROPERTY_ENUM<D_PAD, PAD_PROP_T>( _( "Fabrication Property" ),

View File

@ -444,19 +444,30 @@ public:
/**
* Return the zone connection in effect (either locally overridden or overridden in the
* parent module).
* Optionally reports on the source of the property (pad, parent footprint or zone).
*/
ZONE_CONNECTION GetEffectiveZoneConnection() const;
ZONE_CONNECTION GetEffectiveZoneConnection( wxString* aSource = nullptr ) const;
/**
* Set the width of the thermal spokes connecting the pad to a zone. If != 0 this will
* override similar settings in the parent footprint and zone.
* @param aWidth
*/
void SetThermalWidth( int aWidth ) { m_thermalWidth = aWidth; }
int GetThermalWidth() const;
void SetThermalSpokeWidth( int aWidth ) { m_thermalWidth = aWidth; }
int GetThermalSpokeWidth() const { return m_thermalWidth; }
/**
* Return the effective thermal spoke width having resolved any inheritance.
*/
int GetEffectiveThermalSpokeWidth( wxString* aSource = nullptr ) const;
void SetThermalGap( int aGap ) { m_thermalGap = aGap; }
int GetThermalGap() const;
int GetThermalGap() const { return m_thermalGap; }
/**
* Return the effective thermal gap having resolved any inheritance.
*/
int GetEffectiveThermalGap( wxString* aSource = nullptr ) const;
/**
* Function SetRoundRectCornerRadius

View File

@ -324,21 +324,32 @@ const EDA_RECT ZONE_CONTAINER::GetBoundingBox() const
}
int ZONE_CONTAINER::GetThermalReliefGap( D_PAD* aPad ) const
int ZONE_CONTAINER::GetThermalReliefGap( D_PAD* aPad, wxString* aSource ) const
{
if( aPad == NULL || aPad->GetThermalGap() == 0 )
if( aPad->GetEffectiveThermalGap() == 0 )
{
if( aSource )
*aSource = _( "zone" );
return m_ThermalReliefGap;
else
return aPad->GetThermalGap();
}
return aPad->GetEffectiveThermalGap( aSource );
}
int ZONE_CONTAINER::GetThermalReliefCopperBridge( D_PAD* aPad ) const
int ZONE_CONTAINER::GetThermalReliefCopperBridge( D_PAD* aPad, wxString* aSource ) const
{
if( aPad == NULL || aPad->GetThermalWidth() == 0 )
if( aPad->GetEffectiveThermalSpokeWidth() == 0 )
{
if( aSource )
*aSource = _( "zone" );
return m_ThermalReliefCopperBridge;
else
return aPad->GetThermalWidth();
}
return aPad->GetEffectiveThermalSpokeWidth( aSource );
}
@ -817,12 +828,19 @@ void ZONE_CONTAINER::Mirror( const wxPoint& aMirrorRef, bool aMirrorLeftRight )
}
ZONE_CONNECTION ZONE_CONTAINER::GetPadConnection( D_PAD* aPad ) const
ZONE_CONNECTION ZONE_CONTAINER::GetPadConnection( D_PAD* aPad, wxString* aSource ) const
{
if( aPad == NULL || aPad->GetEffectiveZoneConnection() == ZONE_CONNECTION::INHERITED )
{
if( aSource )
*aSource = _( "zone" );
return m_PadConnection;
}
else
return aPad->GetEffectiveZoneConnection();
{
return aPad->GetEffectiveZoneConnection( aSource );
}
}

View File

@ -163,7 +163,7 @@ public:
m_ThermalReliefGap = aThermalReliefGap;
}
int GetThermalReliefGap() const { return m_ThermalReliefGap; }
int GetThermalReliefGap( D_PAD* aPad ) const;
int GetThermalReliefGap( D_PAD* aPad, wxString* aSource = nullptr ) const;
void SetThermalReliefCopperBridge( int aThermalReliefCopperBridge )
{
@ -173,7 +173,7 @@ public:
m_ThermalReliefCopperBridge = aThermalReliefCopperBridge;
}
int GetThermalReliefCopperBridge() const { return m_ThermalReliefCopperBridge; }
int GetThermalReliefCopperBridge( D_PAD* aPad ) const;
int GetThermalReliefCopperBridge( D_PAD* aPad, wxString* aSource = nullptr ) const;
/**
* Compute the area currently occupied by the zone fill.
@ -204,7 +204,7 @@ public:
bool NeedRefill() const { return m_needRefill; }
void SetNeedRefill( bool aNeedRefill ) { m_needRefill = aNeedRefill; }
ZONE_CONNECTION GetPadConnection( D_PAD* aPad ) const;
ZONE_CONNECTION GetPadConnection( D_PAD* aPad, wxString* aSource = nullptr ) const;
ZONE_CONNECTION GetPadConnection() const { return m_PadConnection; }
void SetPadConnection( ZONE_CONNECTION aPadConnection ) { m_PadConnection = aPadConnection; }

View File

@ -530,7 +530,7 @@ void DIALOG_PAD_PROPERTIES::initValues()
m_clearance.ChangeValue( m_dummyPad->GetLocalClearance() );
m_maskClearance.ChangeValue( m_dummyPad->GetLocalSolderMaskMargin() );
m_spokeWidth.ChangeValue( m_dummyPad->GetThermalWidth() );
m_spokeWidth.ChangeValue( m_dummyPad->GetThermalSpokeWidth() );
m_thermalGap.ChangeValue( m_dummyPad->GetThermalGap() );
m_pasteClearance.ChangeValue( m_dummyPad->GetLocalSolderPasteMargin() );
@ -1515,7 +1515,7 @@ bool DIALOG_PAD_PROPERTIES::TransferDataFromWindow()
m_currentPad->SetLocalSolderMaskMargin( m_padMaster->GetLocalSolderMaskMargin() );
m_currentPad->SetLocalSolderPasteMargin( m_padMaster->GetLocalSolderPasteMargin() );
m_currentPad->SetLocalSolderPasteMarginRatio( m_padMaster->GetLocalSolderPasteMarginRatio() );
m_currentPad->SetThermalWidth( m_padMaster->GetThermalWidth() );
m_currentPad->SetThermalSpokeWidth( m_padMaster->GetThermalSpokeWidth() );
m_currentPad->SetThermalGap( m_padMaster->GetThermalGap() );
m_currentPad->SetRoundRectRadiusRatio( m_padMaster->GetRoundRectRadiusRatio() );
m_currentPad->SetChamferRectRatio( m_padMaster->GetChamferRectRatio() );
@ -1596,7 +1596,7 @@ bool DIALOG_PAD_PROPERTIES::transferDataToPad( D_PAD* aPad )
aPad->SetLocalClearance( m_clearance.GetValue() );
aPad->SetLocalSolderMaskMargin( m_maskClearance.GetValue() );
aPad->SetLocalSolderPasteMargin( m_pasteClearance.GetValue() );
aPad->SetThermalWidth( m_spokeWidth.GetValue() );
aPad->SetThermalSpokeWidth( m_spokeWidth.GetValue() );
aPad->SetThermalGap( m_thermalGap.GetValue() );
double dtmp = 0.0;
msg = m_SolderPasteMarginRatioCtrl->GetValue();

View File

@ -1355,16 +1355,20 @@ void PCB_IO::format( D_PAD* aPad, int aNestLevel ) const
Double2Str( aPad->GetLocalSolderPasteMarginRatio() ).c_str() );
if( aPad->GetLocalClearance() != 0 )
StrPrintf( &output, " (clearance %s)", FormatInternalUnits( aPad->GetLocalClearance() ).c_str() );
StrPrintf( &output, " (clearance %s)",
FormatInternalUnits( aPad->GetLocalClearance() ).c_str() );
if( aPad->GetEffectiveZoneConnection() != ZONE_CONNECTION::INHERITED )
StrPrintf( &output, " (zone_connect %d)", static_cast<int>( aPad->GetEffectiveZoneConnection() ) );
StrPrintf( &output, " (zone_connect %d)",
static_cast<int>( aPad->GetEffectiveZoneConnection() ) );
if( aPad->GetThermalWidth() != 0 )
StrPrintf( &output, " (thermal_width %s)", FormatInternalUnits( aPad->GetThermalWidth() ).c_str() );
if( aPad->GetThermalSpokeWidth() != 0 )
StrPrintf( &output, " (thermal_width %s)",
FormatInternalUnits( aPad->GetThermalSpokeWidth() ).c_str() );
if( aPad->GetThermalGap() != 0 )
StrPrintf( &output, " (thermal_gap %s)", FormatInternalUnits( aPad->GetThermalGap() ).c_str() );
StrPrintf( &output, " (thermal_gap %s)",
FormatInternalUnits( aPad->GetThermalGap() ).c_str() );
if( output.size() )
{

View File

@ -1606,7 +1606,7 @@ void LEGACY_PLUGIN::loadPAD( MODULE* aModule )
else if( TESTLINE( ".ThermalWidth" ) )
{
BIU tmp = biuParse( line + SZ( ".ThermalWidth" ) );
pad->SetThermalWidth( tmp );
pad->SetThermalSpokeWidth( tmp );
}
else if( TESTLINE( ".ThermalGap" ) )

View File

@ -3408,7 +3408,7 @@ D_PAD* PCB_PARSER::parseD_PAD( MODULE* aParent )
break;
case T_thermal_width:
pad->SetThermalWidth( parseBoardUnits( T_thermal_width ) );
pad->SetThermalSpokeWidth( parseBoardUnits( T_thermal_width ) );
NeedRIGHT();
break;

View File

@ -669,7 +669,7 @@ void CADSTAR_PCB_ARCHIVE_LOADER::loadLibraryPads( const SYMDEF& aComponent, MODU
pad->SetThermalGap( getKiCadLength( csPadcode.ReliefClearance ) );
if( csPadcode.ReliefWidth != UNDEFINED_VALUE )
pad->SetThermalWidth( getKiCadLength( csPadcode.ReliefWidth ) );
pad->SetThermalSpokeWidth( getKiCadLength( csPadcode.ReliefWidth ) );
pad->SetOrientation( pad->GetOrientation() + getAngleTenthDegree( csPadcode.Shape.OrientAngle ) );

View File

@ -440,8 +440,8 @@ static void setupDummyPadForHole( const D_PAD* aPad, D_PAD& aDummyPad )
aDummyPad.SetLocalSolderPasteMarginRatio( aPad->GetLocalSolderPasteMarginRatio() );
aDummyPad.SetZoneConnection( aPad->GetEffectiveZoneConnection() );
aDummyPad.SetThermalWidth( aPad->GetThermalWidth() );
aDummyPad.SetThermalGap( aPad->GetThermalGap() );
aDummyPad.SetThermalSpokeWidth( aPad->GetEffectiveThermalSpokeWidth() );
aDummyPad.SetThermalGap( aPad->GetEffectiveThermalGap() );
aDummyPad.SetCustomShapeInZoneOpt( aPad->GetCustomShapeInZoneOpt() );