From cc7549a2a556a6e75fda6253e36f106ed3748896 Mon Sep 17 00:00:00 2001 From: unknown Date: Tue, 18 Aug 2015 16:19:17 +0200 Subject: [PATCH] * 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 --- pcbnew/class_module.cpp | 2 +- pcbnew/class_pad.cpp | 4 ++-- pcbnew/class_zone.cpp | 2 +- pcbnew/class_zone_settings.cpp | 2 +- pcbnew/dialogs/dialog_copper_zones.cpp | 20 +++++++++---------- .../dialog_edit_module_for_BoardEditor.cpp | 16 +++++++-------- pcbnew/dialogs/dialog_pad_properties.cpp | 16 +++++++-------- pcbnew/eagle_plugin.cpp | 2 +- pcbnew/kicad_plugin.cpp | 12 +++++------ pcbnew/legacy_plugin.cpp | 20 +++++++++---------- pcbnew/pcb_parser.cpp | 6 +++--- pcbnew/scripting/pcbnew.i | 2 ++ pcbnew/zones.h | 10 +++++----- ...nvert_brd_items_to_polygons_with_Boost.cpp | 8 ++++---- ...ones_convert_to_polygons_aux_functions.cpp | 6 +++--- 15 files changed, 65 insertions(+), 63 deletions(-) diff --git a/pcbnew/class_module.cpp b/pcbnew/class_module.cpp index 562489af4d..70de60539a 100644 --- a/pcbnew/class_module.cpp +++ b/pcbnew/class_module.cpp @@ -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 diff --git a/pcbnew/class_pad.cpp b/pcbnew/class_pad.cpp index ddfef773ce..2628bd7927 100644 --- a/pcbnew/class_pad.cpp +++ b/pcbnew/class_pad.cpp @@ -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; diff --git a/pcbnew/class_zone.cpp b/pcbnew/class_zone.cpp index e9b6c27977..219c2ede5f 100644 --- a/pcbnew/class_zone.cpp +++ b/pcbnew/class_zone.cpp @@ -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(); diff --git a/pcbnew/class_zone_settings.cpp b/pcbnew/class_zone_settings.cpp index 8aeda9c53d..9dc88ba7dd 100644 --- a/pcbnew/class_zone_settings.cpp +++ b/pcbnew/class_zone_settings.cpp @@ -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; diff --git a/pcbnew/dialogs/dialog_copper_zones.cpp b/pcbnew/dialogs/dialog_copper_zones.cpp index f0215ff6c5..828fe26a99 100644 --- a/pcbnew/dialogs/dialog_copper_zones.cpp +++ b/pcbnew/dialogs/dialog_copper_zones.cpp @@ -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; } diff --git a/pcbnew/dialogs/dialog_edit_module_for_BoardEditor.cpp b/pcbnew/dialogs/dialog_edit_module_for_BoardEditor.cpp index cb961d4533..e3968c5159 100644 --- a/pcbnew/dialogs/dialog_edit_module_for_BoardEditor.cpp +++ b/pcbnew/dialogs/dialog_edit_module_for_BoardEditor.cpp @@ -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; } diff --git a/pcbnew/dialogs/dialog_pad_properties.cpp b/pcbnew/dialogs/dialog_pad_properties.cpp index a30c352c09..f949836736 100644 --- a/pcbnew/dialogs/dialog_pad_properties.cpp +++ b/pcbnew/dialogs/dialog_pad_properties.cpp @@ -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; } diff --git a/pcbnew/eagle_plugin.cpp b/pcbnew/eagle_plugin.cpp index b2b785f374..dfb243c36a 100644 --- a/pcbnew/eagle_plugin.cpp +++ b/pcbnew/eagle_plugin.cpp @@ -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 ); diff --git a/pcbnew/kicad_plugin.cpp b/pcbnew/kicad_plugin.cpp index d701b8366e..2977d2cc00 100644 --- a/pcbnew/kicad_plugin.cpp +++ b/pcbnew/kicad_plugin.cpp @@ -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; } diff --git a/pcbnew/legacy_plugin.cpp b/pcbnew/legacy_plugin.cpp index c29e162c35..7c96f95923 100644 --- a/pcbnew/legacy_plugin.cpp +++ b/pcbnew/legacy_plugin.cpp @@ -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", diff --git a/pcbnew/pcb_parser.cpp b/pcbnew/pcb_parser.cpp index 19e449405d..74ca6cfbc0 100644 --- a/pcbnew/pcb_parser.cpp +++ b/pcbnew/pcb_parser.cpp @@ -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: diff --git a/pcbnew/scripting/pcbnew.i b/pcbnew/scripting/pcbnew.i index bf2278a703..4e8c7b4e5c 100644 --- a/pcbnew/scripting/pcbnew.i +++ b/pcbnew/scripting/pcbnew.i @@ -89,6 +89,7 @@ #include #include #include + #include #include #include #include @@ -127,6 +128,7 @@ %include %include %include +%include %include %include %include diff --git a/pcbnew/zones.h b/pcbnew/zones.h index 61370628e5..c08a3008d3 100644 --- a/pcbnew/zones.h +++ b/pcbnew/zones.h @@ -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; diff --git a/pcbnew/zones_convert_brd_items_to_polygons_with_Boost.cpp b/pcbnew/zones_convert_brd_items_to_polygons_with_Boost.cpp index 1773f16aff..a2637f5888 100644 --- a/pcbnew/zones_convert_brd_items_to_polygons_with_Boost.cpp +++ b/pcbnew/zones_convert_brd_items_to_polygons_with_Boost.cpp @@ -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() ) ) diff --git a/pcbnew/zones_convert_to_polygons_aux_functions.cpp b/pcbnew/zones_convert_to_polygons_aux_functions.cpp index 47e5cb5cde..71406772fa 100644 --- a/pcbnew/zones_convert_to_polygons_aux_functions.cpp +++ b/pcbnew/zones_convert_to_polygons_aux_functions.cpp @@ -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