pcbnew: Added default master pad properties
CHANGED: Automatically selects the right pad type for the footprint type. Resets the pad properties if the master pad properties do not match the pad type. https://gitlab.com/kicad/code/kicad/-/issues/16563
This commit is contained in:
parent
464f185387
commit
1297ddc88d
|
@ -103,6 +103,11 @@
|
||||||
#define MINIMUM_LINE_WIDTH_MM 0.005 // minimal line width entered in a dialog
|
#define MINIMUM_LINE_WIDTH_MM 0.005 // minimal line width entered in a dialog
|
||||||
#define MAXIMUM_LINE_WIDTH_MM 100.0 // max line width entered in a dialog
|
#define MAXIMUM_LINE_WIDTH_MM 100.0 // max line width entered in a dialog
|
||||||
|
|
||||||
|
// Default pad properies
|
||||||
|
#define DEFAULT_PAD_WIDTH_MM 2.54 // master pad width
|
||||||
|
#define DEFAULT_PAD_HEIGTH_MM 1.27 // master pad heigth
|
||||||
|
#define DEFAULT_PAD_DRILL_DIAMETER_MM 0.8 // master pad drill diameter for PTH
|
||||||
|
#define DEFAULT_PAD_REACT_RADIUS 15 // master pad corner radius in percent
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Container to handle a stock of specific vias each with unique diameter and drill sizes
|
* Container to handle a stock of specific vias each with unique diameter and drill sizes
|
||||||
|
@ -653,6 +658,8 @@ public:
|
||||||
void SetGridOrigin( const VECTOR2I& aOrigin ) { m_gridOrigin = aOrigin; }
|
void SetGridOrigin( const VECTOR2I& aOrigin ) { m_gridOrigin = aOrigin; }
|
||||||
const VECTOR2I& GetGridOrigin() { return m_gridOrigin; }
|
const VECTOR2I& GetGridOrigin() { return m_gridOrigin; }
|
||||||
|
|
||||||
|
void SetDefaultMasterPad();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
void initFromOther( const BOARD_DESIGN_SETTINGS& aOther );
|
void initFromOther( const BOARD_DESIGN_SETTINGS& aOther );
|
||||||
|
|
||||||
|
|
|
@ -53,6 +53,7 @@ BOARD_DESIGN_SETTINGS::BOARD_DESIGN_SETTINGS( JSON_SETTINGS* aParent, const std:
|
||||||
m_HasStackup = false; // no stackup defined by default
|
m_HasStackup = false; // no stackup defined by default
|
||||||
|
|
||||||
m_Pad_Master = std::make_unique<PAD>( nullptr );
|
m_Pad_Master = std::make_unique<PAD>( nullptr );
|
||||||
|
SetDefaultMasterPad();
|
||||||
|
|
||||||
LSET all_set = LSET().set();
|
LSET all_set = LSET().set();
|
||||||
m_enabledLayers = all_set; // All layers enabled at first.
|
m_enabledLayers = all_set; // All layers enabled at first.
|
||||||
|
@ -1481,3 +1482,15 @@ bool BOARD_DESIGN_SETTINGS::GetTextUpright( PCB_LAYER_ID aLayer ) const
|
||||||
{
|
{
|
||||||
return m_TextUpright[ GetLayerClass( aLayer ) ];
|
return m_TextUpright[ GetLayerClass( aLayer ) ];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void BOARD_DESIGN_SETTINGS::SetDefaultMasterPad()
|
||||||
|
{
|
||||||
|
m_Pad_Master.get()->SetSizeX( pcbIUScale.mmToIU( DEFAULT_PAD_WIDTH_MM ) );
|
||||||
|
m_Pad_Master.get()->SetSizeY( pcbIUScale.mmToIU( DEFAULT_PAD_HEIGTH_MM ) );
|
||||||
|
m_Pad_Master.get()->SetDrillShape( PAD_DRILL_SHAPE_CIRCLE );
|
||||||
|
m_Pad_Master.get()->SetDrillSize(
|
||||||
|
VECTOR2I( pcbIUScale.mmToIU( DEFAULT_PAD_DRILL_DIAMETER_MM ), 0 ) );
|
||||||
|
m_Pad_Master.get()->SetShape( PAD_SHAPE::ROUNDRECT );
|
||||||
|
m_Pad_Master.get()->SetRoundRectCornerRadius(
|
||||||
|
pcbIUScale.mmToIU( DEFAULT_PAD_HEIGTH_MM / 100.0 * DEFAULT_PAD_REACT_RADIUS ) );
|
||||||
|
}
|
||||||
|
|
|
@ -558,20 +558,35 @@ void DIALOG_PAD_PROPERTIES::initValues()
|
||||||
m_FlippedWarningSizer->Show( footprint->IsFlipped() );
|
m_FlippedWarningSizer->Show( footprint->IsFlipped() );
|
||||||
m_parentInfo->SetLabel( msg );
|
m_parentInfo->SetLabel( msg );
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
m_primitives = m_previewPad->GetPrimitives();
|
|
||||||
|
|
||||||
if( m_currentPad )
|
|
||||||
{
|
|
||||||
m_padNumCtrl->SetValue( m_previewPad->GetNumber() );
|
m_padNumCtrl->SetValue( m_previewPad->GetNumber() );
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
PAD_TOOL* padTool = m_parent->GetToolManager()->GetTool<PAD_TOOL>();
|
PAD_TOOL* padTool = m_parent->GetToolManager()->GetTool<PAD_TOOL>();
|
||||||
m_padNumCtrl->SetValue( padTool->GetLastPadNumber() );
|
m_padNumCtrl->SetValue( padTool->GetLastPadNumber() );
|
||||||
|
|
||||||
|
if( m_isFpEditor )
|
||||||
|
{
|
||||||
|
switch( m_board->Footprints()[0]->GetAttributes() )
|
||||||
|
{
|
||||||
|
case FOOTPRINT_ATTR_T::FP_THROUGH_HOLE:
|
||||||
|
m_previewPad->SetAttribute( PAD_ATTRIB::PTH );
|
||||||
|
|
||||||
|
if( m_previewPad->GetDrillSizeX() == 0 )
|
||||||
|
m_board->GetDesignSettings().SetDefaultMasterPad();
|
||||||
|
|
||||||
|
break;
|
||||||
|
|
||||||
|
case FOOTPRINT_ATTR_T::FP_SMD:
|
||||||
|
m_previewPad->SetAttribute( PAD_ATTRIB::SMD );
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
m_primitives = m_previewPad->GetPrimitives();
|
||||||
|
|
||||||
m_padNetSelector->SetSelectedNetcode( m_previewPad->GetNetCode() );
|
m_padNetSelector->SetSelectedNetcode( m_previewPad->GetNetCode() );
|
||||||
|
|
||||||
// Display current pad parameters units:
|
// Display current pad parameters units:
|
||||||
|
@ -965,15 +980,23 @@ void DIALOG_PAD_PROPERTIES::PadTypeSelected( wxCommandEvent& event )
|
||||||
|
|
||||||
m_gbSizerHole->Show( hasHole );
|
m_gbSizerHole->Show( hasHole );
|
||||||
m_staticline6->Show( hasHole );
|
m_staticline6->Show( hasHole );
|
||||||
|
|
||||||
if( !hasHole )
|
if( !hasHole )
|
||||||
{
|
{
|
||||||
m_holeX.ChangeValue( 0 );
|
m_holeX.ChangeValue( 0 );
|
||||||
m_holeY.ChangeValue( 0 );
|
m_holeY.ChangeValue( 0 );
|
||||||
}
|
}
|
||||||
else if ( m_holeX.GetValue() == 0 && m_currentPad )
|
else if( m_holeX.GetValue() == 0 )
|
||||||
{
|
{
|
||||||
m_holeX.ChangeValue( m_currentPad->GetDrillSize().x );
|
if( m_currentPad )
|
||||||
m_holeY.ChangeValue( m_currentPad->GetDrillSize().y );
|
{
|
||||||
|
m_holeX.ChangeValue( m_currentPad->GetDrillSize().x );
|
||||||
|
m_holeY.ChangeValue( m_currentPad->GetDrillSize().y );
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
m_holeX.ChangeValue( pcbIUScale.mmToIU( DEFAULT_PAD_DRILL_DIAMETER_MM ) );
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if( !hasConnection )
|
if( !hasConnection )
|
||||||
|
|
Loading…
Reference in New Issue