From 4aab9f59aa42da38a61ee91ddc5ec5abdcb06c8e Mon Sep 17 00:00:00 2001 From: Jon Evans Date: Sun, 9 Jun 2024 12:44:30 -0400 Subject: [PATCH] ADDED: Support tenting control of individual vias REMOVED: Tenting option from plot dialog (tenting is now controlled from Board Setup and via properties) See https://gitlab.com/kicad/code/kicad/-/issues/2402 --- 3d-viewer/3d_canvas/create_layer_items.cpp | 10 +- common/pcb.keywords | 3 + include/board_design_settings.h | 2 + pcbnew/board.h | 5 - pcbnew/board_design_settings.cpp | 3 + pcbnew/dialogs/dialog_plot.cpp | 5 - pcbnew/dialogs/dialog_plot_base.cpp | 9 +- pcbnew/dialogs/dialog_plot_base.fbp | 478 ++++++------- pcbnew/dialogs/dialog_plot_base.h | 5 +- .../dialogs/dialog_track_via_properties.cpp | 23 + .../dialog_track_via_properties_base.cpp | 16 +- .../dialog_track_via_properties_base.fbp | 629 +++++++++++------- .../dialog_track_via_properties_base.h | 5 +- pcbnew/dialogs/panel_setup_mask_and_paste.cpp | 4 +- .../kicad_legacy/pcb_io_kicad_legacy.cpp | 3 + .../pcb_io/kicad_sexpr/pcb_io_kicad_sexpr.cpp | 15 + .../pcb_io/kicad_sexpr/pcb_io_kicad_sexpr.h | 3 +- .../kicad_sexpr/pcb_io_kicad_sexpr_parser.cpp | 35 + pcbnew/pcb_plot_params.cpp | 5 - pcbnew/pcb_plot_params.h | 6 +- pcbnew/pcb_track.cpp | 42 +- pcbnew/pcb_track.h | 10 + qa/data/pcbnew/padstacks.kicad_pcb | 38 +- 23 files changed, 775 insertions(+), 579 deletions(-) diff --git a/3d-viewer/3d_canvas/create_layer_items.cpp b/3d-viewer/3d_canvas/create_layer_items.cpp index e1de9abc4e..d61917fc89 100644 --- a/3d-viewer/3d_canvas/create_layer_items.cpp +++ b/3d-viewer/3d_canvas/create_layer_items.cpp @@ -875,14 +875,15 @@ void BOARD_ADAPTER::createLayers( REPORTER* aStatusReporter ) } // Add via tech layers - if( ( layer == F_Mask || layer == B_Mask ) && !m_board->GetTentVias() ) + if( ( layer == F_Mask || layer == B_Mask ) ) { int maskExpansion = GetBoard()->GetDesignSettings().m_SolderMaskExpansion; for( PCB_TRACK* track : m_board->Tracks() ) { if( track->Type() == PCB_VIA_T - && static_cast( track )->FlashLayer( layer ) ) + && static_cast( track )->FlashLayer( layer ) + && !static_cast( track )->IsTented() ) { createViaWithMargin( track, layerContainer, maskExpansion ); } @@ -966,14 +967,15 @@ void BOARD_ADAPTER::createLayers( REPORTER* aStatusReporter ) } // NON-TENTED VIAS - if( ( layer == F_Mask || layer == B_Mask ) && !m_board->GetTentVias() ) + if( ( layer == F_Mask || layer == B_Mask ) ) { int maskExpansion = GetBoard()->GetDesignSettings().m_SolderMaskExpansion; for( PCB_TRACK* track : m_board->Tracks() ) { if( track->Type() == PCB_VIA_T - && static_cast( track )->FlashLayer( layer ) ) + && static_cast( track )->FlashLayer( layer ) + && !static_cast( track )->IsTented() ) { track->TransformShapeToPolygon( *layerPoly, layer, maskExpansion, maxError, ERROR_INSIDE ); diff --git a/common/pcb.keywords b/common/pcb.keywords index 3b0bc62766..204393627b 100644 --- a/common/pcb.keywords +++ b/common/pcb.keywords @@ -47,6 +47,7 @@ attr autoplace_cost90 autoplace_cost180 aux_axis_origin +back best_length_ratio best_width_ratio bevelled @@ -138,6 +139,7 @@ fp_rect fp_text fp_text_box free +front full general generator @@ -314,6 +316,7 @@ title_block teardrop teardrops tedit +tenting text_frame text_position_mode thermal_width diff --git a/include/board_design_settings.h b/include/board_design_settings.h index 0c91a0a806..80319f2060 100644 --- a/include/board_design_settings.h +++ b/include/board_design_settings.h @@ -726,6 +726,8 @@ public: double m_SolderPasteMarginRatio; // Solder mask margin ratio value of pad size // The final margin is the sum of these 2 values bool m_AllowSoldermaskBridgesInFPs; + bool m_TentVias; // The default tenting option if not overridden on an + // individual via std::shared_ptr m_NetSettings; diff --git a/pcbnew/board.h b/pcbnew/board.h index 24214ec9ca..94b28bfd64 100644 --- a/pcbnew/board.h +++ b/pcbnew/board.h @@ -663,11 +663,6 @@ public: BOARD_STACKUP GetStackupOrDefault() const; - // Tented vias are vias covered by solder mask. So because the solder mask is a negative - // layer, tented vias are NOT plotted on solder mask layers - bool GetTentVias() const { return !m_plotOptions.GetPlotViaOnMaskLayer(); } - void SetTentVias( bool aFlag ) { m_plotOptions.SetPlotViaOnMaskLayer( !aFlag ); } - const PAGE_INFO& GetPageSettings() const { return m_paper; } void SetPageSettings( const PAGE_INFO& aPageSettings ) { m_paper = aPageSettings; } diff --git a/pcbnew/board_design_settings.cpp b/pcbnew/board_design_settings.cpp index 67becef3fc..12338f3381 100644 --- a/pcbnew/board_design_settings.cpp +++ b/pcbnew/board_design_settings.cpp @@ -210,6 +210,7 @@ BOARD_DESIGN_SETTINGS::BOARD_DESIGN_SETTINGS( JSON_SETTINGS* aParent, const std: m_SolderPasteMarginRatio = DEFAULT_SOLDERPASTE_RATIO; m_AllowSoldermaskBridgesInFPs = false; + m_TentVias = true; // Layer thickness for 3D viewer m_boardThickness = pcbIUScale.mmToIU( DEFAULT_BOARD_THICKNESS_MM ); @@ -955,6 +956,7 @@ void BOARD_DESIGN_SETTINGS::initFromOther( const BOARD_DESIGN_SETTINGS& aOther ) m_SolderPasteMargin = aOther.m_SolderPasteMargin; m_SolderPasteMarginRatio = aOther.m_SolderPasteMarginRatio; m_AllowSoldermaskBridgesInFPs = aOther.m_AllowSoldermaskBridgesInFPs; + m_TentVias = aOther.m_TentVias; m_DefaultFPTextItems = aOther.m_DefaultFPTextItems; std::copy( std::begin( aOther.m_LineThickness ), std::end( aOther.m_LineThickness ), @@ -1043,6 +1045,7 @@ bool BOARD_DESIGN_SETTINGS::operator==( const BOARD_DESIGN_SETTINGS& aOther ) co if( m_SolderPasteMargin != aOther.m_SolderPasteMargin ) return false; if( m_SolderPasteMarginRatio != aOther.m_SolderPasteMarginRatio ) return false; if( m_AllowSoldermaskBridgesInFPs != aOther.m_AllowSoldermaskBridgesInFPs ) return false; + if( m_TentVias != aOther.m_TentVias ) return false; if( m_DefaultFPTextItems != aOther.m_DefaultFPTextItems ) return false; if( !std::equal( std::begin( m_LineThickness ), std::end( m_LineThickness ), diff --git a/pcbnew/dialogs/dialog_plot.cpp b/pcbnew/dialogs/dialog_plot.cpp index 87f04b4bbf..91c1d24e1d 100644 --- a/pcbnew/dialogs/dialog_plot.cpp +++ b/pcbnew/dialogs/dialog_plot.cpp @@ -362,9 +362,6 @@ void DIALOG_PLOT::init_Dialog() // Plot mirror option m_plotMirrorOpt->SetValue( m_plotOpts.GetMirror() ); - // Plot vias on mask layer (not tented) or not (tented) - m_tentVias->SetValue( !m_plotOpts.GetPlotViaOnMaskLayer() ); - // Black and white plotting m_SVGColorChoice->SetSelection( m_plotOpts.GetBlackAndWhite() ? 1 : 0 ); m_PDFColorChoice->SetSelection( m_plotOpts.GetBlackAndWhite() ? 1 : 0 ); @@ -918,8 +915,6 @@ void DIALOG_PLOT::applyPlotSettings() sel = m_DXF_plotUnits->GetSelection(); tempOptions.SetDXFPlotUnits( sel == 0 ? DXF_UNITS::INCHES : DXF_UNITS::MILLIMETERS ); - tempOptions.SetPlotViaOnMaskLayer( !m_tentVias->GetValue() ); - if( !m_DXF_plotTextStrokeFontOpt->IsEnabled() ) // Currently, only DXF supports this option tempOptions.SetTextMode( PLOT_TEXT_MODE::DEFAULT ); else diff --git a/pcbnew/dialogs/dialog_plot_base.cpp b/pcbnew/dialogs/dialog_plot_base.cpp index e4f047f138..eb093c7274 100644 --- a/pcbnew/dialogs/dialog_plot_base.cpp +++ b/pcbnew/dialogs/dialog_plot_base.cpp @@ -1,5 +1,5 @@ /////////////////////////////////////////////////////////////////////////// -// C++ code generated with wxFormBuilder (version 4.0.0-0-g0efcecf) +// C++ code generated with wxFormBuilder (version 4.2.1-0-g80c4cb6) // http://www.wxformbuilder.org/ // // PLEASE DO *NOT* EDIT THIS FILE! @@ -106,11 +106,6 @@ DIALOG_PLOT_BASE::DIALOG_PLOT_BASE( wxWindow* parent, wxWindowID id, const wxStr m_zoneFillCheck = new wxCheckBox( sbOptionsSizer->GetStaticBox(), wxID_ANY, _("Check zone fills before plotting"), wxDefaultPosition, wxDefaultSize, 0 ); gbSizer1->Add( m_zoneFillCheck, wxGBPosition( 7, 0 ), wxGBSpan( 1, 1 ), wxALIGN_CENTER_VERTICAL|wxRIGHT, 5 ); - m_tentVias = new wxCheckBox( sbOptionsSizer->GetStaticBox(), wxID_ANY, _("Tent vias"), wxDefaultPosition, wxDefaultSize, 0 ); - m_tentVias->SetToolTip( _("Tented vias: not plotted on soldermask layer\nNot tented: vias are plotted on soldermask layer\n(Solder mask is a negative layer)") ); - - gbSizer1->Add( m_tentVias, wxGBPosition( 6, 1 ), wxGBSpan( 1, 2 ), wxALIGN_CENTER_VERTICAL|wxLEFT, 30 ); - drillMarksLabel = new wxStaticText( sbOptionsSizer->GetStaticBox(), wxID_ANY, _("Drill marks:"), wxDefaultPosition, wxDefaultSize, 0 ); drillMarksLabel->Wrap( -1 ); gbSizer1->Add( drillMarksLabel, wxGBPosition( 0, 1 ), wxGBSpan( 1, 1 ), wxALIGN_CENTER_VERTICAL|wxLEFT, 30 ); @@ -160,7 +155,7 @@ DIALOG_PLOT_BASE::DIALOG_PLOT_BASE( wxWindow* parent, wxWindowID id, const wxStr m_SizerSolderMaskAlert = new wxBoxSizer( wxHORIZONTAL ); - m_bitmapAlert = new wxStaticBitmap( this, wxID_ANY, wxArtProvider::GetBitmap( wxART_WARNING, wxART_CMN_DIALOG ), wxDefaultPosition, wxDefaultSize, 0 ); + m_bitmapAlert = new wxStaticBitmap( this, wxID_ANY, wxArtProvider::GetBitmap( wxASCII_STR(wxART_WARNING), wxASCII_STR(wxART_CMN_DIALOG) ), wxDefaultPosition, wxDefaultSize, 0 ); m_SizerSolderMaskAlert->Add( m_bitmapAlert, 0, wxEXPAND|wxTOP|wxBOTTOM|wxRIGHT, 5 ); wxBoxSizer* bSizerWarningText; diff --git a/pcbnew/dialogs/dialog_plot_base.fbp b/pcbnew/dialogs/dialog_plot_base.fbp index 4afbe0e60a..e1025cd495 100644 --- a/pcbnew/dialogs/dialog_plot_base.fbp +++ b/pcbnew/dialogs/dialog_plot_base.fbp @@ -1,34 +1,36 @@ - + - C++ - 1 - source_name - 0 - 0 + + 1 + connect + none + + + 0 + 1 res UTF-8 - connect dialog_plot_base 1000 - none - - 1 + 1 + UI Dialog_Plot_base - . - + 0 + source_name + 1 + 0 + source_name + + + 1 1 - 1 - 1 - 1 - UI - 0 - 1 0 + 0 0 wxAUI_MGR_DEFAULT @@ -81,10 +83,10 @@ 1 1 1 - + 0 - - + 0 + 0 @@ -143,10 +145,10 @@ 1 1 1 - + 0 - - + 0 + 0 @@ -219,10 +221,10 @@ 1 1 1 - + 0 - - + 0 + 0 @@ -281,10 +283,10 @@ 1 1 1 - + 0 - - + 0 + 0 @@ -346,10 +348,10 @@ 1 1 1 - + 0 - - + 0 + 0 0 @@ -444,10 +446,10 @@ 1 1 1 - + 0 - - + 0 + 0 @@ -549,10 +551,10 @@ 1 1 1 - + 0 - - + 0 + 0 @@ -617,10 +619,10 @@ 1 1 1 - + 0 - - + 0 + 0 @@ -686,10 +688,10 @@ 1 1 1 - + 0 - - + 0 + 0 @@ -755,10 +757,10 @@ 1 1 1 - + 0 - - + 0 + 0 @@ -824,10 +826,10 @@ 1 1 1 - + 0 - - + 0 + 0 @@ -892,10 +894,10 @@ 1 1 1 - + 0 - - + 0 + 0 @@ -961,10 +963,10 @@ 1 1 1 - + 0 - - + 0 + 0 @@ -1029,10 +1031,10 @@ 1 1 1 - + 0 - - + 0 + 0 @@ -1085,74 +1087,6 @@ - - 30 - 2 - 1 - wxALIGN_CENTER_VERTICAL|wxLEFT - 6 - 1 - - 1 - 1 - 1 - 1 - - - - - - - - 1 - 0 - 0 - 1 - - 1 - 0 - Dock - 0 - Left - 0 - 1 - - 1 - - 0 - 0 - wxID_ANY - Tent vias - - 0 - - - 0 - - 1 - m_tentVias - 1 - - - protected - 1 - - Resizable - 1 - - - - 0 - Tented vias: not plotted on soldermask layer Not tented: vias are plotted on soldermask layer (Solder mask is a negative layer) - - wxFILTER_NONE - wxDefaultValidator - - - - - - 30 1 @@ -1165,10 +1099,10 @@ 1 1 1 - + 0 - - + 0 + 0 @@ -1230,10 +1164,10 @@ 1 1 1 - + 0 - - + 0 + 0 @@ -1298,10 +1232,10 @@ 1 1 1 - + 0 - - + 0 + 0 @@ -1363,10 +1297,10 @@ 1 1 1 - + 0 - - + 0 + 0 @@ -1432,10 +1366,10 @@ 1 1 1 - + 0 - - + 0 + 0 @@ -1497,10 +1431,10 @@ 1 1 1 - + 0 - - + 0 + 0 @@ -1565,10 +1499,10 @@ 1 1 1 - + 0 - - + 0 + 0 @@ -1633,10 +1567,10 @@ 1 1 1 - + 0 - - + 0 + 0 @@ -1701,10 +1635,10 @@ 1 1 1 - + 0 - - + 0 + 0 @@ -1779,10 +1713,10 @@ 1 1 1 - + 0 - - + 0 + 0 Load From Art Provider; wxART_WARNING; wxART_CMN_DIALOG @@ -1847,10 +1781,10 @@ 1 1 1 - + 0 - - + 0 + 0 @@ -1909,10 +1843,10 @@ 1 1 1 - + 0 - - + 0 + 0 @@ -1990,10 +1924,10 @@ 1 1 1 - + 0 - - + 0 + 0 @@ -2091,10 +2025,10 @@ 1 1 1 - + 0 - - + 0 + 0 @@ -2159,10 +2093,10 @@ 1 1 1 - + 0 - - + 0 + 0 @@ -2227,10 +2161,10 @@ 1 1 1 - + 0 - - + 0 + 0 @@ -2295,10 +2229,10 @@ 1 1 1 - + 0 - - + 0 + 0 @@ -2360,10 +2294,10 @@ 1 1 1 - + 0 - - + 0 + 0 @@ -2428,10 +2362,10 @@ 1 1 1 - + 0 - - + 0 + 0 @@ -2497,10 +2431,10 @@ 1 1 1 - + 0 - - + 0 + 0 @@ -2565,10 +2499,10 @@ 1 1 1 - + 0 - - + 0 + 0 @@ -2646,10 +2580,10 @@ 1 1 1 - + 0 - - + 0 + 0 @@ -2708,10 +2642,10 @@ 1 1 1 - + 0 - - + 0 + 0 @@ -2773,10 +2707,10 @@ 1 1 1 - + 0 - - + 0 + 0 @@ -2875,10 +2809,10 @@ 1 1 1 - + 0 - - + 0 + 0 @@ -2937,10 +2871,10 @@ 1 1 1 - + 0 - - + 0 + 0 @@ -3012,10 +2946,10 @@ 1 1 1 - + 0 - - + 0 + 0 @@ -3074,10 +3008,10 @@ 1 1 1 - + 0 - - + 0 + 0 @@ -3149,10 +3083,10 @@ 1 1 1 - + 0 - - + 0 + 0 @@ -3211,10 +3145,10 @@ 1 1 1 - + 0 - - + 0 + 0 @@ -3276,10 +3210,10 @@ 1 1 1 - + 0 - - + 0 + 0 @@ -3340,10 +3274,10 @@ 1 1 1 - + 0 - - + 0 + 0 @@ -3437,10 +3371,10 @@ 1 1 1 - + 0 - - + 0 + 0 @@ -3506,10 +3440,10 @@ 1 1 1 - + 0 - - + 0 + 0 @@ -3571,10 +3505,10 @@ 1 1 1 - + 0 - - + 0 + 0 @@ -3639,10 +3573,10 @@ 1 1 1 - + 0 - - + 0 + 0 @@ -3738,10 +3672,10 @@ 1 1 1 - + 0 - - + 0 + 0 @@ -3803,10 +3737,10 @@ 1 1 1 - + 0 - - + 0 + 0 @@ -3869,10 +3803,10 @@ 1 1 1 - + 0 - - + 0 + 0 @@ -3934,10 +3868,10 @@ 1 1 1 - + 0 - - + 0 + 0 @@ -4033,10 +3967,10 @@ 1 1 1 - + 0 - - + 0 + 0 @@ -4098,10 +4032,10 @@ 1 1 1 - + 0 - - + 0 + 0 @@ -4166,10 +4100,10 @@ 1 1 1 - + 0 - - + 0 + 0 @@ -4234,10 +4168,10 @@ 1 1 1 - + 0 - - + 0 + 0 @@ -4302,10 +4236,10 @@ 1 1 1 - + 0 - - + 0 + 0 @@ -4384,10 +4318,10 @@ 1 1 1 - + 0 - - + 0 + 0 @@ -4453,10 +4387,10 @@ 1 1 1 - + 0 - - + 0 + 0 0 @@ -4528,10 +4462,10 @@ 1 1 1 - + 0 - - + 0 + 0 diff --git a/pcbnew/dialogs/dialog_plot_base.h b/pcbnew/dialogs/dialog_plot_base.h index 3572692d7c..d621729104 100644 --- a/pcbnew/dialogs/dialog_plot_base.h +++ b/pcbnew/dialogs/dialog_plot_base.h @@ -1,5 +1,5 @@ /////////////////////////////////////////////////////////////////////////// -// C++ code generated with wxFormBuilder (version 4.0.0-0-g0efcecf) +// C++ code generated with wxFormBuilder (version 4.2.1-0-g80c4cb6) // http://www.wxformbuilder.org/ // // PLEASE DO *NOT* EDIT THIS FILE! @@ -52,7 +52,7 @@ class DIALOG_PLOT_BASE : public DIALOG_SHIM { ID_PRINT_REF = 1000, ID_ALLOW_PRINT_PAD_ON_SILKSCREEN, - ID_MIROR_OPT + ID_MIROR_OPT, }; wxBoxSizer* m_MainSizer; @@ -73,7 +73,6 @@ class DIALOG_PLOT_BASE : public DIALOG_SHIM wxCheckBox* m_sketchPadsOnFabLayers; wxCheckBox* m_plotPadNumbers; wxCheckBox* m_zoneFillCheck; - wxCheckBox* m_tentVias; wxStaticText* drillMarksLabel; wxChoice* m_drillShapeOpt; wxStaticText* scalingLabel; diff --git a/pcbnew/dialogs/dialog_track_via_properties.cpp b/pcbnew/dialogs/dialog_track_via_properties.cpp index eef4d602f2..0c114043df 100644 --- a/pcbnew/dialogs/dialog_track_via_properties.cpp +++ b/pcbnew/dialogs/dialog_track_via_properties.cpp @@ -124,6 +124,20 @@ DIALOG_TRACK_VIA_PROPERTIES::DIALOG_TRACK_VIA_PROPERTIES( PCB_BASE_FRAME* aParen } }; + auto getTentingSelection = + []( const PCB_VIA* via ) -> int + { + if( via->Padstack().OuterLayerDefaults().has_solder_mask.has_value() ) + { + if( *via->Padstack().OuterLayerDefaults().has_solder_mask ) + return 1; // Tented + + return 2; // Not tented + } + + return 0; // From design rules + }; + // Look for values that are common for every item that is selected for( EDA_ITEM* item : m_items ) { @@ -197,6 +211,7 @@ DIALOG_TRACK_VIA_PROPERTIES::DIALOG_TRACK_VIA_PROPERTIES( PCB_BASE_FRAME* aParen viaType = v->GetViaType(); m_viaNotFree->SetValue( !v->GetIsFree() ); m_annularRingsCtrl->SetSelection( getAnnularRingSelection( v ) ); + m_tentingCtrl->SetSelection( getTentingSelection( v ) ); selection_first_layer = v->TopLayer(); selection_last_layer = v->BottomLayer(); @@ -665,6 +680,14 @@ bool DIALOG_TRACK_VIA_PROPERTIES::TransferDataFromWindow() break; } + switch( m_tentingCtrl->GetSelection() ) + { + default: + case 0: v->Padstack().OuterLayerDefaults().has_solder_mask.reset(); break; + case 1: v->Padstack().OuterLayerDefaults().has_solder_mask = true; break; + case 2: v->Padstack().OuterLayerDefaults().has_solder_mask = false; break; + } + v->SanitizeLayers(); if( !m_viaDiameter.IsIndeterminate() ) diff --git a/pcbnew/dialogs/dialog_track_via_properties_base.cpp b/pcbnew/dialogs/dialog_track_via_properties_base.cpp index 2daee5886c..fc2618607a 100644 --- a/pcbnew/dialogs/dialog_track_via_properties_base.cpp +++ b/pcbnew/dialogs/dialog_track_via_properties_base.cpp @@ -1,5 +1,5 @@ /////////////////////////////////////////////////////////////////////////// -// C++ code generated with wxFormBuilder (version 4.0.0-0-g0efcecf) +// C++ code generated with wxFormBuilder (version 4.2.1-0-g80c4cb6) // http://www.wxformbuilder.org/ // // PLEASE DO *NOT* EDIT THIS FILE! @@ -321,7 +321,19 @@ DIALOG_TRACK_VIA_PROPERTIES_BASE::DIALOG_TRACK_VIA_PROPERTIES_BASE( wxWindow* pa int m_annularRingsCtrlNChoices = sizeof( m_annularRingsCtrlChoices ) / sizeof( wxString ); m_annularRingsCtrl = new wxChoice( m_sbViaSizer->GetStaticBox(), wxID_ANY, wxDefaultPosition, wxDefaultSize, m_annularRingsCtrlNChoices, m_annularRingsCtrlChoices, 0 ); m_annularRingsCtrl->SetSelection( 1 ); - fgSizer4->Add( m_annularRingsCtrl, 0, wxALIGN_CENTER_VERTICAL|wxEXPAND, 5 ); + fgSizer4->Add( m_annularRingsCtrl, 0, wxALIGN_CENTER_VERTICAL|wxBOTTOM|wxEXPAND, 5 ); + + m_tentingLabel = new wxStaticText( m_sbViaSizer->GetStaticBox(), wxID_ANY, _("Tenting:"), wxDefaultPosition, wxDefaultSize, 0 ); + m_tentingLabel->Wrap( -1 ); + fgSizer4->Add( m_tentingLabel, 0, wxALIGN_CENTER_VERTICAL|wxLEFT|wxRIGHT, 5 ); + + wxString m_tentingCtrlChoices[] = { _("From design rules"), _("Tented"), _("Not tented") }; + int m_tentingCtrlNChoices = sizeof( m_tentingCtrlChoices ) / sizeof( wxString ); + m_tentingCtrl = new wxChoice( m_sbViaSizer->GetStaticBox(), wxID_ANY, wxDefaultPosition, wxDefaultSize, m_tentingCtrlNChoices, m_tentingCtrlChoices, 0 ); + m_tentingCtrl->SetSelection( 0 ); + m_tentingCtrl->SetToolTip( _("Whether to tent (cover with soldermask) this via") ); + + fgSizer4->Add( m_tentingCtrl, 0, wxALIGN_CENTER_VERTICAL|wxEXPAND, 5 ); viaRightColumn->Add( fgSizer4, 0, wxEXPAND|wxBOTTOM, 3 ); diff --git a/pcbnew/dialogs/dialog_track_via_properties_base.fbp b/pcbnew/dialogs/dialog_track_via_properties_base.fbp index 0a10ecf9f0..9574fe0911 100644 --- a/pcbnew/dialogs/dialog_track_via_properties_base.fbp +++ b/pcbnew/dialogs/dialog_track_via_properties_base.fbp @@ -1,34 +1,36 @@ - + - C++ - 1 - source_name - 0 - 0 + + 1 + connect + none + + + 0 + 0 res UTF-8 - connect dialog_track_via_properties_base 1000 - none - - 1 + 1 + UI DIALOG_TRACK_VIA_PROPERTIES_BASE - . - + 0 + source_name + 1 + 0 + source_name + + + 1 1 - 1 - 1 - 1 - UI - 0 - 0 0 + 0 0 wxAUI_MGR_DEFAULT @@ -101,10 +103,10 @@ 1 1 1 - + 0 - - + 0 + 0 @@ -163,10 +165,10 @@ 1 1 1 - + 0 - - + 0 + 0 @@ -237,10 +239,10 @@ 1 1 1 - + 0 - - + 0 + 0 @@ -307,10 +309,10 @@ 1 1 1 - + 0 - - + 0 + 0 @@ -376,10 +378,10 @@ 1 1 1 - + 0 - - + 0 + 0 @@ -480,10 +482,10 @@ 1 1 1 - + 0 - - + 0 + 0 @@ -542,10 +544,10 @@ 1 1 1 - + 0 - - + 0 + 0 @@ -607,10 +609,10 @@ 1 1 1 - + 0 - - + 0 + 0 @@ -669,10 +671,10 @@ 1 1 1 - + 0 - - + 0 + 0 @@ -734,10 +736,10 @@ 1 1 1 - + 0 - - + 0 + 0 @@ -796,10 +798,10 @@ 1 1 1 - + 0 - - + 0 + 0 @@ -858,10 +860,10 @@ 1 1 1 - + 0 - - + 0 + 0 @@ -923,10 +925,10 @@ 1 1 1 - + 0 - - + 0 + 0 @@ -985,10 +987,10 @@ 1 1 1 - + 0 - - + 0 + 0 @@ -1050,10 +1052,10 @@ 1 1 1 - + 0 - - + 0 + 0 @@ -1132,10 +1134,10 @@ 1 1 1 - + 0 - - + 0 + 0 @@ -1197,10 +1199,10 @@ 1 1 1 - + 0 - - + 0 + 0 @@ -1266,10 +1268,10 @@ 1 1 1 - + 0 - - + 0 + 0 @@ -1331,10 +1333,10 @@ 1 1 1 - + 0 - - + 0 + 0 @@ -1396,10 +1398,10 @@ 1 1 1 - + 0 - - + 0 + 0 @@ -1423,7 +1425,7 @@ 0 - + 0 0 @@ -1465,10 +1467,10 @@ 1 1 1 - + 0 - - + 0 + 0 @@ -1557,10 +1559,10 @@ 1 1 1 - + 0 - - + 0 + 0 @@ -1629,10 +1631,10 @@ 1 1 1 - + 0 - - + 0 + 0 @@ -1745,10 +1747,10 @@ 1 1 1 - + 0 - - + 0 + 0 @@ -1807,10 +1809,10 @@ 1 1 1 - + 0 - - + 0 + 0 @@ -1872,10 +1874,10 @@ 1 1 1 - + 0 - - + 0 + 0 @@ -1934,10 +1936,10 @@ 1 1 1 - + 0 - - + 0 + 0 @@ -1999,10 +2001,10 @@ 1 1 1 - + 0 - - + 0 + 0 @@ -2081,10 +2083,10 @@ 1 1 1 - + 0 - - + 0 + 0 @@ -2146,10 +2148,10 @@ 1 1 1 - + 0 - - + 0 + 0 @@ -2215,10 +2217,10 @@ 1 1 1 - + 0 - - + 0 + 0 @@ -2280,10 +2282,10 @@ 1 1 1 - + 0 - - + 0 + 0 @@ -2345,10 +2347,10 @@ 1 1 1 - + 0 - - + 0 + 0 @@ -2414,10 +2416,10 @@ 1 1 1 - + 0 - - + 0 + 0 @@ -2479,10 +2481,10 @@ 1 1 1 - + 0 - - + 0 + 0 @@ -2544,10 +2546,10 @@ 1 1 1 - + 0 - - + 0 + 0 @@ -2613,10 +2615,10 @@ 1 1 1 - + 0 - - + 0 + 0 @@ -2714,10 +2716,10 @@ 1 1 1 - + 0 - - + 0 + 0 @@ -2776,10 +2778,10 @@ 1 1 1 - + 0 - - + 0 + 0 @@ -2862,10 +2864,10 @@ 1 1 1 - + 0 - - + 0 + 0 @@ -2924,10 +2926,10 @@ 1 1 1 - + 0 - - + 0 + 0 @@ -2991,10 +2993,10 @@ 1 1 1 - + 0 - - + 0 + 0 @@ -3053,10 +3055,10 @@ 1 1 1 - + 0 - - + 0 + 0 @@ -3140,10 +3142,10 @@ 1 1 1 - + 0 - - + 0 + 0 @@ -3195,17 +3197,17 @@ 5 - wxALIGN_CENTER_VERTICAL|wxEXPAND + wxALIGN_CENTER_VERTICAL|wxBOTTOM|wxEXPAND 0 1 1 1 1 - + 0 - - + 0 + 0 @@ -3258,6 +3260,133 @@ + + 5 + wxALIGN_CENTER_VERTICAL|wxLEFT|wxRIGHT + 0 + + 1 + 1 + 1 + 1 + 0 + + 0 + 0 + + + + 1 + 0 + 1 + + 1 + 0 + Dock + 0 + Left + 0 + 1 + + 1 + + 0 + 0 + wxID_ANY + Tenting: + 0 + + 0 + + + 0 + + 1 + m_tentingLabel + 1 + + + protected + 1 + + Resizable + 1 + + + ; ; forward_declare + 0 + + + + + -1 + + + + 5 + wxALIGN_CENTER_VERTICAL|wxEXPAND + 0 + + 1 + 1 + 1 + 1 + 0 + + 0 + 0 + + + + 1 + 0 + "From design rules" "Tented" "Not tented" + 1 + + 1 + 0 + Dock + 0 + Left + 0 + 1 + + 1 + + 0 + 0 + wxID_ANY + + 0 + + + 0 + + 1 + m_tentingCtrl + 1 + + + protected + 1 + + Resizable + 0 + 1 + + + ; ; forward_declare + 0 + Whether to tent (cover with soldermask) this via + + wxFILTER_NONE + wxDefaultValidator + + + + + + @@ -3273,10 +3402,10 @@ 1 1 1 - + 0 - - + 0 + 0 @@ -3341,10 +3470,10 @@ 1 1 1 - + 0 - - + 0 + 0 @@ -3409,10 +3538,10 @@ 1 1 1 - + 0 - - + 0 + 0 @@ -3471,10 +3600,10 @@ 1 1 1 - + 0 - - + 0 + 0 @@ -3574,10 +3703,10 @@ 1 1 1 - + 0 - - + 0 + 0 @@ -3640,10 +3769,10 @@ 1 1 1 - + 0 - - + 0 + 0 @@ -3736,10 +3865,10 @@ 1 1 1 - + 0 - - + 0 + 0 @@ -3799,10 +3928,10 @@ 1 1 1 - + 0 - - + 0 + 0 @@ -3826,7 +3955,7 @@ 0 - + 0 0 @@ -3865,10 +3994,10 @@ 1 1 1 - + 0 - - + 0 + 0 @@ -3939,10 +4068,10 @@ 1 1 1 - + 0 - - + 0 + 0 @@ -4036,10 +4165,10 @@ 1 1 1 - + 0 - - + 0 + 0 @@ -4133,10 +4262,10 @@ 1 1 1 - + 0 - - + 0 + 0 @@ -4196,10 +4325,10 @@ 1 1 1 - + 0 - - + 0 + 0 @@ -4223,7 +4352,7 @@ 0 - + 0 0 @@ -4271,10 +4400,10 @@ 1 1 1 - + 0 - - + 0 + 0 @@ -4334,10 +4463,10 @@ 1 1 1 - + 0 - - + 0 + 0 @@ -4397,10 +4526,10 @@ 1 1 1 - + 0 - - + 0 + 0 @@ -4462,10 +4591,10 @@ 1 1 1 - + 0 - - + 0 + 0 @@ -4525,10 +4654,10 @@ 1 1 1 - + 0 - - + 0 + 0 @@ -4552,7 +4681,7 @@ 0 - + 0 0 @@ -4591,10 +4720,10 @@ 1 1 1 - + 0 - - + 0 + 0 @@ -4684,10 +4813,10 @@ 1 1 1 - + 0 - - + 0 + 0 @@ -4747,10 +4876,10 @@ 1 1 1 - + 0 - - + 0 + 0 @@ -4774,7 +4903,7 @@ 0 - + 0 0 @@ -4822,10 +4951,10 @@ 1 1 1 - + 0 - - + 0 + 0 @@ -4885,10 +5014,10 @@ 1 1 1 - + 0 - - + 0 + 0 @@ -4948,10 +5077,10 @@ 1 1 1 - + 0 - - + 0 + 0 @@ -5013,10 +5142,10 @@ 1 1 1 - + 0 - - + 0 + 0 @@ -5076,10 +5205,10 @@ 1 1 1 - + 0 - - + 0 + 0 @@ -5103,7 +5232,7 @@ 0 - + 0 0 @@ -5142,10 +5271,10 @@ 1 1 1 - + 0 - - + 0 + 0 @@ -5216,10 +5345,10 @@ 1 1 1 - + 0 - - + 0 + 0 @@ -5292,10 +5421,10 @@ 1 1 1 - + 0 - - + 0 + 0 @@ -5355,10 +5484,10 @@ 1 1 1 - + 0 - - + 0 + 0 diff --git a/pcbnew/dialogs/dialog_track_via_properties_base.h b/pcbnew/dialogs/dialog_track_via_properties_base.h index f18338bf15..850abfad51 100644 --- a/pcbnew/dialogs/dialog_track_via_properties_base.h +++ b/pcbnew/dialogs/dialog_track_via_properties_base.h @@ -1,5 +1,5 @@ /////////////////////////////////////////////////////////////////////////// -// C++ code generated with wxFormBuilder (version 4.0.0-0-g0efcecf) +// C++ code generated with wxFormBuilder (version 4.2.1-0-g80c4cb6) // http://www.wxformbuilder.org/ // // PLEASE DO *NOT* EDIT THIS FILE! @@ -38,7 +38,6 @@ class PCB_LAYER_BOX_SELECTOR; /////////////////////////////////////////////////////////////////////////// - /////////////////////////////////////////////////////////////////////////////// /// Class DIALOG_TRACK_VIA_PROPERTIES_BASE /////////////////////////////////////////////////////////////////////////////// @@ -102,6 +101,8 @@ class DIALOG_TRACK_VIA_PROPERTIES_BASE : public DIALOG_SHIM PCB_LAYER_BOX_SELECTOR* m_ViaEndLayer; wxStaticText* m_annularRingsLabel; wxChoice* m_annularRingsCtrl; + wxStaticText* m_tentingLabel; + wxChoice* m_tentingCtrl; wxStaticLine* m_staticline2; wxBoxSizer* m_legacyTeardropsWarning; wxStaticBitmap* m_legacyTeardropsIcon; diff --git a/pcbnew/dialogs/panel_setup_mask_and_paste.cpp b/pcbnew/dialogs/panel_setup_mask_and_paste.cpp index 02a559e03b..48e151c153 100644 --- a/pcbnew/dialogs/panel_setup_mask_and_paste.cpp +++ b/pcbnew/dialogs/panel_setup_mask_and_paste.cpp @@ -56,7 +56,7 @@ bool PANEL_SETUP_MASK_AND_PASTE::TransferDataToWindow() m_maskExpansion.SetValue( m_BrdSettings->m_SolderMaskExpansion ); m_maskMinWidth.SetValue( m_BrdSettings->m_SolderMaskMinWidth ); m_maskToCopperClearance.SetValue( m_BrdSettings->m_SolderMaskToCopperClearance ); - m_tentVias->SetValue( m_Frame->GetBoard()->GetTentVias() ); + m_tentVias->SetValue( m_BrdSettings->m_TentVias ); m_pasteMargin.SetValue( m_BrdSettings->m_SolderPasteMargin ); m_pasteMarginRatio.SetDoubleValue( m_BrdSettings->m_SolderPasteMarginRatio * 100.0 ); @@ -73,7 +73,7 @@ bool PANEL_SETUP_MASK_AND_PASTE::TransferDataFromWindow() m_BrdSettings->m_SolderMaskExpansion = m_maskExpansion.GetValue(); m_BrdSettings->m_SolderMaskMinWidth = m_maskMinWidth.GetValue(); m_BrdSettings->m_SolderMaskToCopperClearance = m_maskToCopperClearance.GetValue(); - m_Frame->GetBoard()->SetTentVias( m_tentVias->GetValue() ); + m_BrdSettings->m_TentVias = m_tentVias->GetValue(); m_BrdSettings->m_SolderPasteMargin = m_pasteMargin.GetValue(); m_BrdSettings->m_SolderPasteMarginRatio = m_pasteMarginRatio.GetDoubleValue() / 100.0; diff --git a/pcbnew/pcb_io/kicad_legacy/pcb_io_kicad_legacy.cpp b/pcbnew/pcb_io/kicad_legacy/pcb_io_kicad_legacy.cpp index 370b1af2d5..1261df17b6 100644 --- a/pcbnew/pcb_io/kicad_legacy/pcb_io_kicad_legacy.cpp +++ b/pcbnew/pcb_io/kicad_legacy/pcb_io_kicad_legacy.cpp @@ -926,6 +926,9 @@ void PCB_IO_KICAD_LEGACY::loadSETUP() plot_opts.Parse( &parser ); m_board->SetPlotOptions( plot_opts ); + + if( plot_opts.GetLegacyPlotViaOnMaskLayer().has_value() ) + m_board->GetDesignSettings().m_TentVias = *plot_opts.GetLegacyPlotViaOnMaskLayer(); } else if( TESTLINE( "AuxiliaryAxisOrg" ) ) diff --git a/pcbnew/pcb_io/kicad_sexpr/pcb_io_kicad_sexpr.cpp b/pcbnew/pcb_io/kicad_sexpr/pcb_io_kicad_sexpr.cpp index 7f95a5f58f..45048d08ad 100644 --- a/pcbnew/pcb_io/kicad_sexpr/pcb_io_kicad_sexpr.cpp +++ b/pcbnew/pcb_io/kicad_sexpr/pcb_io_kicad_sexpr.cpp @@ -587,6 +587,12 @@ void PCB_IO_KICAD_SEXPR::formatSetup( const BOARD* aBoard, int aNestLevel ) cons KICAD_FORMAT::FormatBool( m_out, aNestLevel + 1, "allow_soldermask_bridges_in_footprints", dsnSettings.m_AllowSoldermaskBridgesInFPs ); + // TODO support tenting top or bottom individually + if( dsnSettings.m_TentVias ) + m_out->Print( 0, " (tenting front back)" ); + else + m_out->Print( 0, " (tenting none)" ); + VECTOR2I origin = dsnSettings.GetAuxOrigin(); if( origin != VECTOR2I( 0, 0 ) ) @@ -2234,6 +2240,15 @@ void PCB_IO_KICAD_SEXPR::format( const PCB_TRACK* aTrack, int aNestLevel ) const m_out->Print( 0, ")" ); } + if( via->Padstack().OuterLayerDefaults().has_solder_mask.has_value() ) + { + // TODO support tenting top or bottom individually + if( *via->Padstack().OuterLayerDefaults().has_solder_mask ) + m_out->Print( 0, " (tenting top bottom)" ); + else + m_out->Print( 0, " (tenting none)" ); + } + if( !isDefaultTeardropParameters( via->GetTeardropParams() ) ) { m_out->Print( 0, "\n" ); diff --git a/pcbnew/pcb_io/kicad_sexpr/pcb_io_kicad_sexpr.h b/pcbnew/pcb_io/kicad_sexpr/pcb_io_kicad_sexpr.h index eb7f7a54ad..84789d5c83 100644 --- a/pcbnew/pcb_io/kicad_sexpr/pcb_io_kicad_sexpr.h +++ b/pcbnew/pcb_io/kicad_sexpr/pcb_io_kicad_sexpr.h @@ -153,7 +153,8 @@ class PCB_IO_KICAD_SEXPR; // forward decl //----------------- Start of 9.0 development ----------------- //#define SEXPR_BOARD_FILE_VERSION 20240201 // Use nullable properties for overrides //#define SEXPR_BOARD_FILE_VERSION 20240202 // Tables -#define SEXPR_BOARD_FILE_VERSION 20240225 // Rationalization of solder_paste_margin +//#define SEXPR_BOARD_FILE_VERSION 20240225 // Rationalization of solder_paste_margin +#define SEXPR_BOARD_FILE_VERSION 20240609 // Add 'tenting' keyword #define BOARD_FILE_HOST_VERSION 20200825 ///< Earlier files than this include the host tag #define LEGACY_ARC_FORMATTING 20210925 ///< These were the last to use old arc formatting diff --git a/pcbnew/pcb_io/kicad_sexpr/pcb_io_kicad_sexpr_parser.cpp b/pcbnew/pcb_io/kicad_sexpr/pcb_io_kicad_sexpr_parser.cpp index c86258f7e6..5bab1b913a 100644 --- a/pcbnew/pcb_io/kicad_sexpr/pcb_io_kicad_sexpr_parser.cpp +++ b/pcbnew/pcb_io/kicad_sexpr/pcb_io_kicad_sexpr_parser.cpp @@ -2316,6 +2316,21 @@ void PCB_IO_KICAD_SEXPR_PARSER::parseSetup() NeedRIGHT(); break; + case T_tenting: + { + for( token = NextTok(); token != T_RIGHT; token = NextTok() ) + { + // TODO support tenting top or bottom individually + if( token == T_front || token == T_back ) + bds.m_TentVias = true; + else if( token == T_none ) + bds.m_TentVias = false; + else + Expecting( "front, back, or none" ); + } + break; + } + case T_aux_axis_origin: { int x = parseBoardUnits( "auxiliary origin X" ); @@ -2378,6 +2393,10 @@ void PCB_IO_KICAD_SEXPR_PARSER::parseSetup() SyncLineReaderWith( parser ); m_board->SetPlotOptions( plotParams ); + + if( plotParams.GetLegacyPlotViaOnMaskLayer().has_value() ) + m_board->GetDesignSettings().m_TentVias = !*plotParams.GetLegacyPlotViaOnMaskLayer(); + break; } @@ -5815,6 +5834,22 @@ PCB_VIA* PCB_IO_KICAD_SEXPR_PARSER::parsePCB_VIA() parseTEARDROP_PARAMETERS( &via->GetTeardropParams() ); break; + case T_tenting: + { + // If the via has a tenting token, it means this individual via has a tenting override + for( token = NextTok(); token != T_RIGHT; token = NextTok() ) + { + // TODO support tenting top or bottom individually + if( token == T_front || token == T_back ) + via->Padstack().OuterLayerDefaults().has_solder_mask = true; + else if( token == T_none ) + via->Padstack().OuterLayerDefaults().has_solder_mask = false; + else + Expecting( "front, back, or none" ); + } + break; + } + case T_tstamp: case T_uuid: NextTok(); diff --git a/pcbnew/pcb_plot_params.cpp b/pcbnew/pcb_plot_params.cpp index 3d8773bb41..ee55951745 100644 --- a/pcbnew/pcb_plot_params.cpp +++ b/pcbnew/pcb_plot_params.cpp @@ -103,7 +103,6 @@ PCB_PLOT_PARAMS::PCB_PLOT_PARAMS() // we used 0.1mils for SVG step before, but nm precision is more accurate, so we use nm m_svgPrecision = SVG_PRECISION_DEFAULT; m_plotDrawingSheet = false; - m_plotViaOnMaskLayer = false; m_plotMode = FILLED; m_DXFPolygonMode = true; m_DXFUnits = DXF_UNITS::INCHES; @@ -209,7 +208,6 @@ void PCB_PLOT_PARAMS::Format( OUTPUTFORMATTER* aFormatter, aFormatter->Print( aNestLevel+1, "(svgprecision %d)\n", m_svgPrecision ); KICAD_FORMAT::FormatBool( aFormatter, aNestLevel + 1, "plotframeref", m_plotDrawingSheet ); - KICAD_FORMAT::FormatBool( aFormatter, aNestLevel + 1, "viasonmask", m_plotViaOnMaskLayer ); aFormatter->Print( aNestLevel+1, "(mode %d)\n", GetPlotMode() == SKETCH ? 2 : 1 ); KICAD_FORMAT::FormatBool( aFormatter, aNestLevel + 1, "useauxorigin", m_useAuxOrigin ); @@ -301,9 +299,6 @@ bool PCB_PLOT_PARAMS::IsSameAs( const PCB_PLOT_PARAMS &aPcbPlotParams ) const if( m_plotDrawingSheet != aPcbPlotParams.m_plotDrawingSheet ) return false; - if( m_plotViaOnMaskLayer != aPcbPlotParams.m_plotViaOnMaskLayer ) - return false; - if( m_plotMode != aPcbPlotParams.m_plotMode ) return false; diff --git a/pcbnew/pcb_plot_params.h b/pcbnew/pcb_plot_params.h index 2f695cd04c..f519fa7747 100644 --- a/pcbnew/pcb_plot_params.h +++ b/pcbnew/pcb_plot_params.h @@ -116,8 +116,7 @@ public: void SetNegative( bool aFlag ) { m_negative = aFlag; } bool GetNegative() const { return m_negative; } - void SetPlotViaOnMaskLayer( bool aFlag ) { m_plotViaOnMaskLayer = aFlag; } - bool GetPlotViaOnMaskLayer() const { return m_plotViaOnMaskLayer; } + std::optional GetLegacyPlotViaOnMaskLayer() const { return m_plotViaOnMaskLayer; } void SetPlotFrameRef( bool aFlag ) { m_plotDrawingSheet = aFlag; } bool GetPlotFrameRef() const { return m_plotDrawingSheet; } @@ -224,9 +223,8 @@ private: bool m_blackAndWhite; /// Plot in black and white only bool m_plotDrawingSheet; + std::optional m_plotViaOnMaskLayer; /// Deprecated; only used for reading legacy files - bool m_plotViaOnMaskLayer; /// True if vias are drawn on Mask layer (ie untented, - /// *exposed* by mask) bool m_subtractMaskFromSilk; /// On gerbers 'scrape' away the solder mask from /// silkscreen (trim silks) diff --git a/pcbnew/pcb_track.cpp b/pcbnew/pcb_track.cpp index 2fd6a01c4e..c0d0146649 100644 --- a/pcbnew/pcb_track.cpp +++ b/pcbnew/pcb_track.cpp @@ -769,12 +769,39 @@ std::shared_ptr PCB_VIA::GetEffectiveHoleShape() const } +void PCB_VIA::SetTentingMode( TENTING_MODE aMode ) +{ + switch( aMode ) + { + case TENTING_MODE::FROM_RULES: m_padStack.OuterLayerDefaults().has_solder_mask.reset(); break; + case TENTING_MODE::TENTED: m_padStack.OuterLayerDefaults().has_solder_mask = true; break; + case TENTING_MODE::NOT_TENTED: m_padStack.OuterLayerDefaults().has_solder_mask = false; break; + } +} + + +TENTING_MODE PCB_VIA::TentingMode() const +{ + if( m_padStack.OuterLayerDefaults().has_solder_mask.has_value() ) + { + return *m_padStack.OuterLayerDefaults().has_solder_mask ? + TENTING_MODE::TENTED : TENTING_MODE::NOT_TENTED; + } + + return TENTING_MODE::FROM_RULES; +} + + bool PCB_VIA::IsTented() const { + // TODO support tenting top or bottom individually + if( m_padStack.OuterLayerDefaults().has_solder_mask.has_value() ) + return *m_padStack.OuterLayerDefaults().has_solder_mask; + if( const BOARD* board = GetBoard() ) - return board->GetTentVias(); - else - return true; + return board->GetDesignSettings().m_TentVias; + + return true; } @@ -1640,6 +1667,12 @@ static struct TRACK_VIA_DESC .Map( VIATYPE::BLIND_BURIED, _HKI( "Blind/buried" ) ) .Map( VIATYPE::MICROVIA, _HKI( "Micro" ) ); + ENUM_MAP::Instance() + .Undefined( TENTING_MODE::FROM_RULES ) + .Map( TENTING_MODE::FROM_RULES, _HKI( "From design rules" ) ) + .Map( TENTING_MODE::TENTED, _HKI( "Tented" ) ) + .Map( TENTING_MODE::NOT_TENTED, _HKI( "Not tented" ) ); + ENUM_MAP& layerEnum = ENUM_MAP::Instance(); if( layerEnum.Choices().GetCount() == 0 ) @@ -1697,7 +1730,10 @@ static struct TRACK_VIA_DESC &PCB_VIA::SetBottomLayer, &PCB_VIA::BottomLayer ), groupVia ); propMgr.AddProperty( new PROPERTY_ENUM( _HKI( "Via Type" ), &PCB_VIA::SetViaType, &PCB_VIA::GetViaType ), groupVia ); + propMgr.AddProperty( new PROPERTY_ENUM( _HKI( "Tenting" ), + &PCB_VIA::SetTentingMode, &PCB_VIA::TentingMode ), groupVia ); } } _TRACK_VIA_DESC; ENUM_TO_WXANY( VIATYPE ); +ENUM_TO_WXANY( TENTING_MODE ); diff --git a/pcbnew/pcb_track.h b/pcbnew/pcb_track.h index a4afb2399f..348b4be782 100644 --- a/pcbnew/pcb_track.h +++ b/pcbnew/pcb_track.h @@ -70,6 +70,13 @@ enum class VIATYPE : int NOT_DEFINED = 0 /* not yet used */ }; +enum class TENTING_MODE +{ + FROM_RULES = 0, + TENTED = 1, + NOT_TENTED = 2 +}; + #define UNDEFINED_DRILL_DIAMETER -1 //< Undefined via drill diameter. // Used for tracks and vias for algorithmic safety, not to enforce constraints @@ -407,6 +414,9 @@ public: MINOPTMAX GetWidthConstraint( wxString* aSource = nullptr ) const override; MINOPTMAX GetDrillConstraint( wxString* aSource = nullptr ) const; + void SetTentingMode( TENTING_MODE aMode ); + TENTING_MODE TentingMode() const; + bool IsTented() const override; int GetSolderMaskExpansion() const; diff --git a/qa/data/pcbnew/padstacks.kicad_pcb b/qa/data/pcbnew/padstacks.kicad_pcb index e294570f3b..56868eb29b 100644 --- a/qa/data/pcbnew/padstacks.kicad_pcb +++ b/qa/data/pcbnew/padstacks.kicad_pcb @@ -1,7 +1,7 @@ (kicad_pcb - (version 20240108) + (version 20240609) (generator "pcbnew") - (generator_version "8.0") + (generator_version "8.99") (general (thickness 1.6) (legacy_teardrops no) @@ -128,6 +128,7 @@ ) (pad_to_mask_clearance 0) (allow_soldermask_bridges_in_footprints no) + (tenting front back) (pcbplotparams (layerselection 0x00010fc_ffffffff) (plot_on_all_layers_selection 0x0000000_00000000) @@ -140,7 +141,6 @@ (dashed_line_gap_ratio 3.000000) (svgprecision 4) (plotframeref no) - (viasonmask no) (mode 1) (useauxorigin no) (hpglpennumber 1) @@ -148,6 +148,7 @@ (hpglpendiameter 15.000000) (pdf_front_fp_property_popups yes) (pdf_back_fp_property_popups yes) + (pdf_metadata yes) (dxfpolygonmode yes) (dxfimperialunits yes) (dxfusepcbnewfont yes) @@ -158,10 +159,11 @@ (plotfptext yes) (plotinvisibletext no) (sketchpadsonfab no) + (plotpadnumbers no) (subtractmaskfromsilk no) (outputformat 1) (mirror no) - (drillshape 1) + (drillshape 0) (scaleselection 1) (outputdirectory "") ) @@ -911,8 +913,8 @@ ) (primitives (gr_bbox - (start -3.175 -4.1275) - (end -5.08 -0.9525) + (start -5.08 -4.1275) + (end -3.175 -0.9525) (fill no) ) (gr_poly @@ -940,8 +942,8 @@ (width 0.2) ) (gr_rect - (start 3.175 3.81) - (end 1.905 5.08) + (start 1.905 3.81) + (end 3.175 5.08) (width 0) (fill yes) ) @@ -1132,14 +1134,24 @@ (uuid "4da21d74-ca51-4030-841d-9fa4271dd639") ) (via - (at 122 82) - (size 0.7) - (drill 0.35) + (at 122 79.1) + (size 0.6) + (drill 0.3) (layers "F.Cu" "B.Cu") (remove_unused_layers yes) (keep_end_layers no) (free yes) (zone_layer_connections) + (net 2) + (uuid "993f27ea-49bf-4980-b2ed-b2764a799bb9") + ) + (via + (at 122 82) + (size 0.7) + (drill 0.35) + (layers "F.Cu" "B.Cu") + (free yes) + (tenting none) (teardrops (best_length_ratio 0.2) (max_length 0) @@ -1159,10 +1171,8 @@ (size 0.7) (drill 0.35) (layers "F.Cu" "B.Cu") - (remove_unused_layers yes) - (keep_end_layers yes) (free yes) - (zone_layer_connections) + (tenting front back) (teardrops (best_length_ratio 0.42) (max_length 0.75)