From 86938aa4259fb3e0aba3bd0ead6dbb50ae5aa349 Mon Sep 17 00:00:00 2001 From: Jeff Young Date: Sun, 14 Aug 2022 22:53:20 +0100 Subject: [PATCH] Read, write and process the board-wide Allow soldermask bridges in FPs. --- common/pcb.keywords | 1 + include/board_design_settings.h | 1 + pcbnew/board_design_settings.cpp | 2 ++ pcbnew/dialogs/panel_setup_mask_and_paste.cpp | 4 ++++ pcbnew/drc/drc_test_provider_solder_mask.cpp | 12 +++++++++--- pcbnew/plugins/kicad/pcb_parser.cpp | 5 +++++ pcbnew/plugins/kicad/pcb_plugin.cpp | 11 +++++++++++ 7 files changed, 33 insertions(+), 3 deletions(-) diff --git a/common/pcb.keywords b/common/pcb.keywords index 08f55a36bf..18dead66b8 100644 --- a/common/pcb.keywords +++ b/common/pcb.keywords @@ -30,6 +30,7 @@ aligned allowed allow_missing_courtyard allow_soldermask_bridges +allow_soldermask_bridges_in_footprints anchor angle arc diff --git a/include/board_design_settings.h b/include/board_design_settings.h index 895f03199f..881301d4a4 100644 --- a/include/board_design_settings.h +++ b/include/board_design_settings.h @@ -688,6 +688,7 @@ public: int m_SolderPasteMargin; // Solder paste margin absolute value double m_SolderPasteMarginRatio; // Solder mask margin ratio value of pad size // The final margin is the sum of these 2 values + bool m_AllowSoldermaskBridgesInFPs; std::shared_ptr m_NetSettings; diff --git a/pcbnew/board_design_settings.cpp b/pcbnew/board_design_settings.cpp index 8343f51481..2aceb4c3b8 100644 --- a/pcbnew/board_design_settings.cpp +++ b/pcbnew/board_design_settings.cpp @@ -204,6 +204,8 @@ BOARD_DESIGN_SETTINGS::BOARD_DESIGN_SETTINGS( JSON_SETTINGS* aParent, const std: // Usually < 0 because the mask is smaller than pad m_SolderPasteMarginRatio = DEFAULT_SOLDERPASTE_RATIO; + m_AllowSoldermaskBridgesInFPs = false; + // Layer thickness for 3D viewer m_boardThickness = Millimeter2iu( DEFAULT_BOARD_THICKNESS_MM ); diff --git a/pcbnew/dialogs/panel_setup_mask_and_paste.cpp b/pcbnew/dialogs/panel_setup_mask_and_paste.cpp index b6403ab482..2fedcf1568 100644 --- a/pcbnew/dialogs/panel_setup_mask_and_paste.cpp +++ b/pcbnew/dialogs/panel_setup_mask_and_paste.cpp @@ -62,6 +62,8 @@ bool PANEL_SETUP_MASK_AND_PASTE::TransferDataToWindow() m_pasteMargin.SetValue( m_BrdSettings->m_SolderPasteMargin ); m_pasteMarginRatio.SetDoubleValue( m_BrdSettings->m_SolderPasteMarginRatio * 100.0 ); + m_allowBridges->SetValue( m_BrdSettings->m_AllowSoldermaskBridgesInFPs ); + return true; } @@ -77,6 +79,8 @@ bool PANEL_SETUP_MASK_AND_PASTE::TransferDataFromWindow() m_BrdSettings->m_SolderPasteMargin = m_pasteMargin.GetValue(); m_BrdSettings->m_SolderPasteMarginRatio = m_pasteMarginRatio.GetDoubleValue() / 100.0; + m_BrdSettings->m_AllowSoldermaskBridgesInFPs = m_allowBridges->GetValue(); + return true; } diff --git a/pcbnew/drc/drc_test_provider_solder_mask.cpp b/pcbnew/drc/drc_test_provider_solder_mask.cpp index 866bc352a3..c605627b95 100644 --- a/pcbnew/drc/drc_test_provider_solder_mask.cpp +++ b/pcbnew/drc/drc_test_provider_solder_mask.cpp @@ -376,6 +376,7 @@ void DRC_TEST_PROVIDER_SOLDER_MASK::testItemAgainstItems( BOARD_ITEM* aItem, if( aItem->IsConnected() ) itemNet = static_cast( aItem )->GetNetCode(); + BOARD_DESIGN_SETTINGS& bds = aItem->GetBoard()->GetDesignSettings(); PAD* pad = dynamic_cast( aItem ); PCB_VIA* via = dynamic_cast( aItem ); std::shared_ptr itemShape = aItem->GetEffectiveShape( aRefLayer ); @@ -397,10 +398,15 @@ void DRC_TEST_PROVIDER_SOLDER_MASK::testItemAgainstItems( BOARD_ITEM* aItem, if( isNullAperture( other ) ) return false; - if( itemFP && itemFP == other->GetParentFootprint() - && ( itemFP->GetAttributes() & FP_ALLOW_SOLDERMASK_BRIDGES ) > 0 ) + if( itemFP && itemFP == other->GetParentFootprint() ) { - return false; + // Board-wide exclusion + if( bds.m_AllowSoldermaskBridgesInFPs ) + return false; + + // Footprint-specific exclusion + if( ( itemFP->GetAttributes() & FP_ALLOW_SOLDERMASK_BRIDGES ) > 0 ) + return false; } if( pad && otherPad && pad->SameLogicalPadAs( otherPad ) ) diff --git a/pcbnew/plugins/kicad/pcb_parser.cpp b/pcbnew/plugins/kicad/pcb_parser.cpp index 3905086b26..4a2fab9e5e 100644 --- a/pcbnew/plugins/kicad/pcb_parser.cpp +++ b/pcbnew/plugins/kicad/pcb_parser.cpp @@ -2131,6 +2131,11 @@ void PCB_PARSER::parseSetup() NeedRIGHT(); break; + case T_allow_soldermask_bridges_in_footprints: + bds.m_AllowSoldermaskBridgesInFPs = parseBool(); + NeedRIGHT(); + break; + case T_aux_axis_origin: { int x = parseBoardUnits( "auxiliary origin X" ); diff --git a/pcbnew/plugins/kicad/pcb_plugin.cpp b/pcbnew/plugins/kicad/pcb_plugin.cpp index 77871e8025..3205a9d61c 100644 --- a/pcbnew/plugins/kicad/pcb_plugin.cpp +++ b/pcbnew/plugins/kicad/pcb_plugin.cpp @@ -594,16 +594,27 @@ void PCB_PLUGIN::formatSetup( const BOARD* aBoard, int aNestLevel ) const FormatInternalUnits( dsnSettings.m_SolderMaskExpansion ).c_str() ); if( dsnSettings.m_SolderMaskMinWidth ) + { m_out->Print( aNestLevel+1, "(solder_mask_min_width %s)\n", FormatInternalUnits( dsnSettings.m_SolderMaskMinWidth ).c_str() ); + } if( dsnSettings.m_SolderPasteMargin != 0 ) + { m_out->Print( aNestLevel+1, "(pad_to_paste_clearance %s)\n", FormatInternalUnits( dsnSettings.m_SolderPasteMargin ).c_str() ); + } if( dsnSettings.m_SolderPasteMarginRatio != 0 ) + { m_out->Print( aNestLevel+1, "(pad_to_paste_clearance_ratio %s)\n", Double2Str( dsnSettings.m_SolderPasteMarginRatio ).c_str() ); + } + + if( dsnSettings.m_AllowSoldermaskBridgesInFPs ) + { + m_out->Print( aNestLevel+1, "(allow_soldermask_bridges_in_footprints yes)\n" ); + } VECTOR2I origin = dsnSettings.GetAuxOrigin();