Add "Mechanical" pad property

Prevents mechanical support pads from being used to check pad types.

Fixes https://gitlab.com/kicad/code/kicad/-/issues/16747
This commit is contained in:
Seth Hillbrand 2024-03-04 13:42:57 -08:00
parent e0b0fb27b0
commit a835ba0715
11 changed files with 26 additions and 9 deletions

View File

@ -243,6 +243,7 @@ pad_prop_fiducial_glob
pad_prop_castellated
pad_prop_testpoint
pad_prop_heatsink
pad_prop_mechanical
padvia
prefer_zone_connections
private_layers

View File

@ -75,7 +75,8 @@ enum class PAD_ATTRIB
/**
* The set of pad properties used in Gerber files (Draw files, and P&P files)
* to define some properties in fabrication or test files.
* to define some properties in fabrication or test files. Also used by
* DRC to check some properties.
*/
enum class PAD_PROP
{
@ -85,7 +86,8 @@ enum class PAD_PROP
FIDUCIAL_LOCAL, ///< a fiducial (usually a smd) local to the parent footprint
TESTPOINT, ///< a test point pad
HEATSINK, ///< a pad used as heat sink, usually in SMD footprints
CASTELLATED ///< a pad with a castellated through hole
CASTELLATED, ///< a pad with a castellated through hole
MECHANICAL, ///< a pad used for mechanical support
};

View File

@ -744,6 +744,7 @@ void DIALOG_PAD_PROPERTIES::initValues()
case PAD_PROP::TESTPOINT: m_choiceFabProperty->SetSelection( 4 ); break;
case PAD_PROP::HEATSINK: m_choiceFabProperty->SetSelection( 5 ); break;
case PAD_PROP::CASTELLATED: m_choiceFabProperty->SetSelection( 6 ); break;
case PAD_PROP::MECHANICAL: m_choiceFabProperty->SetSelection( 7 ); break;
}
// Ensure the pad property is compatible with the pad type
@ -1440,6 +1441,12 @@ bool DIALOG_PAD_PROPERTIES::padValuesOK()
warning_msgs.Add( _( "Warning: BGA property is for SMD pads." ) );
}
if( m_previewPad->GetProperty() == PAD_PROP::MECHANICAL
&& m_previewPad->GetAttribute() != PAD_ATTRIB::PTH )
{
warning_msgs.Add( _( "Warning: Mechanical property is for PTH pads." ) );
}
if( m_previewPad->GetShape() == PAD_SHAPE::ROUNDRECT
|| m_previewPad->GetShape() == PAD_SHAPE::CHAMFERED_RECT )
{
@ -1686,6 +1693,7 @@ PAD_PROP DIALOG_PAD_PROPERTIES::getSelectedProperty()
case 4: prop = PAD_PROP::TESTPOINT; break;
case 5: prop = PAD_PROP::HEATSINK; break;
case 6: prop = PAD_PROP::CASTELLATED; break;
case 7: prop = PAD_PROP::MECHANICAL; break;
}
return prop;

View File

@ -1,5 +1,5 @@
///////////////////////////////////////////////////////////////////////////
// C++ code generated with wxFormBuilder (version 4.0.0-0-g0efcecf)
// C++ code generated with wxFormBuilder (version 4.0.0-0-g0efcecf0)
// http://www.wxformbuilder.org/
//
// PLEASE DO *NOT* EDIT THIS FILE!
@ -548,14 +548,14 @@ DIALOG_PAD_PROPERTIES_BASE::DIALOG_PAD_PROPERTIES_BASE( wxWindow* parent, wxWind
m_staticTextFabProperty = new wxStaticText( m_panelGeneral, wxID_ANY, _("Fabrication property:"), wxDefaultPosition, wxDefaultSize, 0 );
m_staticTextFabProperty->Wrap( -1 );
m_staticTextFabProperty->SetToolTip( _("Optional property to specify a special purpose or constraint in fabrication files:\nBGA attribute is for pads in BGA footprints\nFiducial local is a fiducial for the parent footprint\nFiducial global is a fiducial for the whole board\nTest Point pad is useful to specify test points in Gerber files\nHeatsink pad specify a thermal pad\nCastellated specify castellated through hole pads on a board edge\nThese properties are specified in Gerber X2 files.") );
m_staticTextFabProperty->SetToolTip( _("Optional property to specify a special purpose or constraint in fabrication files:\nBGA attribute is for pads in BGA footprints\nFiducial local is a fiducial for the parent footprint\nFiducial global is a fiducial for the whole board\nTest Point specifies an electrical test point\nHeatsink specifies a thermal pad\nCastellated specifies a through hole pad on a board edge\nMechanical specifies a through-hole pad that is used for mechanical support") );
m_middleBoxSizer->Add( m_staticTextFabProperty, 0, wxTOP|wxRIGHT|wxLEFT, 5 );
m_middleBoxSizer->Add( 0, 2, 0, wxEXPAND, 5 );
wxString m_choiceFabPropertyChoices[] = { _("None"), _("BGA pad"), _("Fiducial, local to footprint"), _("Fiducial, global to board"), _("Test point pad"), _("Heatsink pad"), _("Castellated pad (through hole only)") };
wxString m_choiceFabPropertyChoices[] = { _("None"), _("BGA pad"), _("Fiducial, local to footprint"), _("Fiducial, global to board"), _("Test point pad"), _("Heatsink pad"), _("Castellated pad (through hole only)"), _("Mechanical") };
int m_choiceFabPropertyNChoices = sizeof( m_choiceFabPropertyChoices ) / sizeof( wxString );
m_choiceFabProperty = new wxChoice( m_panelGeneral, wxID_ANY, wxDefaultPosition, wxDefaultSize, m_choiceFabPropertyNChoices, m_choiceFabPropertyChoices, 0 );
m_choiceFabProperty->SetSelection( 0 );

View File

@ -6886,7 +6886,7 @@
<property name="style"></property>
<property name="subclass">; ; forward_declare</property>
<property name="toolbar_pane">0</property>
<property name="tooltip">Optional property to specify a special purpose or constraint in fabrication files:&#x0A;BGA attribute is for pads in BGA footprints&#x0A;Fiducial local is a fiducial for the parent footprint&#x0A;Fiducial global is a fiducial for the whole board&#x0A;Test Point pad is useful to specify test points in Gerber files&#x0A;Heatsink pad specify a thermal pad&#x0A;Castellated specify castellated through hole pads on a board edge&#x0A;These properties are specified in Gerber X2 files.</property>
<property name="tooltip">Optional property to specify a special purpose or constraint in fabrication files:&#x0A;BGA attribute is for pads in BGA footprints&#x0A;Fiducial local is a fiducial for the parent footprint&#x0A;Fiducial global is a fiducial for the whole board&#x0A;Test Point specifies an electrical test point&#x0A;Heatsink specifies a thermal pad&#x0A;Castellated specifies a through hole pad on a board edge&#x0A;Mechanical specifies a through-hole pad that is used for mechanical support</property>
<property name="window_extra_style"></property>
<property name="window_name"></property>
<property name="window_style"></property>
@ -6921,7 +6921,7 @@
<property name="caption"></property>
<property name="caption_visible">1</property>
<property name="center_pane">0</property>
<property name="choices">&quot;None&quot; &quot;BGA pad&quot; &quot;Fiducial, local to footprint&quot; &quot;Fiducial, global to board&quot; &quot;Test point pad&quot; &quot;Heatsink pad&quot; &quot;Castellated pad (through hole only)&quot;</property>
<property name="choices">&quot;None&quot; &quot;BGA pad&quot; &quot;Fiducial, local to footprint&quot; &quot;Fiducial, global to board&quot; &quot;Test point pad&quot; &quot;Heatsink pad&quot; &quot;Castellated pad (through hole only)&quot; &quot;Mechanical&quot;</property>
<property name="close_button">1</property>
<property name="context_help"></property>
<property name="context_menu">1</property>

View File

@ -1,5 +1,5 @@
///////////////////////////////////////////////////////////////////////////
// C++ code generated with wxFormBuilder (version 4.0.0-0-g0efcecf)
// C++ code generated with wxFormBuilder (version 4.0.0-0-g0efcecf0)
// http://www.wxformbuilder.org/
//
// PLEASE DO *NOT* EDIT THIS FILE!

View File

@ -1145,6 +1145,7 @@ int FOOTPRINT::GetLikelyAttribute() const
case PAD_PROP::HEATSINK:
case PAD_PROP::CASTELLATED:
case PAD_PROP::MECHANICAL:
continue;
case PAD_PROP::NONE:

View File

@ -1229,6 +1229,7 @@ void PAD::GetMsgPanelInfo( EDA_DRAW_FRAME* aFrame, std::vector<MSG_PANEL_ITEM>&
case PAD_PROP::TESTPOINT: props += _( "Test point" ); break;
case PAD_PROP::HEATSINK: props += _( "Heat sink" ); break;
case PAD_PROP::CASTELLATED: props += _( "Castellated" ); break;
case PAD_PROP::MECHANICAL: props += _( "Mechanical" ); break;
}
aList.emplace_back( ShowPadShape(), props );
@ -2112,7 +2113,8 @@ static struct PAD_DESC
.Map( PAD_PROP::FIDUCIAL_LOCAL, _HKI( "Fiducial, local to footprint" ) )
.Map( PAD_PROP::TESTPOINT, _HKI( "Test point pad" ) )
.Map( PAD_PROP::HEATSINK, _HKI( "Heatsink pad" ) )
.Map( PAD_PROP::CASTELLATED, _HKI( "Castellated pad" ) );
.Map( PAD_PROP::CASTELLATED, _HKI( "Castellated pad" ) )
.Map( PAD_PROP::MECHANICAL, _HKI( "Mechanical pad" ) );
ENUM_MAP<ZONE_CONNECTION>& zcMap = ENUM_MAP<ZONE_CONNECTION>::Instance();

View File

@ -1490,6 +1490,7 @@ void PCB_IO_KICAD_SEXPR::format( const PAD* aPad, int aNestLevel ) const
case PAD_PROP::TESTPOINT: property = "pad_prop_testpoint"; break;
case PAD_PROP::HEATSINK: property = "pad_prop_heatsink"; break;
case PAD_PROP::CASTELLATED: property = "pad_prop_castellated"; break;
case PAD_PROP::MECHANICAL: property = "pad_prop_mechanical"; break;
default:
THROW_IO_ERROR( wxString::Format( wxT( "unknown pad property: %d" ),

View File

@ -5074,6 +5074,7 @@ PAD* PCB_IO_KICAD_SEXPR_PARSER::parsePAD( FOOTPRINT* aParent )
case T_pad_prop_testpoint: pad->SetProperty( PAD_PROP::TESTPOINT ); break;
case T_pad_prop_castellated: pad->SetProperty( PAD_PROP::CASTELLATED ); break;
case T_pad_prop_heatsink: pad->SetProperty( PAD_PROP::HEATSINK ); break;
case T_pad_prop_mechanical: pad->SetProperty( PAD_PROP::MECHANICAL ); break;
case T_none: pad->SetProperty( PAD_PROP::NONE ); break;
case T_RIGHT: break;

View File

@ -184,6 +184,7 @@ void BRDITEMS_PLOTTER::PlotPad( const PAD* aPad, const COLOR4D& aColor, OUTLINE_
break;
case PAD_PROP::NONE:
case PAD_PROP::MECHANICAL:
break;
}