* 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_LocalSolderMaskMargin = 0;
m_LocalSolderPasteMargin = 0; m_LocalSolderPasteMargin = 0;
m_LocalSolderPasteMarginRatio = 0.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_ThermalWidth = 0; // Use zone setting by default
m_ThermalGap = 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_LocalSolderMaskMargin = 0;
m_LocalSolderPasteMargin = 0; m_LocalSolderPasteMargin = 0;
m_LocalSolderPasteMarginRatio = 0.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_ThermalWidth = 0; // Use parent setting by default
m_ThermalGap = 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(); MODULE* module = (MODULE*) GetParent();
if( m_ZoneConnection == UNDEFINED_CONNECTION && module ) if( m_ZoneConnection == PAD_ZONE_CONN_INHERITED && module )
return module->GetZoneConnection(); return module->GetZoneConnection();
else else
return m_ZoneConnection; return m_ZoneConnection;

View File

@ -781,7 +781,7 @@ void ZONE_CONTAINER::Copy( ZONE_CONTAINER* src )
ZoneConnection ZONE_CONTAINER::GetPadConnection( D_PAD* aPad ) const 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; return m_PadConnection;
else else
return aPad->GetZoneConnection(); return aPad->GetZoneConnection();

View File

@ -56,7 +56,7 @@ ZONE_SETTINGS::ZONE_SETTINGS()
// thickness of the copper bridge in thermal reliefs: // thickness of the copper bridge in thermal reliefs:
m_ThermalReliefCopperBridge = Mils2iu( ZONE_THERMAL_RELIEF_COPPER_WIDTH_MIL ); 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; m_Zone_45_Only = false;

View File

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

View File

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

View File

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

View File

@ -2611,7 +2611,7 @@ void EAGLE_PLUGIN::loadSignals( CPTREE& aSignals )
// missing == yes per DTD. // missing == yes per DTD.
bool thermals = !p.thermals || *p.thermals; 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; int rank = p.rank ? *p.rank : 0;
zone->SetPriority( rank ); 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", m_out->Print( aNestLevel+1, "(clearance %s)\n",
FMT_IU( aModule->GetLocalClearance() ).c_str() ); 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() ); m_out->Print( aNestLevel+1, "(zone_connect %d)\n", aModule->GetZoneConnection() );
if( aModule->GetThermalWidth() != 0 ) if( aModule->GetThermalWidth() != 0 )
@ -1310,7 +1310,7 @@ void PCB_IO::format( D_PAD* aPad, int aNestLevel ) const
if( aPad->GetLocalClearance() != 0 ) if( aPad->GetLocalClearance() != 0 )
StrPrintf( &output, " (clearance %s)", FMT_IU( aPad->GetLocalClearance() ).c_str() ); 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() ); StrPrintf( &output, " (zone_connect %d)", aPad->GetZoneConnection() );
if( aPad->GetThermalWidth() != 0 ) if( aPad->GetThermalWidth() != 0 )
@ -1497,18 +1497,18 @@ void PCB_IO::format( ZONE_CONTAINER* aZone, int aNestLevel ) const
switch( aZone->GetPadConnection() ) switch( aZone->GetPadConnection() )
{ {
default: default:
case THERMAL_PAD: // Default option not saved or loaded. case PAD_ZONE_CONN_THERMAL: // Default option not saved or loaded.
break; break;
case THT_THERMAL: case PAD_ZONE_CONN_THT_THERMAL:
m_out->Print( 0, " thru_hole_only" ); m_out->Print( 0, " thru_hole_only" );
break; break;
case PAD_IN_ZONE: case PAD_ZONE_CONN_FULL:
m_out->Print( 0, " yes" ); m_out->Print( 0, " yes" );
break; break;
case PAD_NOT_IN_ZONE: case PAD_ZONE_CONN_NONE:
m_out->Print( 0, " no" ); m_out->Print( 0, " no" );
break; break;
} }

View File

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

View File

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

View File

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

View File

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