* Python scripting: brings pad.GetZoneConnection() and in example pad.SetZoneConnection(pcbnew.PAD_ZONE_CONN_FULL) to full workable.

* Cleanup namespace  in enum ZoneConnection in pcbnew/zones.h to self-explained names unification:  PAD_ZONE_CONN_INHERITED, PAD_ZONE_CONN_NONE,PAD_ZONE_CONN_THERMAL,PAD_ZONE_CONN_FULL, PAD_ZONE_CONN_THT_THERMAL
This commit is contained in:
unknown 2015-08-18 16:19:17 +02:00 committed by jean-pierre charras
parent f6689f75a8
commit cc7549a2a5
15 changed files with 65 additions and 63 deletions

View File

@ -67,7 +67,7 @@ MODULE::MODULE( BOARD* parent ) :
m_LocalSolderMaskMargin = 0;
m_LocalSolderPasteMargin = 0;
m_LocalSolderPasteMarginRatio = 0.0;
m_ZoneConnection = UNDEFINED_CONNECTION; // Use zone setting by default
m_ZoneConnection = PAD_ZONE_CONN_INHERITED; // Use zone setting by default
m_ThermalWidth = 0; // Use zone setting by default
m_ThermalGap = 0; // Use zone setting by default

View File

@ -74,7 +74,7 @@ D_PAD::D_PAD( MODULE* parent ) :
m_LocalSolderMaskMargin = 0;
m_LocalSolderPasteMargin = 0;
m_LocalSolderPasteMarginRatio = 0.0;
m_ZoneConnection = UNDEFINED_CONNECTION; // Use parent setting by default
m_ZoneConnection = PAD_ZONE_CONN_INHERITED; // Use parent setting by default
m_ThermalWidth = 0; // Use parent setting by default
m_ThermalGap = 0; // Use parent setting by default
@ -585,7 +585,7 @@ ZoneConnection D_PAD::GetZoneConnection() const
{
MODULE* module = (MODULE*) GetParent();
if( m_ZoneConnection == UNDEFINED_CONNECTION && module )
if( m_ZoneConnection == PAD_ZONE_CONN_INHERITED && module )
return module->GetZoneConnection();
else
return m_ZoneConnection;

View File

@ -781,7 +781,7 @@ void ZONE_CONTAINER::Copy( ZONE_CONTAINER* src )
ZoneConnection ZONE_CONTAINER::GetPadConnection( D_PAD* aPad ) const
{
if( aPad == NULL || aPad->GetZoneConnection() == UNDEFINED_CONNECTION )
if( aPad == NULL || aPad->GetZoneConnection() == PAD_ZONE_CONN_INHERITED )
return m_PadConnection;
else
return aPad->GetZoneConnection();

View File

@ -56,7 +56,7 @@ ZONE_SETTINGS::ZONE_SETTINGS()
// thickness of the copper bridge in thermal reliefs:
m_ThermalReliefCopperBridge = Mils2iu( ZONE_THERMAL_RELIEF_COPPER_WIDTH_MIL );
m_PadConnection = THERMAL_PAD; // How pads are covered by copper in zone
m_PadConnection = PAD_ZONE_CONN_THERMAL; // How pads are covered by copper in zone
m_Zone_45_Only = false;

View File

@ -183,27 +183,27 @@ void DIALOG_COPPER_ZONE::initDialog()
switch( m_settings.GetPadConnection() )
{
case THT_THERMAL: // Thermals only for THT pads
case PAD_ZONE_CONN_THT_THERMAL: // Thermals only for THT pads
m_PadInZoneOpt->SetSelection( 2 );
break;
case PAD_NOT_IN_ZONE: // Pads are not covered
case PAD_ZONE_CONN_NONE: // Pads are not covered
m_PadInZoneOpt->SetSelection( 3 );
break;
default:
case THERMAL_PAD: // Use thermal relief for pads
case PAD_ZONE_CONN_THERMAL: // Use thermal relief for pads
m_PadInZoneOpt->SetSelection( 1 );
break;
case PAD_IN_ZONE: // pads are covered by copper
case PAD_ZONE_CONN_FULL: // pads are covered by copper
m_PadInZoneOpt->SetSelection( 0 );
break;
}
// Antipad and spokes are significant only for thermals
if( m_settings.GetPadConnection() != THERMAL_PAD &&
m_settings.GetPadConnection() != THT_THERMAL )
if( m_settings.GetPadConnection() != PAD_ZONE_CONN_THERMAL &&
m_settings.GetPadConnection() != PAD_ZONE_CONN_THT_THERMAL )
{
m_AntipadSizeValue->Enable( false );
m_CopperWidthValue->Enable( false );
@ -346,22 +346,22 @@ bool DIALOG_COPPER_ZONE::AcceptOptions( bool aPromptForErrors, bool aUseExportab
{
case 3:
// Pads are not covered
m_settings.SetPadConnection( PAD_NOT_IN_ZONE );
m_settings.SetPadConnection( PAD_ZONE_CONN_NONE );
break;
case 2:
// Use thermal relief for THT pads
m_settings.SetPadConnection( THT_THERMAL );
m_settings.SetPadConnection( PAD_ZONE_CONN_THT_THERMAL );
break;
case 1:
// Use thermal relief for pads
m_settings.SetPadConnection( THERMAL_PAD );
m_settings.SetPadConnection( PAD_ZONE_CONN_THERMAL );
break;
case 0:
// pads are covered by copper
m_settings.SetPadConnection( PAD_IN_ZONE );
m_settings.SetPadConnection( PAD_ZONE_CONN_FULL );
break;
}

View File

@ -169,19 +169,19 @@ void DIALOG_MODULE_BOARD_EDITOR::InitBoardProperties()
switch( m_CurrentModule->GetZoneConnection() )
{
default:
case UNDEFINED_CONNECTION:
case PAD_ZONE_CONN_INHERITED:
m_ZoneConnectionChoice->SetSelection( 0 );
break;
case PAD_IN_ZONE:
case PAD_ZONE_CONN_FULL:
m_ZoneConnectionChoice->SetSelection( 1 );
break;
case THERMAL_PAD:
case PAD_ZONE_CONN_THERMAL:
m_ZoneConnectionChoice->SetSelection( 2 );
break;
case PAD_NOT_IN_ZONE:
case PAD_ZONE_CONN_NONE:
m_ZoneConnectionChoice->SetSelection( 3 );
break;
}
@ -581,19 +581,19 @@ void DIALOG_MODULE_BOARD_EDITOR::OnOkClick( wxCommandEvent& event )
{
default:
case 0:
m_CurrentModule->SetZoneConnection( UNDEFINED_CONNECTION );
m_CurrentModule->SetZoneConnection( PAD_ZONE_CONN_INHERITED );
break;
case 1:
m_CurrentModule->SetZoneConnection( PAD_IN_ZONE );
m_CurrentModule->SetZoneConnection( PAD_ZONE_CONN_FULL );
break;
case 2:
m_CurrentModule->SetZoneConnection( THERMAL_PAD );
m_CurrentModule->SetZoneConnection( PAD_ZONE_CONN_THERMAL );
break;
case 3:
m_CurrentModule->SetZoneConnection( PAD_NOT_IN_ZONE );
m_CurrentModule->SetZoneConnection( PAD_ZONE_CONN_NONE );
break;
}

View File

@ -433,19 +433,19 @@ void DIALOG_PAD_PROPERTIES::initValues()
switch( m_dummyPad->GetZoneConnection() )
{
default:
case UNDEFINED_CONNECTION:
case PAD_ZONE_CONN_INHERITED:
m_ZoneConnectionChoice->SetSelection( 0 );
break;
case PAD_IN_ZONE:
case PAD_ZONE_CONN_FULL:
m_ZoneConnectionChoice->SetSelection( 1 );
break;
case THERMAL_PAD:
case PAD_ZONE_CONN_THERMAL:
m_ZoneConnectionChoice->SetSelection( 2 );
break;
case PAD_NOT_IN_ZONE:
case PAD_ZONE_CONN_NONE:
m_ZoneConnectionChoice->SetSelection( 3 );
break;
}
@ -996,19 +996,19 @@ bool DIALOG_PAD_PROPERTIES::transferDataToPad( D_PAD* aPad )
{
default:
case 0:
aPad->SetZoneConnection( UNDEFINED_CONNECTION );
aPad->SetZoneConnection( PAD_ZONE_CONN_INHERITED );
break;
case 1:
aPad->SetZoneConnection( PAD_IN_ZONE );
aPad->SetZoneConnection( PAD_ZONE_CONN_FULL );
break;
case 2:
aPad->SetZoneConnection( THERMAL_PAD );
aPad->SetZoneConnection( PAD_ZONE_CONN_THERMAL );
break;
case 3:
aPad->SetZoneConnection( PAD_NOT_IN_ZONE );
aPad->SetZoneConnection( PAD_ZONE_CONN_NONE );
break;
}

View File

@ -2611,7 +2611,7 @@ void EAGLE_PLUGIN::loadSignals( CPTREE& aSignals )
// missing == yes per DTD.
bool thermals = !p.thermals || *p.thermals;
zone->SetPadConnection( thermals ? THERMAL_PAD : PAD_IN_ZONE );
zone->SetPadConnection( thermals ? PAD_ZONE_CONN_THERMAL : PAD_ZONE_CONN_FULL );
int rank = p.rank ? *p.rank : 0;
zone->SetPriority( rank );

View File

@ -1052,7 +1052,7 @@ void PCB_IO::format( MODULE* aModule, int aNestLevel ) const
m_out->Print( aNestLevel+1, "(clearance %s)\n",
FMT_IU( aModule->GetLocalClearance() ).c_str() );
if( aModule->GetZoneConnection() != UNDEFINED_CONNECTION )
if( aModule->GetZoneConnection() != PAD_ZONE_CONN_INHERITED )
m_out->Print( aNestLevel+1, "(zone_connect %d)\n", aModule->GetZoneConnection() );
if( aModule->GetThermalWidth() != 0 )
@ -1310,7 +1310,7 @@ void PCB_IO::format( D_PAD* aPad, int aNestLevel ) const
if( aPad->GetLocalClearance() != 0 )
StrPrintf( &output, " (clearance %s)", FMT_IU( aPad->GetLocalClearance() ).c_str() );
if( aPad->GetZoneConnection() != UNDEFINED_CONNECTION )
if( aPad->GetZoneConnection() != PAD_ZONE_CONN_INHERITED )
StrPrintf( &output, " (zone_connect %d)", aPad->GetZoneConnection() );
if( aPad->GetThermalWidth() != 0 )
@ -1497,18 +1497,18 @@ void PCB_IO::format( ZONE_CONTAINER* aZone, int aNestLevel ) const
switch( aZone->GetPadConnection() )
{
default:
case THERMAL_PAD: // Default option not saved or loaded.
case PAD_ZONE_CONN_THERMAL: // Default option not saved or loaded.
break;
case THT_THERMAL:
case PAD_ZONE_CONN_THT_THERMAL:
m_out->Print( 0, " thru_hole_only" );
break;
case PAD_IN_ZONE:
case PAD_ZONE_CONN_FULL:
m_out->Print( 0, " yes" );
break;
case PAD_NOT_IN_ZONE:
case PAD_ZONE_CONN_NONE:
m_out->Print( 0, " no" );
break;
}

View File

@ -2675,10 +2675,10 @@ void LEGACY_PLUGIN::loadZONE_CONTAINER()
ZoneConnection popt;
switch( *padoption )
{
case 'I': popt = PAD_IN_ZONE; break;
case 'T': popt = THERMAL_PAD; break;
case 'H': popt = THT_THERMAL; break;
case 'X': popt = PAD_NOT_IN_ZONE; break;
case 'I': popt = PAD_ZONE_CONN_FULL; break;
case 'T': popt = PAD_ZONE_CONN_THERMAL; break;
case 'H': popt = PAD_ZONE_CONN_THT_THERMAL; break;
case 'X': popt = PAD_ZONE_CONN_NONE; break;
default:
m_error.Printf( wxT( "Bad ZClearance padoption for CZONE_CONTAINER '%s'" ),
@ -3775,7 +3775,7 @@ void LEGACY_PLUGIN::savePAD( const D_PAD* me ) const
if( me->GetLocalClearance() != 0 )
fprintf( m_fp, ".LocalClearance %s\n", fmtBIU( me->GetLocalClearance( ) ).c_str() );
if( me->GetZoneConnection() != UNDEFINED_CONNECTION )
if( me->GetZoneConnection() != PAD_ZONE_CONN_INHERITED )
fprintf( m_fp, ".ZoneConnection %d\n", me->GetZoneConnection() );
if( me->GetThermalWidth() != 0 )
@ -3840,7 +3840,7 @@ void LEGACY_PLUGIN::saveMODULE( const MODULE* me ) const
if( me->GetLocalClearance() != 0 )
fprintf( m_fp, ".LocalClearance %s\n", fmtBIU( me->GetLocalClearance( ) ).c_str() );
if( me->GetZoneConnection() != UNDEFINED_CONNECTION )
if( me->GetZoneConnection() != PAD_ZONE_CONN_INHERITED )
fprintf( m_fp, ".ZoneConnection %d\n", me->GetZoneConnection() );
if( me->GetThermalWidth() != 0 )
@ -4016,10 +4016,10 @@ void LEGACY_PLUGIN::saveZONE_CONTAINER( const ZONE_CONTAINER* me ) const
switch( me->GetPadConnection() )
{
default:
case PAD_IN_ZONE: padoption = 'I'; break;
case THERMAL_PAD: padoption = 'T'; break;
case THT_THERMAL: padoption = 'H'; break; // H is for 'hole' since it reliefs holes only
case PAD_NOT_IN_ZONE: padoption = 'X'; break;
case PAD_ZONE_CONN_FULL: padoption = 'I'; break;
case PAD_ZONE_CONN_THERMAL: padoption = 'T'; break;
case PAD_ZONE_CONN_THT_THERMAL: padoption = 'H'; break; // H is for 'hole' since it reliefs holes only
case PAD_ZONE_CONN_NONE: padoption = 'X'; break;
}
fprintf( m_fp, "ZClearance %s %c\n",

View File

@ -2619,15 +2619,15 @@ ZONE_CONTAINER* PCB_PARSER::parseZONE_CONTAINER() throw( IO_ERROR, PARSE_ERROR )
switch( token )
{
case T_yes:
zone->SetPadConnection( PAD_IN_ZONE );
zone->SetPadConnection( PAD_ZONE_CONN_FULL );
break;
case T_no:
zone->SetPadConnection( PAD_NOT_IN_ZONE );
zone->SetPadConnection( PAD_ZONE_CONN_NONE );
break;
case T_thru_hole_only:
zone->SetPadConnection( THT_THERMAL );
zone->SetPadConnection( PAD_ZONE_CONN_THT_THERMAL );
break;
case T_clearance:

View File

@ -89,6 +89,7 @@
#include <class_module.h>
#include <class_track.h>
#include <class_zone.h>
#include <zones.h>
#include <layers_id_colors_and_visibility.h>
#include <class_pad.h>
#include <pad_shapes.h>
@ -127,6 +128,7 @@
%include <class_module.h>
%include <class_track.h>
%include <class_zone.h>
%include <zones.h>
%include <layers_id_colors_and_visibility.h>
%include <class_pad.h>
%include <pad_shapes.h>

View File

@ -53,11 +53,11 @@ enum ZONE_EDIT_T {
/// How pads are covered by copper in zone
enum ZoneConnection {
UNDEFINED_CONNECTION = -1,
PAD_NOT_IN_ZONE, ///< Pads are not covered
THERMAL_PAD, ///< Use thermal relief for pads
PAD_IN_ZONE, ///< pads are covered by copper
THT_THERMAL ///< Thermal relief only for THT pads
PAD_ZONE_CONN_INHERITED = -1,
PAD_ZONE_CONN_NONE, ///< Pads are not covered
PAD_ZONE_CONN_THERMAL, ///< Use thermal relief for pads
PAD_ZONE_CONN_FULL, ///< pads are covered by copper
PAD_ZONE_CONN_THT_THERMAL ///< Thermal relief only for THT pads
};
class ZONE_CONTAINER;

View File

@ -192,7 +192,7 @@ void ZONE_CONTAINER::buildFeatureHoleList( BOARD* aPcb, SHAPE_POLY_SET& aFeature
continue;
}
if( GetPadConnection( pad ) == PAD_NOT_IN_ZONE )
if( GetPadConnection( pad ) == PAD_ZONE_CONN_NONE )
{
int gap = zone_clearance;
int thermalGap = GetThermalReliefGap( pad );
@ -336,12 +336,12 @@ void ZONE_CONTAINER::buildFeatureHoleList( BOARD* aPcb, SHAPE_POLY_SET& aFeature
for( D_PAD* pad = module->Pads(); pad != NULL; pad = pad->Next() )
{
// Rejects non-standard pads with tht-only thermal reliefs
if( GetPadConnection( pad ) == THT_THERMAL
if( GetPadConnection( pad ) == PAD_ZONE_CONN_THT_THERMAL
&& pad->GetAttribute() != PAD_STANDARD )
continue;
if( GetPadConnection( pad ) != THERMAL_PAD
&& GetPadConnection( pad ) != THT_THERMAL )
if( GetPadConnection( pad ) != PAD_ZONE_CONN_THERMAL
&& GetPadConnection( pad ) != PAD_ZONE_CONN_THT_THERMAL )
continue;
if( !pad->IsOnLayer( GetLayer() ) )

View File

@ -111,12 +111,12 @@ void BuildUnconnectedThermalStubsPolygonList( SHAPE_POLY_SET& aCornerBuffer,
for( D_PAD* pad = module->Pads(); pad != NULL; pad = pad->Next() )
{
// Rejects non-standard pads with tht-only thermal reliefs
if( aZone->GetPadConnection( pad ) == THT_THERMAL
if( aZone->GetPadConnection( pad ) == PAD_ZONE_CONN_THT_THERMAL
&& pad->GetAttribute() != PAD_STANDARD )
continue;
if( aZone->GetPadConnection( pad ) != THERMAL_PAD
&& aZone->GetPadConnection( pad ) != THT_THERMAL )
if( aZone->GetPadConnection( pad ) != PAD_ZONE_CONN_THERMAL
&& aZone->GetPadConnection( pad ) != PAD_ZONE_CONN_THT_THERMAL )
continue;
// check