2013-02-12 01:07:04 +00:00
|
|
|
/*
|
|
|
|
* This program source code file is part of KiCad, a free EDA CAD application.
|
|
|
|
*
|
2023-06-03 15:59:00 +00:00
|
|
|
* Copyright (C) 1992-2023 KiCad Developers, see AUTHORS.txt for contributors.
|
2013-02-12 01:07:04 +00:00
|
|
|
*
|
|
|
|
* This program is free software; you can redistribute it and/or
|
|
|
|
* modify it under the terms of the GNU General Public License
|
|
|
|
* as published by the Free Software Foundation; either version 2
|
|
|
|
* of the License, or (at your option) any later version.
|
|
|
|
*
|
|
|
|
* This program is distributed in the hope that it will be useful,
|
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
* GNU General Public License for more details.
|
|
|
|
*
|
|
|
|
* You should have received a copy of the GNU General Public License
|
|
|
|
* along with this program; if not, you may find one here:
|
|
|
|
* http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
|
|
|
|
* or you may search the http://www.gnu.org website for the version 2 license,
|
|
|
|
* or you may write to the Free Software Foundation, Inc.,
|
|
|
|
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
|
|
|
|
*/
|
|
|
|
|
2021-06-11 16:59:28 +00:00
|
|
|
#include <pcb_dimension.h>
|
2021-06-11 21:07:02 +00:00
|
|
|
#include <pcb_track.h>
|
2021-07-29 09:47:43 +00:00
|
|
|
#include <layer_ids.h>
|
2021-09-14 22:45:14 +00:00
|
|
|
#include <kiface_base.h>
|
2021-06-06 19:03:10 +00:00
|
|
|
#include <pad.h>
|
2018-02-02 20:57:12 +00:00
|
|
|
#include <board_design_settings.h>
|
2020-09-15 19:13:45 +00:00
|
|
|
#include <drc/drc_item.h>
|
|
|
|
#include <drc/drc_engine.h>
|
2021-06-04 03:52:50 +00:00
|
|
|
#include <settings/json_settings_internals.h>
|
2020-05-31 21:42:04 +00:00
|
|
|
#include <settings/parameters.h>
|
|
|
|
#include <project/project_file.h>
|
2020-09-02 22:15:30 +00:00
|
|
|
#include <advanced_config.h>
|
2018-04-28 15:22:25 +00:00
|
|
|
|
2021-02-28 19:04:28 +00:00
|
|
|
const int bdsSchemaVersion = 2;
|
2018-04-28 15:22:25 +00:00
|
|
|
|
|
|
|
|
2020-05-31 21:42:04 +00:00
|
|
|
BOARD_DESIGN_SETTINGS::BOARD_DESIGN_SETTINGS( JSON_SETTINGS* aParent, const std::string& aPath ) :
|
2021-06-06 19:03:10 +00:00
|
|
|
NESTED_SETTINGS( "board_design_settings", bdsSchemaVersion, aParent, aPath )
|
2020-02-28 00:05:40 +00:00
|
|
|
{
|
2020-05-31 21:42:04 +00:00
|
|
|
// We want to leave alone parameters that aren't found in the project JSON as they may be
|
|
|
|
// initialized by the board file parser before NESTED_SETTINGS::LoadFromFile is called.
|
|
|
|
m_resetParamsIfMissing = false;
|
2020-02-28 00:05:40 +00:00
|
|
|
|
2022-08-14 11:03:18 +00:00
|
|
|
// Create a default NET_SETTINGS so that things don't break horribly if there's no project
|
2020-05-31 21:42:04 +00:00
|
|
|
// loaded. This also is used during file load for legacy boards that have netclasses stored
|
|
|
|
// in the file. After load, this information will be moved to the project and the pointer
|
|
|
|
// updated.
|
2022-08-14 11:03:18 +00:00
|
|
|
m_NetSettings = std::make_shared<NET_SETTINGS>( nullptr, "" );
|
2018-04-28 15:22:25 +00:00
|
|
|
|
2019-06-23 11:20:22 +00:00
|
|
|
m_HasStackup = false; // no stackup defined by default
|
2012-02-06 05:44:19 +00:00
|
|
|
|
2021-06-06 19:03:10 +00:00
|
|
|
m_Pad_Master = std::make_unique<PAD>( nullptr );
|
2024-03-02 00:13:39 +00:00
|
|
|
SetDefaultMasterPad();
|
2021-06-06 19:03:10 +00:00
|
|
|
|
2019-06-23 11:20:22 +00:00
|
|
|
LSET all_set = LSET().set();
|
2014-06-30 15:46:47 +00:00
|
|
|
m_enabledLayers = all_set; // All layers enabled at first.
|
|
|
|
// SetCopperLayerCount() will adjust this.
|
2011-09-23 13:57:12 +00:00
|
|
|
|
2014-06-30 15:46:47 +00:00
|
|
|
SetCopperLayerCount( 2 ); // Default design is a double sided board
|
2019-12-28 00:55:11 +00:00
|
|
|
m_CurrentViaType = VIATYPE::THROUGH;
|
2011-09-23 13:57:12 +00:00
|
|
|
|
|
|
|
// if true, when creating a new track starting on an existing track, use this track width
|
|
|
|
m_UseConnectedTrackWidth = false;
|
2021-12-16 04:17:04 +00:00
|
|
|
m_TempOverrideTrackWidth = false;
|
2011-09-23 13:57:12 +00:00
|
|
|
|
2020-05-08 18:10:47 +00:00
|
|
|
// First is always the reference designator
|
|
|
|
m_DefaultFPTextItems.emplace_back( wxT( "REF**" ), true, F_SilkS );
|
|
|
|
// Second is always the value
|
|
|
|
m_DefaultFPTextItems.emplace_back( wxT( "" ), true, F_Fab );
|
|
|
|
// Any following ones are freebies
|
2021-12-13 13:16:05 +00:00
|
|
|
m_DefaultFPTextItems.emplace_back( wxT( "${REFERENCE}" ), true, F_Fab );
|
2020-05-08 18:10:47 +00:00
|
|
|
|
2022-09-16 11:33:56 +00:00
|
|
|
m_LineThickness[ LAYER_CLASS_SILK ] = pcbIUScale.mmToIU( DEFAULT_SILK_LINE_WIDTH );
|
2023-02-19 03:40:07 +00:00
|
|
|
m_TextSize[ LAYER_CLASS_SILK ] = VECTOR2I( pcbIUScale.mmToIU( DEFAULT_SILK_TEXT_SIZE ),
|
|
|
|
pcbIUScale.mmToIU( DEFAULT_SILK_TEXT_SIZE ) );
|
2022-09-16 11:33:56 +00:00
|
|
|
m_TextThickness[ LAYER_CLASS_SILK ] = pcbIUScale.mmToIU( DEFAULT_SILK_TEXT_WIDTH );
|
2018-04-28 15:22:25 +00:00
|
|
|
m_TextItalic[ LAYER_CLASS_SILK ] = false;
|
2019-10-02 09:55:06 +00:00
|
|
|
m_TextUpright[ LAYER_CLASS_SILK ] = false;
|
2018-04-28 15:22:25 +00:00
|
|
|
|
2022-09-16 11:33:56 +00:00
|
|
|
m_LineThickness[ LAYER_CLASS_COPPER ] = pcbIUScale.mmToIU( DEFAULT_COPPER_LINE_WIDTH );
|
2023-02-19 03:40:07 +00:00
|
|
|
m_TextSize[ LAYER_CLASS_COPPER ] = VECTOR2I( pcbIUScale.mmToIU( DEFAULT_COPPER_TEXT_SIZE ),
|
|
|
|
pcbIUScale.mmToIU( DEFAULT_COPPER_TEXT_SIZE ) );
|
2022-09-16 11:33:56 +00:00
|
|
|
m_TextThickness[ LAYER_CLASS_COPPER ] = pcbIUScale.mmToIU( DEFAULT_COPPER_TEXT_WIDTH );
|
2018-04-28 15:22:25 +00:00
|
|
|
m_TextItalic[ LAYER_CLASS_COPPER ] = false;
|
2019-10-02 09:55:06 +00:00
|
|
|
m_TextUpright[ LAYER_CLASS_COPPER ] = false;
|
2018-04-28 15:22:25 +00:00
|
|
|
|
|
|
|
// Edges & Courtyards; text properties aren't used but better to have them holding
|
|
|
|
// reasonable values than not.
|
2022-09-16 11:33:56 +00:00
|
|
|
m_LineThickness[ LAYER_CLASS_EDGES ] = pcbIUScale.mmToIU( DEFAULT_EDGE_WIDTH );
|
2023-02-19 03:40:07 +00:00
|
|
|
m_TextSize[ LAYER_CLASS_EDGES ] = VECTOR2I( pcbIUScale.mmToIU( DEFAULT_TEXT_SIZE ),
|
|
|
|
pcbIUScale.mmToIU( DEFAULT_TEXT_SIZE ) );
|
2022-09-16 11:33:56 +00:00
|
|
|
m_TextThickness[ LAYER_CLASS_EDGES ] = pcbIUScale.mmToIU( DEFAULT_TEXT_WIDTH );
|
2018-04-28 15:22:25 +00:00
|
|
|
m_TextItalic[ LAYER_CLASS_EDGES ] = false;
|
2019-10-02 09:55:06 +00:00
|
|
|
m_TextUpright[ LAYER_CLASS_EDGES ] = false;
|
2018-04-28 15:22:25 +00:00
|
|
|
|
2022-09-16 11:33:56 +00:00
|
|
|
m_LineThickness[ LAYER_CLASS_COURTYARD ] = pcbIUScale.mmToIU( DEFAULT_COURTYARD_WIDTH );
|
2023-02-19 03:40:07 +00:00
|
|
|
m_TextSize[ LAYER_CLASS_COURTYARD ] = VECTOR2I( pcbIUScale.mmToIU( DEFAULT_TEXT_SIZE ),
|
|
|
|
pcbIUScale.mmToIU( DEFAULT_TEXT_SIZE ) );
|
2022-09-16 11:33:56 +00:00
|
|
|
m_TextThickness[ LAYER_CLASS_COURTYARD ] = pcbIUScale.mmToIU( DEFAULT_TEXT_WIDTH );
|
2018-08-24 20:08:30 +00:00
|
|
|
m_TextItalic[ LAYER_CLASS_COURTYARD ] = false;
|
2019-10-02 09:55:06 +00:00
|
|
|
m_TextUpright[ LAYER_CLASS_COURTYARD ] = false;
|
2018-08-24 20:08:30 +00:00
|
|
|
|
2022-09-16 11:33:56 +00:00
|
|
|
m_LineThickness[ LAYER_CLASS_FAB ] = pcbIUScale.mmToIU( DEFAULT_LINE_WIDTH );
|
2023-02-19 03:40:07 +00:00
|
|
|
m_TextSize[LAYER_CLASS_FAB] = VECTOR2I( pcbIUScale.mmToIU( DEFAULT_TEXT_SIZE ),
|
|
|
|
pcbIUScale.mmToIU( DEFAULT_TEXT_SIZE ) );
|
2022-09-16 11:33:56 +00:00
|
|
|
m_TextThickness[ LAYER_CLASS_FAB ] = pcbIUScale.mmToIU( DEFAULT_TEXT_WIDTH );
|
2020-05-01 16:24:01 +00:00
|
|
|
m_TextItalic[ LAYER_CLASS_FAB ] = false;
|
|
|
|
m_TextUpright[ LAYER_CLASS_FAB ] = false;
|
|
|
|
|
2022-09-16 11:33:56 +00:00
|
|
|
m_LineThickness[ LAYER_CLASS_OTHERS ] = pcbIUScale.mmToIU( DEFAULT_LINE_WIDTH );
|
2023-02-19 03:40:07 +00:00
|
|
|
m_TextSize[ LAYER_CLASS_OTHERS ] = VECTOR2I( pcbIUScale.mmToIU( DEFAULT_TEXT_SIZE ),
|
|
|
|
pcbIUScale.mmToIU( DEFAULT_TEXT_SIZE ) );
|
2022-09-16 11:33:56 +00:00
|
|
|
m_TextThickness[ LAYER_CLASS_OTHERS ] = pcbIUScale.mmToIU( DEFAULT_TEXT_WIDTH );
|
2018-04-28 15:22:25 +00:00
|
|
|
m_TextItalic[ LAYER_CLASS_OTHERS ] = false;
|
2019-10-02 09:55:06 +00:00
|
|
|
m_TextUpright[ LAYER_CLASS_OTHERS ] = false;
|
2012-04-08 23:32:32 +00:00
|
|
|
|
2023-10-02 21:18:31 +00:00
|
|
|
m_StyleFPFields = false;
|
|
|
|
m_StyleFPText = false;
|
|
|
|
m_StyleFPShapes = false;
|
|
|
|
|
2023-03-05 13:27:22 +00:00
|
|
|
m_DimensionPrecision = DIM_PRECISION::X_XXXX;
|
2020-09-12 00:36:43 +00:00
|
|
|
m_DimensionUnitsMode = DIM_UNITS_MODE::AUTOMATIC;
|
|
|
|
m_DimensionUnitsFormat = DIM_UNITS_FORMAT::BARE_SUFFIX;
|
2020-09-12 15:46:33 +00:00
|
|
|
m_DimensionSuppressZeroes = false;
|
2020-09-12 00:36:43 +00:00
|
|
|
m_DimensionTextPosition = DIM_TEXT_POSITION::OUTSIDE;
|
|
|
|
m_DimensionKeepTextAligned = true;
|
2022-09-16 23:42:20 +00:00
|
|
|
m_DimensionArrowLength = pcbIUScale.MilsToIU( DEFAULT_DIMENSION_ARROW_LENGTH );
|
2022-09-16 11:33:56 +00:00
|
|
|
m_DimensionExtensionOffset = pcbIUScale.mmToIU( DEFAULT_DIMENSION_EXTENSION_OFFSET );
|
2019-10-31 23:25:50 +00:00
|
|
|
|
2015-02-15 22:21:52 +00:00
|
|
|
m_useCustomTrackVia = false;
|
2022-09-16 11:33:56 +00:00
|
|
|
m_customTrackWidth = pcbIUScale.mmToIU( DEFAULT_CUSTOMTRACKWIDTH );
|
|
|
|
m_customViaSize.m_Diameter = pcbIUScale.mmToIU( DEFAULT_VIASMINSIZE );
|
|
|
|
m_customViaSize.m_Drill = pcbIUScale.mmToIU( DEFAULT_MINTHROUGHDRILL );
|
2015-06-15 15:54:58 +00:00
|
|
|
|
2018-04-28 15:22:25 +00:00
|
|
|
m_useCustomDiffPair = false;
|
2022-09-16 11:33:56 +00:00
|
|
|
m_customDiffPair.m_Width = pcbIUScale.mmToIU( DEFAULT_CUSTOMDPAIRWIDTH );
|
|
|
|
m_customDiffPair.m_Gap = pcbIUScale.mmToIU( DEFAULT_CUSTOMDPAIRGAP );
|
|
|
|
m_customDiffPair.m_ViaGap = pcbIUScale.mmToIU( DEFAULT_CUSTOMDPAIRVIAGAP );
|
|
|
|
|
|
|
|
m_MinClearance = pcbIUScale.mmToIU( DEFAULT_MINCLEARANCE );
|
|
|
|
m_MinConn = pcbIUScale.mmToIU( DEFAULT_MINCONNECTION );
|
|
|
|
m_TrackMinWidth = pcbIUScale.mmToIU( DEFAULT_TRACKMINWIDTH );
|
|
|
|
m_ViasMinAnnularWidth = pcbIUScale.mmToIU( DEFAULT_VIASMINSIZE - DEFAULT_MINTHROUGHDRILL ) / 2;
|
|
|
|
m_ViasMinSize = pcbIUScale.mmToIU( DEFAULT_VIASMINSIZE );
|
|
|
|
m_MinThroughDrill = pcbIUScale.mmToIU( DEFAULT_MINTHROUGHDRILL );
|
|
|
|
m_MicroViasMinSize = pcbIUScale.mmToIU( DEFAULT_MICROVIASMINSIZE );
|
|
|
|
m_MicroViasMinDrill = pcbIUScale.mmToIU( DEFAULT_MICROVIASMINDRILL );
|
|
|
|
m_CopperEdgeClearance = pcbIUScale.mmToIU( DEFAULT_COPPEREDGECLEARANCE );
|
|
|
|
m_HoleClearance = pcbIUScale.mmToIU( DEFAULT_HOLECLEARANCE );
|
|
|
|
m_HoleToHoleMin = pcbIUScale.mmToIU( DEFAULT_HOLETOHOLEMIN );
|
|
|
|
m_SilkClearance = pcbIUScale.mmToIU( DEFAULT_SILKCLEARANCE );
|
2021-08-09 10:10:09 +00:00
|
|
|
m_MinResolvedSpokes = DEFAULT_MINRESOLVEDSPOKES;
|
2022-09-16 11:33:56 +00:00
|
|
|
m_MinSilkTextHeight = pcbIUScale.mmToIU( DEFAULT_SILK_TEXT_SIZE * 0.8 );
|
|
|
|
m_MinSilkTextThickness= pcbIUScale.mmToIU( DEFAULT_SILK_TEXT_WIDTH * 0.8 );
|
2009-12-07 06:16:11 +00:00
|
|
|
|
2020-02-28 00:05:40 +00:00
|
|
|
for( int errorCode = DRCE_FIRST; errorCode <= DRCE_LAST; ++errorCode )
|
2020-03-04 09:48:18 +00:00
|
|
|
m_DRCSeverities[ errorCode ] = RPT_SEVERITY_ERROR;
|
2020-02-28 00:05:40 +00:00
|
|
|
|
2021-05-20 09:35:31 +00:00
|
|
|
m_DRCSeverities[ DRCE_DRILLED_HOLES_COLOCATED ] = RPT_SEVERITY_WARNING;
|
|
|
|
|
2020-05-07 13:35:50 +00:00
|
|
|
m_DRCSeverities[ DRCE_MISSING_COURTYARD ] = RPT_SEVERITY_IGNORE;
|
2020-05-14 21:01:39 +00:00
|
|
|
m_DRCSeverities[ DRCE_PTH_IN_COURTYARD ] = RPT_SEVERITY_IGNORE;
|
|
|
|
m_DRCSeverities[ DRCE_NPTH_IN_COURTYARD ] = RPT_SEVERITY_IGNORE;
|
2020-02-28 00:05:40 +00:00
|
|
|
|
2020-05-14 21:31:03 +00:00
|
|
|
m_DRCSeverities[ DRCE_DANGLING_TRACK ] = RPT_SEVERITY_WARNING;
|
|
|
|
m_DRCSeverities[ DRCE_DANGLING_VIA ] = RPT_SEVERITY_WARNING;
|
2020-05-14 21:11:53 +00:00
|
|
|
|
2021-08-11 13:01:30 +00:00
|
|
|
m_DRCSeverities[ DRCE_COPPER_SLIVER ] = RPT_SEVERITY_WARNING;
|
2022-03-01 19:21:09 +00:00
|
|
|
m_DRCSeverities[ DRCE_ISOLATED_COPPER ] = RPT_SEVERITY_WARNING;
|
2021-08-11 13:01:30 +00:00
|
|
|
|
2022-03-15 16:43:28 +00:00
|
|
|
m_DRCSeverities[ DRCE_PADSTACK ] = RPT_SEVERITY_WARNING;
|
|
|
|
|
2020-03-16 11:05:01 +00:00
|
|
|
m_DRCSeverities[ DRCE_MISSING_FOOTPRINT ] = RPT_SEVERITY_WARNING;
|
|
|
|
m_DRCSeverities[ DRCE_DUPLICATE_FOOTPRINT ] = RPT_SEVERITY_WARNING;
|
|
|
|
m_DRCSeverities[ DRCE_EXTRA_FOOTPRINT ] = RPT_SEVERITY_WARNING;
|
2020-09-04 09:32:20 +00:00
|
|
|
m_DRCSeverities[ DRCE_NET_CONFLICT ] = RPT_SEVERITY_WARNING;
|
2024-01-20 18:41:11 +00:00
|
|
|
m_DRCSeverities[ DRCE_SCHEMATIC_PARITY_ISSUES ] = RPT_SEVERITY_WARNING;
|
2020-03-16 11:05:01 +00:00
|
|
|
|
2021-07-11 22:29:04 +00:00
|
|
|
m_DRCSeverities[ DRCE_OVERLAPPING_SILK ] = RPT_SEVERITY_WARNING;
|
2021-08-12 16:58:30 +00:00
|
|
|
m_DRCSeverities[ DRCE_SILK_CLEARANCE ] = RPT_SEVERITY_WARNING;
|
2022-03-14 19:49:00 +00:00
|
|
|
m_DRCSeverities[ DRCE_SILK_EDGE_CLEARANCE ] = RPT_SEVERITY_WARNING;
|
2021-07-11 15:12:28 +00:00
|
|
|
m_DRCSeverities[ DRCE_TEXT_HEIGHT ] = RPT_SEVERITY_WARNING;
|
|
|
|
m_DRCSeverities[ DRCE_TEXT_THICKNESS ] = RPT_SEVERITY_WARNING;
|
2021-07-11 22:29:04 +00:00
|
|
|
|
2022-10-02 17:19:43 +00:00
|
|
|
m_DRCSeverities[ DRCE_FOOTPRINT_TYPE_MISMATCH ] = RPT_SEVERITY_IGNORE;
|
2022-10-02 18:30:43 +00:00
|
|
|
|
2022-03-18 19:35:40 +00:00
|
|
|
m_DRCSeverities[ DRCE_LIB_FOOTPRINT_ISSUES ] = RPT_SEVERITY_WARNING;
|
|
|
|
m_DRCSeverities[ DRCE_LIB_FOOTPRINT_MISMATCH ] = RPT_SEVERITY_WARNING;
|
|
|
|
|
2022-10-02 17:19:43 +00:00
|
|
|
m_DRCSeverities[ DRCE_CONNECTION_WIDTH ] = RPT_SEVERITY_WARNING;
|
2022-07-11 19:26:56 +00:00
|
|
|
|
2020-03-16 11:05:01 +00:00
|
|
|
m_MaxError = ARC_HIGH_DEF;
|
2022-02-11 12:42:09 +00:00
|
|
|
m_ZoneKeepExternalFillets = false;
|
2021-05-11 02:11:58 +00:00
|
|
|
m_UseHeightForLengthCalcs = true;
|
2019-05-22 14:47:38 +00:00
|
|
|
|
2009-11-04 19:08:08 +00:00
|
|
|
// Global mask margins:
|
2022-09-16 11:33:56 +00:00
|
|
|
m_SolderMaskExpansion = pcbIUScale.mmToIU( DEFAULT_SOLDERMASK_EXPANSION );
|
|
|
|
m_SolderMaskMinWidth = pcbIUScale.mmToIU( DEFAULT_SOLDERMASK_MIN_WIDTH );
|
|
|
|
m_SolderMaskToCopperClearance = pcbIUScale.mmToIU( DEFAULT_SOLDERMASK_TO_COPPER_CLEARANCE );
|
2021-02-28 19:04:28 +00:00
|
|
|
|
|
|
|
// Solder paste margin absolute value
|
2022-09-16 11:33:56 +00:00
|
|
|
m_SolderPasteMargin = pcbIUScale.mmToIU( DEFAULT_SOLDERPASTE_CLEARANCE );
|
2021-02-28 19:04:28 +00:00
|
|
|
// Solder paste margin as a ratio of pad size
|
|
|
|
// The final margin is the sum of these 2 values
|
|
|
|
// Usually < 0 because the mask is smaller than pad
|
|
|
|
m_SolderPasteMarginRatio = DEFAULT_SOLDERPASTE_RATIO;
|
|
|
|
|
2022-08-14 21:53:20 +00:00
|
|
|
m_AllowSoldermaskBridgesInFPs = false;
|
|
|
|
|
2011-09-23 13:57:12 +00:00
|
|
|
// Layer thickness for 3D viewer
|
2022-09-16 11:33:56 +00:00
|
|
|
m_boardThickness = pcbIUScale.mmToIU( DEFAULT_BOARD_THICKNESS_MM );
|
2014-05-13 09:22:51 +00:00
|
|
|
|
2024-02-19 14:59:09 +00:00
|
|
|
// Default spacing for meanders
|
|
|
|
m_SingleTrackMeanderSettings.m_spacing = pcbIUScale.mmToIU( DEFAULT_MEANDER_SPACING );
|
|
|
|
m_SkewMeanderSettings.m_spacing = pcbIUScale.mmToIU( DEFAULT_MEANDER_SPACING );
|
|
|
|
m_DiffPairMeanderSettings.m_spacing = pcbIUScale.mmToIU( DEFAULT_DP_MEANDER_SPACING );
|
|
|
|
|
2014-05-13 09:22:51 +00:00
|
|
|
m_viaSizeIndex = 0;
|
|
|
|
m_trackWidthIndex = 0;
|
2018-04-28 15:22:25 +00:00
|
|
|
m_diffPairIndex = 0;
|
2009-10-28 11:48:47 +00:00
|
|
|
|
2020-05-31 21:42:04 +00:00
|
|
|
// Parameters stored in JSON in the project file
|
2020-01-12 18:40:50 +00:00
|
|
|
|
2020-05-31 21:42:04 +00:00
|
|
|
// NOTE: Previously, BOARD_DESIGN_SETTINGS stored the basic board layer information (layer
|
|
|
|
// names and enable/disable state) in the project file even though this information is also
|
|
|
|
// stored in the board file. This was implemented for importing these settings from another
|
|
|
|
// project. Going forward, the import feature will just import from other board files (since
|
|
|
|
// we could have multi-board projects in the future anyway) so this functionality is dropped.
|
2020-01-12 18:40:50 +00:00
|
|
|
|
2020-05-04 21:05:30 +00:00
|
|
|
|
2021-05-11 02:11:58 +00:00
|
|
|
m_params.emplace_back( new PARAM<bool>( "rules.use_height_for_length_calcs",
|
|
|
|
&m_UseHeightForLengthCalcs, true ) );
|
|
|
|
|
2021-08-25 23:14:36 +00:00
|
|
|
m_params.emplace_back( new PARAM_SCALED<int>( "rules.min_clearance",
|
2022-09-16 11:33:56 +00:00
|
|
|
&m_MinClearance, pcbIUScale.mmToIU( DEFAULT_MINCLEARANCE ),
|
2023-04-15 12:20:03 +00:00
|
|
|
pcbIUScale.mmToIU( 0.00 ), pcbIUScale.mmToIU( 25.0 ), pcbIUScale.MM_PER_IU ) );
|
2020-01-12 18:40:50 +00:00
|
|
|
|
2022-07-11 19:26:56 +00:00
|
|
|
m_params.emplace_back( new PARAM_SCALED<int>( "rules.min_connection",
|
2022-09-16 11:33:56 +00:00
|
|
|
&m_MinConn, pcbIUScale.mmToIU( DEFAULT_MINCONNECTION ),
|
2022-09-16 22:56:24 +00:00
|
|
|
pcbIUScale.mmToIU( 0.00 ), pcbIUScale.mmToIU( 100.0 ), pcbIUScale.MM_PER_IU ) );
|
2022-07-11 19:26:56 +00:00
|
|
|
|
2021-08-25 23:14:36 +00:00
|
|
|
m_params.emplace_back( new PARAM_SCALED<int>( "rules.min_track_width",
|
2022-09-16 11:33:56 +00:00
|
|
|
&m_TrackMinWidth, pcbIUScale.mmToIU( DEFAULT_TRACKMINWIDTH ),
|
2023-04-15 12:20:03 +00:00
|
|
|
pcbIUScale.mmToIU( 0.00 ), pcbIUScale.mmToIU( 25.0 ), pcbIUScale.MM_PER_IU ) );
|
2020-05-11 19:39:30 +00:00
|
|
|
|
2021-06-26 09:11:22 +00:00
|
|
|
m_params.emplace_back( new PARAM_SCALED<int>( "rules.min_via_annular_width",
|
2023-04-15 12:20:03 +00:00
|
|
|
&m_ViasMinAnnularWidth, pcbIUScale.mmToIU( DEFAULT_VIASMINSIZE ),
|
|
|
|
pcbIUScale.mmToIU( 0.00 ), pcbIUScale.mmToIU( 25.0 ), pcbIUScale.MM_PER_IU ) );
|
2020-01-12 18:40:50 +00:00
|
|
|
|
2021-08-25 23:14:36 +00:00
|
|
|
m_params.emplace_back( new PARAM_SCALED<int>( "rules.min_via_diameter",
|
2022-09-16 11:33:56 +00:00
|
|
|
&m_ViasMinSize, pcbIUScale.mmToIU( DEFAULT_VIASMINSIZE ),
|
2023-04-15 12:20:03 +00:00
|
|
|
pcbIUScale.mmToIU( 0.00 ), pcbIUScale.mmToIU( 25.0 ), pcbIUScale.MM_PER_IU ) );
|
2020-01-12 18:40:50 +00:00
|
|
|
|
2020-05-31 21:42:04 +00:00
|
|
|
m_params.emplace_back( new PARAM_SCALED<int>( "rules.min_through_hole_diameter",
|
2022-09-16 11:33:56 +00:00
|
|
|
&m_MinThroughDrill, pcbIUScale.mmToIU( DEFAULT_MINTHROUGHDRILL ),
|
2023-04-15 12:20:03 +00:00
|
|
|
pcbIUScale.mmToIU( 0.00 ), pcbIUScale.mmToIU( 25.0 ), pcbIUScale.MM_PER_IU ) );
|
2020-01-12 18:40:50 +00:00
|
|
|
|
2020-05-31 21:42:04 +00:00
|
|
|
m_params.emplace_back( new PARAM_SCALED<int>( "rules.min_microvia_diameter",
|
2022-09-16 11:33:56 +00:00
|
|
|
&m_MicroViasMinSize, pcbIUScale.mmToIU( DEFAULT_MICROVIASMINSIZE ),
|
2023-04-15 12:20:03 +00:00
|
|
|
pcbIUScale.mmToIU( 0.00 ), pcbIUScale.mmToIU( 10.0 ), pcbIUScale.MM_PER_IU ) );
|
2020-01-12 18:40:50 +00:00
|
|
|
|
2021-08-25 23:14:36 +00:00
|
|
|
m_params.emplace_back( new PARAM_SCALED<int>( "rules.min_microvia_drill",
|
2022-09-16 11:33:56 +00:00
|
|
|
&m_MicroViasMinDrill, pcbIUScale.mmToIU( DEFAULT_MICROVIASMINDRILL ),
|
2023-04-15 12:20:03 +00:00
|
|
|
pcbIUScale.mmToIU( 0.00 ), pcbIUScale.mmToIU( 10.0 ), pcbIUScale.MM_PER_IU ) );
|
2020-01-12 18:40:50 +00:00
|
|
|
|
2021-08-25 23:14:36 +00:00
|
|
|
m_params.emplace_back( new PARAM_SCALED<int>( "rules.min_hole_to_hole",
|
2022-09-16 11:33:56 +00:00
|
|
|
&m_HoleToHoleMin, pcbIUScale.mmToIU( DEFAULT_HOLETOHOLEMIN ),
|
2022-09-16 22:56:24 +00:00
|
|
|
pcbIUScale.mmToIU( 0.00 ), pcbIUScale.mmToIU( 10.0 ), pcbIUScale.MM_PER_IU ) );
|
2020-02-28 00:05:40 +00:00
|
|
|
|
2021-08-25 23:14:36 +00:00
|
|
|
m_params.emplace_back( new PARAM_SCALED<int>( "rules.min_hole_clearance",
|
2022-09-16 11:33:56 +00:00
|
|
|
&m_HoleClearance, pcbIUScale.mmToIU( DEFAULT_HOLECLEARANCE ),
|
2022-09-16 22:56:24 +00:00
|
|
|
pcbIUScale.mmToIU( 0.00 ), pcbIUScale.mmToIU( 100.0 ), pcbIUScale.MM_PER_IU ) );
|
2020-11-29 22:01:40 +00:00
|
|
|
|
2021-08-25 23:14:36 +00:00
|
|
|
m_params.emplace_back( new PARAM_SCALED<int>( "rules.min_silk_clearance",
|
2022-09-16 11:33:56 +00:00
|
|
|
&m_SilkClearance, pcbIUScale.mmToIU( DEFAULT_SILKCLEARANCE ),
|
2022-09-16 22:56:24 +00:00
|
|
|
pcbIUScale.mmToIU( 0.00 ), pcbIUScale.mmToIU( 100.0 ), pcbIUScale.MM_PER_IU ) );
|
2020-10-12 13:10:50 +00:00
|
|
|
|
2022-02-06 11:35:32 +00:00
|
|
|
// While the maximum *effective* value is 4, we've had users interpret this as the count on
|
|
|
|
// all layers, and enter something like 10. They'll figure it out soon enough *unless* we
|
|
|
|
// enforce a max of 4 (and therefore reset it back to the default of 2), at which point it
|
|
|
|
// just looks buggy.
|
2021-08-09 10:10:09 +00:00
|
|
|
m_params.emplace_back( new PARAM<int>( "rules.min_resolved_spokes",
|
2022-02-06 11:35:32 +00:00
|
|
|
&m_MinResolvedSpokes, DEFAULT_MINRESOLVEDSPOKES, 0, 99 ) );
|
2021-08-09 10:10:09 +00:00
|
|
|
|
2021-08-25 23:14:36 +00:00
|
|
|
m_params.emplace_back( new PARAM_SCALED<int>( "rules.min_text_height",
|
2022-09-16 11:33:56 +00:00
|
|
|
&m_MinSilkTextHeight, pcbIUScale.mmToIU( DEFAULT_SILK_TEXT_SIZE * 0.8 ),
|
2022-09-16 22:56:24 +00:00
|
|
|
pcbIUScale.mmToIU( 0.00 ), pcbIUScale.mmToIU( 100.0 ), pcbIUScale.MM_PER_IU ) );
|
2021-07-11 15:12:28 +00:00
|
|
|
|
2021-08-25 23:14:36 +00:00
|
|
|
m_params.emplace_back( new PARAM_SCALED<int>( "rules.min_text_thickness",
|
2022-09-16 11:33:56 +00:00
|
|
|
&m_MinSilkTextThickness, pcbIUScale.mmToIU( DEFAULT_SILK_TEXT_WIDTH * 0.8 ),
|
2022-09-16 22:56:24 +00:00
|
|
|
pcbIUScale.mmToIU( 0.00 ), pcbIUScale.mmToIU( 25.0 ), pcbIUScale.MM_PER_IU ) );
|
2021-07-11 15:12:28 +00:00
|
|
|
|
2020-01-12 18:40:50 +00:00
|
|
|
// Note: a clearance of -0.01 is a flag indicating we should use the legacy (pre-6.0) method
|
|
|
|
// based on the edge cut thicknesses.
|
2020-05-31 21:42:04 +00:00
|
|
|
m_params.emplace_back( new PARAM_SCALED<int>( "rules.min_copper_edge_clearance",
|
2023-12-03 04:25:06 +00:00
|
|
|
&m_CopperEdgeClearance, pcbIUScale.mmToIU( DEFAULT_COPPEREDGECLEARANCE ),
|
2022-09-16 22:56:24 +00:00
|
|
|
pcbIUScale.mmToIU( -0.01 ), pcbIUScale.mmToIU( 25.0 ), pcbIUScale.MM_PER_IU ) );
|
2020-05-31 21:42:04 +00:00
|
|
|
|
|
|
|
m_params.emplace_back( new PARAM_LAMBDA<nlohmann::json>( "rule_severities",
|
|
|
|
[&]() -> nlohmann::json
|
|
|
|
{
|
|
|
|
nlohmann::json ret = {};
|
|
|
|
|
2020-06-08 02:19:46 +00:00
|
|
|
for( const RC_ITEM& item : DRC_ITEM::GetItemsWithSeverities() )
|
2020-05-31 21:42:04 +00:00
|
|
|
{
|
2020-12-14 13:33:51 +00:00
|
|
|
wxString name = item.GetSettingsKey();
|
|
|
|
int code = item.GetErrorCode();
|
2020-06-08 02:19:46 +00:00
|
|
|
|
2020-12-14 13:33:51 +00:00
|
|
|
if( name.IsEmpty() || m_DRCSeverities.count( code ) == 0 )
|
2020-05-31 21:42:04 +00:00
|
|
|
continue;
|
|
|
|
|
2020-12-14 13:33:51 +00:00
|
|
|
ret[std::string( name.ToUTF8() )] = SeverityToString( m_DRCSeverities[code] );
|
2020-05-31 21:42:04 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
return ret;
|
|
|
|
},
|
|
|
|
[&]( const nlohmann::json& aJson )
|
|
|
|
{
|
|
|
|
if( !aJson.is_object() )
|
|
|
|
return;
|
|
|
|
|
2020-06-08 02:19:46 +00:00
|
|
|
for( const RC_ITEM& item : DRC_ITEM::GetItemsWithSeverities() )
|
2020-05-31 21:42:04 +00:00
|
|
|
{
|
2020-06-08 02:19:46 +00:00
|
|
|
wxString name = item.GetSettingsKey();
|
2020-05-31 21:42:04 +00:00
|
|
|
std::string key( name.ToUTF8() );
|
|
|
|
|
|
|
|
if( aJson.contains( key ) )
|
2020-06-08 02:19:46 +00:00
|
|
|
m_DRCSeverities[item.GetErrorCode()] = SeverityFromString( aJson[key] );
|
2020-05-31 21:42:04 +00:00
|
|
|
}
|
|
|
|
}, {} ) );
|
|
|
|
|
|
|
|
m_params.emplace_back( new PARAM_LAMBDA<nlohmann::json>( "drc_exclusions",
|
|
|
|
[&]() -> nlohmann::json
|
|
|
|
{
|
|
|
|
nlohmann::json js = nlohmann::json::array();
|
|
|
|
|
2024-01-29 15:59:28 +00:00
|
|
|
for( const wxString& entry : m_DrcExclusions )
|
|
|
|
js.push_back( { entry, m_DrcExclusionComments[ entry ] } );
|
2020-05-31 21:42:04 +00:00
|
|
|
|
|
|
|
return js;
|
|
|
|
},
|
|
|
|
[&]( const nlohmann::json& aObj )
|
|
|
|
{
|
|
|
|
m_DrcExclusions.clear();
|
|
|
|
|
|
|
|
if( !aObj.is_array() )
|
|
|
|
return;
|
|
|
|
|
|
|
|
for( const nlohmann::json& entry : aObj )
|
|
|
|
{
|
2024-01-29 15:59:28 +00:00
|
|
|
if( entry.is_array() )
|
|
|
|
{
|
|
|
|
wxString serialized = entry[0].get<wxString>();
|
|
|
|
m_DrcExclusions.insert( serialized );
|
|
|
|
m_DrcExclusionComments[ serialized ] = entry[1].get<wxString>();
|
|
|
|
}
|
|
|
|
else if( entry.is_string() )
|
|
|
|
{
|
|
|
|
m_DrcExclusions.insert( entry.get<wxString>() );
|
|
|
|
}
|
2020-05-31 21:42:04 +00:00
|
|
|
}
|
|
|
|
},
|
|
|
|
{} ) );
|
|
|
|
|
|
|
|
m_params.emplace_back( new PARAM_LAMBDA<nlohmann::json>( "track_widths",
|
|
|
|
[&]() -> nlohmann::json
|
|
|
|
{
|
|
|
|
nlohmann::json js = nlohmann::json::array();
|
|
|
|
|
|
|
|
for( const int& width : m_TrackWidthList )
|
2022-09-16 11:33:56 +00:00
|
|
|
js.push_back( pcbIUScale.IUTomm( width ) );
|
2020-05-31 21:42:04 +00:00
|
|
|
|
|
|
|
return js;
|
|
|
|
},
|
|
|
|
[&]( const nlohmann::json& aJson )
|
|
|
|
{
|
|
|
|
if( !aJson.is_array() )
|
|
|
|
return;
|
|
|
|
|
|
|
|
m_TrackWidthList.clear();
|
|
|
|
|
|
|
|
for( const nlohmann::json& entry : aJson )
|
|
|
|
{
|
|
|
|
if( entry.empty() )
|
|
|
|
continue;
|
|
|
|
|
2022-09-16 11:33:56 +00:00
|
|
|
m_TrackWidthList.emplace_back( pcbIUScale.mmToIU( entry.get<double>() ) );
|
2020-05-31 21:42:04 +00:00
|
|
|
}
|
|
|
|
},
|
|
|
|
{} ) );
|
|
|
|
|
|
|
|
m_params.emplace_back( new PARAM_LAMBDA<nlohmann::json>( "via_dimensions",
|
|
|
|
[&]() -> nlohmann::json
|
|
|
|
{
|
|
|
|
nlohmann::json js = nlohmann::json::array();
|
|
|
|
|
|
|
|
for( const auto& via : m_ViasDimensionsList )
|
|
|
|
{
|
|
|
|
nlohmann::json entry = {};
|
|
|
|
|
2022-09-16 11:33:56 +00:00
|
|
|
entry["diameter"] = pcbIUScale.IUTomm( via.m_Diameter );
|
|
|
|
entry["drill"] = pcbIUScale.IUTomm( via.m_Drill );
|
2020-05-31 21:42:04 +00:00
|
|
|
|
|
|
|
js.push_back( entry );
|
|
|
|
}
|
|
|
|
|
|
|
|
return js;
|
|
|
|
},
|
|
|
|
[&]( const nlohmann::json& aObj )
|
|
|
|
{
|
|
|
|
if( !aObj.is_array() )
|
|
|
|
return;
|
|
|
|
|
|
|
|
m_ViasDimensionsList.clear();
|
|
|
|
|
|
|
|
for( const nlohmann::json& entry : aObj )
|
|
|
|
{
|
|
|
|
if( entry.empty() || !entry.is_object() )
|
|
|
|
continue;
|
|
|
|
|
|
|
|
if( !entry.contains( "diameter" ) || !entry.contains( "drill" ) )
|
|
|
|
continue;
|
|
|
|
|
2022-09-16 11:33:56 +00:00
|
|
|
int diameter = pcbIUScale.mmToIU( entry["diameter"].get<double>() );
|
|
|
|
int drill = pcbIUScale.mmToIU( entry["drill"].get<double>() );
|
2020-05-31 21:42:04 +00:00
|
|
|
|
|
|
|
m_ViasDimensionsList.emplace_back( VIA_DIMENSION( diameter, drill ) );
|
|
|
|
}
|
|
|
|
},
|
|
|
|
{} ) );
|
|
|
|
|
|
|
|
m_params.emplace_back( new PARAM_LAMBDA<nlohmann::json>( "diff_pair_dimensions",
|
|
|
|
[&]() -> nlohmann::json
|
|
|
|
{
|
|
|
|
nlohmann::json js = nlohmann::json::array();
|
|
|
|
|
|
|
|
for( const auto& pair : m_DiffPairDimensionsList )
|
|
|
|
{
|
|
|
|
nlohmann::json entry = {};
|
|
|
|
|
2022-09-16 11:33:56 +00:00
|
|
|
entry["width"] = pcbIUScale.IUTomm( pair.m_Width );
|
|
|
|
entry["gap"] = pcbIUScale.IUTomm( pair.m_Gap );
|
|
|
|
entry["via_gap"] = pcbIUScale.IUTomm( pair.m_ViaGap );
|
2020-05-31 21:42:04 +00:00
|
|
|
|
|
|
|
js.push_back( entry );
|
|
|
|
}
|
|
|
|
|
|
|
|
return js;
|
|
|
|
},
|
|
|
|
[&]( const nlohmann::json& aObj )
|
|
|
|
{
|
|
|
|
if( !aObj.is_array() )
|
|
|
|
return;
|
|
|
|
|
2020-09-11 01:28:49 +00:00
|
|
|
m_DiffPairDimensionsList.clear();
|
2020-05-31 21:42:04 +00:00
|
|
|
|
|
|
|
for( const nlohmann::json& entry : aObj )
|
|
|
|
{
|
|
|
|
if( entry.empty() || !entry.is_object() )
|
|
|
|
continue;
|
|
|
|
|
|
|
|
if( !entry.contains( "width" ) || !entry.contains( "gap" )
|
|
|
|
|| !entry.contains( "via_gap" ) )
|
|
|
|
continue;
|
|
|
|
|
2022-09-16 11:33:56 +00:00
|
|
|
int width = pcbIUScale.mmToIU( entry["width"].get<double>() );
|
|
|
|
int gap = pcbIUScale.mmToIU( entry["gap"].get<double>() );
|
|
|
|
int via_gap = pcbIUScale.mmToIU( entry["via_gap"].get<double>() );
|
2020-05-31 21:42:04 +00:00
|
|
|
|
|
|
|
m_DiffPairDimensionsList.emplace_back(
|
|
|
|
DIFF_PAIR_DIMENSION( width, gap, via_gap ) );
|
|
|
|
}
|
|
|
|
},
|
|
|
|
{} ) );
|
|
|
|
|
2022-01-22 19:26:58 +00:00
|
|
|
// Handle options for teardrops (targets and some others):
|
|
|
|
m_params.emplace_back( new PARAM_LAMBDA<nlohmann::json>( "teardrop_options",
|
|
|
|
[&]() -> nlohmann::json
|
|
|
|
{
|
|
|
|
nlohmann::json js = nlohmann::json::array();
|
|
|
|
nlohmann::json entry = {};
|
|
|
|
|
2023-05-11 13:53:28 +00:00
|
|
|
entry["td_onviapad"] = m_TeardropParamsList.m_TargetViasPads;
|
|
|
|
entry["td_onpadsmd"] = m_TeardropParamsList.m_TargetPadsWithNoHole;
|
|
|
|
entry["td_ontrackend"] = m_TeardropParamsList.m_TargetTrack2Track;
|
|
|
|
entry["td_onroundshapesonly"] = m_TeardropParamsList.m_UseRoundShapesOnly;
|
2022-01-22 19:26:58 +00:00
|
|
|
|
|
|
|
js.push_back( entry );
|
|
|
|
|
|
|
|
return js;
|
|
|
|
},
|
|
|
|
[&]( const nlohmann::json& aObj )
|
|
|
|
{
|
|
|
|
if( !aObj.is_array() )
|
|
|
|
return;
|
|
|
|
|
|
|
|
for( const nlohmann::json& entry : aObj )
|
|
|
|
{
|
|
|
|
if( entry.empty() || !entry.is_object() )
|
|
|
|
continue;
|
|
|
|
|
2022-01-27 10:24:10 +00:00
|
|
|
if( entry.contains( "td_onviapad" ) )
|
|
|
|
m_TeardropParamsList.m_TargetViasPads = entry["td_onviapad"].get<bool>();
|
|
|
|
|
|
|
|
if( entry.contains( "td_onpadsmd" ) )
|
|
|
|
m_TeardropParamsList.m_TargetPadsWithNoHole = entry["td_onpadsmd"].get<bool>();
|
|
|
|
|
|
|
|
if( entry.contains( "td_ontrackend" ) )
|
|
|
|
m_TeardropParamsList.m_TargetTrack2Track = entry["td_ontrackend"].get<bool>();
|
|
|
|
|
|
|
|
if( entry.contains( "td_onroundshapesonly" ) )
|
|
|
|
m_TeardropParamsList.m_UseRoundShapesOnly = entry["td_onroundshapesonly"].get<bool>();
|
|
|
|
|
2023-05-12 21:03:54 +00:00
|
|
|
// Legacy settings
|
|
|
|
for( int ii = 0; ii < 3; ++ii )
|
|
|
|
{
|
|
|
|
TEARDROP_PARAMETERS* td_prm = m_TeardropParamsList.GetParameters( (TARGET_TD)ii );
|
|
|
|
|
|
|
|
if( entry.contains( "td_allow_use_two_tracks" ) )
|
|
|
|
td_prm->m_AllowUseTwoTracks = entry["td_allow_use_two_tracks"].get<bool>();
|
2022-01-27 10:24:10 +00:00
|
|
|
|
2023-05-12 21:03:54 +00:00
|
|
|
if( entry.contains( "td_curve_segcount" ) )
|
|
|
|
td_prm->m_CurveSegCount = entry["td_curve_segcount"].get<int>();
|
2022-01-22 19:26:58 +00:00
|
|
|
|
2023-05-12 21:03:54 +00:00
|
|
|
if( entry.contains( "td_on_pad_in_zone" ) )
|
|
|
|
td_prm->m_TdOnPadsInZones = entry["td_on_pad_in_zone"].get<bool>();
|
|
|
|
}
|
2022-01-22 19:26:58 +00:00
|
|
|
}
|
|
|
|
},
|
|
|
|
{} ) );
|
|
|
|
|
|
|
|
// Handle parameters (sizes, shape) for each type of teardrop:
|
|
|
|
m_params.emplace_back( new PARAM_LAMBDA<nlohmann::json>( "teardrop_parameters",
|
|
|
|
[&]() -> nlohmann::json
|
|
|
|
{
|
|
|
|
nlohmann::json js = nlohmann::json::array();
|
|
|
|
|
2022-08-27 00:15:01 +00:00
|
|
|
for( size_t ii = 0; ii < m_TeardropParamsList.GetParametersCount(); ii++ )
|
2022-01-22 19:26:58 +00:00
|
|
|
{
|
|
|
|
nlohmann::json entry = {};
|
|
|
|
TEARDROP_PARAMETERS* td_prm = m_TeardropParamsList.GetParameters( (TARGET_TD)ii );
|
|
|
|
|
|
|
|
entry["td_target_name"] = GetTeardropTargetCanonicalName( (TARGET_TD)ii );
|
2022-09-16 11:33:56 +00:00
|
|
|
entry["td_maxlen"] = pcbIUScale.IUTomm( td_prm->m_TdMaxLen );
|
2023-05-12 21:03:54 +00:00
|
|
|
entry["td_maxheight"] = pcbIUScale.IUTomm( td_prm->m_TdMaxWidth );
|
|
|
|
entry["td_length_ratio"] = td_prm->m_BestLengthRatio;
|
|
|
|
entry["td_height_ratio"] = td_prm->m_BestWidthRatio;
|
2022-01-22 19:26:58 +00:00
|
|
|
entry["td_curve_segcount"] = td_prm->m_CurveSegCount;
|
2022-01-30 14:32:38 +00:00
|
|
|
entry["td_width_to_size_filter_ratio"] = td_prm->m_WidthtoSizeFilterRatio;
|
2023-05-12 21:03:54 +00:00
|
|
|
entry["td_allow_use_two_tracks"] = td_prm->m_AllowUseTwoTracks;
|
|
|
|
entry["td_curve_segcount"] = td_prm->m_CurveSegCount;
|
|
|
|
entry["td_on_pad_in_zone"] = td_prm->m_TdOnPadsInZones;
|
2022-01-22 19:26:58 +00:00
|
|
|
|
|
|
|
js.push_back( entry );
|
|
|
|
}
|
|
|
|
|
|
|
|
return js;
|
|
|
|
},
|
|
|
|
[&]( const nlohmann::json& aObj )
|
|
|
|
{
|
|
|
|
if( !aObj.is_array() )
|
|
|
|
return;
|
|
|
|
|
|
|
|
for( const nlohmann::json& entry : aObj )
|
|
|
|
{
|
|
|
|
if( entry.empty() || !entry.is_object() )
|
|
|
|
continue;
|
|
|
|
|
2022-01-30 14:32:38 +00:00
|
|
|
if( !entry.contains( "td_target_name" ) )
|
2022-01-22 19:26:58 +00:00
|
|
|
continue;
|
|
|
|
|
|
|
|
int idx = GetTeardropTargetTypeFromCanonicalName( entry["td_target_name"].get<std::string>() );
|
|
|
|
|
|
|
|
if( idx >= 0 && idx < 3 )
|
|
|
|
{
|
|
|
|
TEARDROP_PARAMETERS* td_prm = m_TeardropParamsList.GetParameters( (TARGET_TD)idx );
|
2022-01-30 14:32:38 +00:00
|
|
|
|
|
|
|
if( entry.contains( "td_maxlen" ) )
|
2022-09-16 11:33:56 +00:00
|
|
|
td_prm->m_TdMaxLen = pcbIUScale.mmToIU( entry["td_maxlen"].get<double>() );
|
2022-01-30 14:32:38 +00:00
|
|
|
|
|
|
|
if( entry.contains( "td_maxheight" ) )
|
2023-05-12 21:03:54 +00:00
|
|
|
td_prm->m_TdMaxWidth = pcbIUScale.mmToIU( entry["td_maxheight"].get<double>() );
|
2022-01-30 14:32:38 +00:00
|
|
|
|
|
|
|
if( entry.contains( "td_length_ratio" ) )
|
2023-05-12 21:03:54 +00:00
|
|
|
td_prm->m_BestLengthRatio = entry["td_length_ratio"].get<double>();
|
2022-01-30 14:32:38 +00:00
|
|
|
|
|
|
|
if( entry.contains( "td_height_ratio" ) )
|
2023-05-12 21:03:54 +00:00
|
|
|
td_prm->m_BestWidthRatio = entry["td_height_ratio"].get<double>();
|
2022-01-30 14:32:38 +00:00
|
|
|
|
|
|
|
if( entry.contains( "td_curve_segcount" ) )
|
|
|
|
td_prm->m_CurveSegCount = entry["td_curve_segcount"].get<int>();
|
|
|
|
|
|
|
|
if( entry.contains( "td_width_to_size_filter_ratio" ) )
|
|
|
|
td_prm->m_WidthtoSizeFilterRatio = entry["td_width_to_size_filter_ratio"].get<double>();
|
2023-05-12 21:03:54 +00:00
|
|
|
|
|
|
|
if( entry.contains( "td_allow_use_two_tracks" ) )
|
|
|
|
td_prm->m_AllowUseTwoTracks = entry["td_allow_use_two_tracks"].get<bool>();
|
|
|
|
|
|
|
|
if( entry.contains( "td_curve_segcount" ) )
|
|
|
|
td_prm->m_CurveSegCount = entry["td_curve_segcount"].get<int>();
|
|
|
|
|
|
|
|
if( entry.contains( "td_on_pad_in_zone" ) )
|
|
|
|
td_prm->m_TdOnPadsInZones = entry["td_on_pad_in_zone"].get<bool>();
|
2022-01-22 19:26:58 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
},
|
|
|
|
{} ) );
|
|
|
|
|
2023-10-15 16:02:15 +00:00
|
|
|
m_params.emplace_back( new PARAM_LAMBDA<nlohmann::json>( "tuning_pattern_settings",
|
2023-10-06 18:40:49 +00:00
|
|
|
[&]() -> nlohmann::json
|
|
|
|
{
|
|
|
|
nlohmann::json js = {};
|
|
|
|
|
|
|
|
auto make_settings =
|
|
|
|
[]( const PNS::MEANDER_SETTINGS& aSettings )
|
|
|
|
{
|
|
|
|
nlohmann::json entry = {};
|
|
|
|
|
|
|
|
entry["min_amplitude"] = pcbIUScale.IUTomm( aSettings.m_minAmplitude );
|
|
|
|
entry["max_amplitude"] = pcbIUScale.IUTomm( aSettings.m_maxAmplitude );
|
|
|
|
entry["spacing"] = pcbIUScale.IUTomm( aSettings.m_spacing );
|
|
|
|
entry["corner_style"] = aSettings.m_cornerStyle == PNS::MEANDER_STYLE_CHAMFER ? 0 : 1;
|
|
|
|
entry["corner_radius_percentage"] = aSettings.m_cornerRadiusPercentage;
|
|
|
|
entry["single_sided"] = aSettings.m_singleSided;
|
|
|
|
|
|
|
|
return entry;
|
|
|
|
};
|
|
|
|
|
2024-01-30 12:45:37 +00:00
|
|
|
js["single_track_defaults"] = make_settings( m_SingleTrackMeanderSettings );
|
|
|
|
js["diff_pair_defaults"] = make_settings( m_DiffPairMeanderSettings );
|
|
|
|
js["diff_pair_skew_defaults"] = make_settings( m_SkewMeanderSettings );
|
2023-10-06 18:40:49 +00:00
|
|
|
|
|
|
|
return js;
|
|
|
|
},
|
|
|
|
[&]( const nlohmann::json& aObj )
|
|
|
|
{
|
|
|
|
auto read_settings =
|
|
|
|
[]( const nlohmann::json& entry ) -> PNS::MEANDER_SETTINGS
|
|
|
|
{
|
|
|
|
PNS::MEANDER_SETTINGS settings;
|
|
|
|
|
|
|
|
if( entry.contains( "min_amplitude" ) )
|
|
|
|
settings.m_minAmplitude = pcbIUScale.mmToIU( entry["min_amplitude"].get<double>() );
|
|
|
|
|
|
|
|
if( entry.contains( "max_amplitude" ) )
|
|
|
|
settings.m_maxAmplitude = pcbIUScale.mmToIU( entry["max_amplitude"].get<double>() );
|
|
|
|
|
|
|
|
if( entry.contains( "spacing" ) )
|
|
|
|
settings.m_spacing = pcbIUScale.mmToIU( entry["spacing"].get<double>() );
|
|
|
|
|
|
|
|
if( entry.contains( "corner_style" ) )
|
|
|
|
{
|
|
|
|
settings.m_cornerStyle = entry["corner_style"] == 0 ? PNS::MEANDER_STYLE_CHAMFER
|
|
|
|
: PNS::MEANDER_STYLE_ROUND;
|
|
|
|
}
|
|
|
|
|
|
|
|
if( entry.contains( "corner_radius_percentage" ) )
|
|
|
|
settings.m_cornerRadiusPercentage = entry["corner_radius_percentage"].get<int>();
|
|
|
|
|
|
|
|
if( entry.contains( "single_sided" ) )
|
|
|
|
settings.m_singleSided = entry["single_sided"].get<bool>();
|
|
|
|
|
|
|
|
return settings;
|
|
|
|
};
|
|
|
|
|
2023-10-15 16:02:15 +00:00
|
|
|
if( aObj.contains( "single_track_defaults" ) )
|
2024-01-30 12:45:37 +00:00
|
|
|
m_SingleTrackMeanderSettings = read_settings( aObj["single_track_defaults"] );
|
2023-10-06 18:40:49 +00:00
|
|
|
|
2023-10-15 16:02:15 +00:00
|
|
|
if( aObj.contains( "diff_pair_defaults" ) )
|
2024-01-30 12:45:37 +00:00
|
|
|
m_DiffPairMeanderSettings = read_settings( aObj["diff_pair_defaults"] );
|
2023-10-06 18:40:49 +00:00
|
|
|
|
2023-10-15 16:02:15 +00:00
|
|
|
if( aObj.contains( "diff_pair_skew_defaults" ) )
|
2024-01-30 12:45:37 +00:00
|
|
|
m_SkewMeanderSettings = read_settings( aObj["diff_pair_skew_defaults"] );
|
2023-10-06 18:40:49 +00:00
|
|
|
},
|
|
|
|
{} ) );
|
|
|
|
|
2023-06-03 15:59:00 +00:00
|
|
|
int minTextSize = pcbIUScale.MilsToIU( TEXT_MIN_SIZE_MILS );
|
|
|
|
int maxTextSize = pcbIUScale.MilsToIU( TEXT_MAX_SIZE_MILS );
|
|
|
|
int minStroke = 1;
|
|
|
|
int maxStroke = pcbIUScale.mmToIU( 100 );
|
|
|
|
|
2020-05-31 21:42:04 +00:00
|
|
|
m_params.emplace_back( new PARAM_SCALED<int>( "defaults.silk_line_width",
|
2022-09-16 11:33:56 +00:00
|
|
|
&m_LineThickness[LAYER_CLASS_SILK], pcbIUScale.mmToIU( DEFAULT_SILK_LINE_WIDTH ),
|
2023-06-03 15:59:00 +00:00
|
|
|
minStroke, maxStroke, pcbIUScale.MM_PER_IU ) );
|
2020-05-31 21:42:04 +00:00
|
|
|
|
|
|
|
m_params.emplace_back( new PARAM_SCALED<int>( "defaults.silk_text_size_v",
|
2022-09-16 11:33:56 +00:00
|
|
|
&m_TextSize[LAYER_CLASS_SILK].y, pcbIUScale.mmToIU( DEFAULT_SILK_TEXT_SIZE ),
|
2023-06-03 15:59:00 +00:00
|
|
|
minTextSize, maxTextSize, pcbIUScale.MM_PER_IU ) );
|
2020-05-31 21:42:04 +00:00
|
|
|
|
|
|
|
m_params.emplace_back( new PARAM_SCALED<int>( "defaults.silk_text_size_h",
|
2022-09-16 11:33:56 +00:00
|
|
|
&m_TextSize[LAYER_CLASS_SILK].x, pcbIUScale.mmToIU( DEFAULT_SILK_TEXT_SIZE ),
|
2023-06-03 15:59:00 +00:00
|
|
|
minTextSize, maxTextSize, pcbIUScale.MM_PER_IU ) );
|
2020-05-31 21:42:04 +00:00
|
|
|
|
|
|
|
m_params.emplace_back( new PARAM_SCALED<int>( "defaults.silk_text_thickness",
|
2023-06-03 15:59:00 +00:00
|
|
|
&m_TextThickness[LAYER_CLASS_SILK], pcbIUScale.mmToIU( DEFAULT_SILK_TEXT_WIDTH ),
|
|
|
|
minStroke, maxStroke, pcbIUScale.MM_PER_IU ) );
|
2020-05-31 21:42:04 +00:00
|
|
|
|
2020-08-30 14:18:35 +00:00
|
|
|
m_params.emplace_back( new PARAM<bool>( "defaults.silk_text_italic",
|
|
|
|
&m_TextItalic[LAYER_CLASS_SILK], false ) );
|
2020-05-31 21:42:04 +00:00
|
|
|
|
2020-08-30 14:18:35 +00:00
|
|
|
m_params.emplace_back( new PARAM<bool>( "defaults.silk_text_upright",
|
|
|
|
&m_TextUpright[ LAYER_CLASS_SILK ], true ) );
|
2020-05-31 21:42:04 +00:00
|
|
|
|
|
|
|
m_params.emplace_back( new PARAM_SCALED<int>( "defaults.copper_line_width",
|
2022-09-16 11:33:56 +00:00
|
|
|
&m_LineThickness[LAYER_CLASS_COPPER], pcbIUScale.mmToIU( DEFAULT_COPPER_LINE_WIDTH ),
|
2023-06-03 15:59:00 +00:00
|
|
|
minStroke, maxStroke, pcbIUScale.MM_PER_IU ) );
|
2020-05-31 21:42:04 +00:00
|
|
|
|
|
|
|
m_params.emplace_back( new PARAM_SCALED<int>( "defaults.copper_text_size_v",
|
2022-09-16 11:33:56 +00:00
|
|
|
&m_TextSize[LAYER_CLASS_COPPER].y, pcbIUScale.mmToIU( DEFAULT_COPPER_TEXT_SIZE ),
|
2023-06-03 15:59:00 +00:00
|
|
|
minTextSize, maxTextSize, pcbIUScale.MM_PER_IU ) );
|
2020-05-31 21:42:04 +00:00
|
|
|
|
|
|
|
m_params.emplace_back( new PARAM_SCALED<int>( "defaults.copper_text_size_h",
|
2022-09-16 11:33:56 +00:00
|
|
|
&m_TextSize[LAYER_CLASS_COPPER].x, pcbIUScale.mmToIU( DEFAULT_COPPER_TEXT_SIZE ),
|
2023-06-03 15:59:00 +00:00
|
|
|
minTextSize, maxTextSize, pcbIUScale.MM_PER_IU ) );
|
2020-05-31 21:42:04 +00:00
|
|
|
|
|
|
|
m_params.emplace_back( new PARAM_SCALED<int>( "defaults.copper_text_thickness",
|
2022-09-16 11:33:56 +00:00
|
|
|
&m_TextThickness[LAYER_CLASS_COPPER], pcbIUScale.mmToIU( DEFAULT_COPPER_TEXT_WIDTH ),
|
2023-06-03 15:59:00 +00:00
|
|
|
minStroke, maxStroke, pcbIUScale.MM_PER_IU ) );
|
2020-05-31 21:42:04 +00:00
|
|
|
|
2020-08-30 14:18:35 +00:00
|
|
|
m_params.emplace_back( new PARAM<bool>( "defaults.copper_text_italic",
|
|
|
|
&m_TextItalic[LAYER_CLASS_COPPER], false ) );
|
2020-05-31 21:42:04 +00:00
|
|
|
|
2020-08-30 14:18:35 +00:00
|
|
|
m_params.emplace_back( new PARAM<bool>( "defaults.copper_text_upright",
|
|
|
|
&m_TextUpright[LAYER_CLASS_COPPER], true ) );
|
2020-05-31 21:42:04 +00:00
|
|
|
|
|
|
|
m_params.emplace_back( new PARAM_SCALED<int>( "defaults.board_outline_line_width",
|
2022-09-16 11:33:56 +00:00
|
|
|
&m_LineThickness[LAYER_CLASS_EDGES], pcbIUScale.mmToIU( DEFAULT_EDGE_WIDTH ),
|
2023-06-03 15:59:00 +00:00
|
|
|
minStroke, maxStroke, pcbIUScale.MM_PER_IU ) );
|
2020-05-31 21:42:04 +00:00
|
|
|
|
|
|
|
m_params.emplace_back( new PARAM_SCALED<int>( "defaults.courtyard_line_width",
|
2022-09-16 11:33:56 +00:00
|
|
|
&m_LineThickness[LAYER_CLASS_COURTYARD], pcbIUScale.mmToIU( DEFAULT_COURTYARD_WIDTH ),
|
2023-06-03 15:59:00 +00:00
|
|
|
minStroke, maxStroke, pcbIUScale.MM_PER_IU ) );
|
2020-05-31 21:42:04 +00:00
|
|
|
|
|
|
|
m_params.emplace_back( new PARAM_SCALED<int>( "defaults.fab_line_width",
|
2022-09-16 11:33:56 +00:00
|
|
|
&m_LineThickness[LAYER_CLASS_FAB], pcbIUScale.mmToIU( DEFAULT_LINE_WIDTH ),
|
2023-06-03 15:59:00 +00:00
|
|
|
minStroke, maxStroke, pcbIUScale.MM_PER_IU ) );
|
2020-05-31 21:42:04 +00:00
|
|
|
|
|
|
|
m_params.emplace_back( new PARAM_SCALED<int>( "defaults.fab_text_size_v",
|
2022-09-16 11:33:56 +00:00
|
|
|
&m_TextSize[LAYER_CLASS_FAB].y, pcbIUScale.mmToIU( DEFAULT_TEXT_SIZE ),
|
2023-06-03 15:59:00 +00:00
|
|
|
minTextSize, maxTextSize, pcbIUScale.MM_PER_IU ) );
|
2020-05-31 21:42:04 +00:00
|
|
|
|
|
|
|
m_params.emplace_back( new PARAM_SCALED<int>( "defaults.fab_text_size_h",
|
2022-09-16 11:33:56 +00:00
|
|
|
&m_TextSize[LAYER_CLASS_FAB].x, pcbIUScale.mmToIU( DEFAULT_TEXT_SIZE ),
|
2023-06-03 15:59:00 +00:00
|
|
|
minTextSize, maxTextSize, pcbIUScale.MM_PER_IU ) );
|
2020-05-31 21:42:04 +00:00
|
|
|
|
|
|
|
m_params.emplace_back( new PARAM_SCALED<int>( "defaults.fab_text_thickness",
|
2022-09-16 11:33:56 +00:00
|
|
|
&m_TextThickness[LAYER_CLASS_FAB], pcbIUScale.mmToIU( DEFAULT_TEXT_WIDTH ),
|
2023-06-03 15:59:00 +00:00
|
|
|
minStroke, maxStroke, pcbIUScale.MM_PER_IU ) );
|
2020-05-31 21:42:04 +00:00
|
|
|
|
2020-08-30 14:18:35 +00:00
|
|
|
m_params.emplace_back( new PARAM<bool>( "defaults.fab_text_italic",
|
|
|
|
&m_TextItalic[LAYER_CLASS_FAB], false ) );
|
2020-05-31 21:42:04 +00:00
|
|
|
|
2020-08-30 14:18:35 +00:00
|
|
|
m_params.emplace_back( new PARAM<bool>( "defaults.fab_text_upright",
|
|
|
|
&m_TextUpright[LAYER_CLASS_FAB], true ) );
|
2020-05-31 21:42:04 +00:00
|
|
|
|
|
|
|
m_params.emplace_back( new PARAM_SCALED<int>( "defaults.other_line_width",
|
2022-09-16 11:33:56 +00:00
|
|
|
&m_LineThickness[LAYER_CLASS_OTHERS], pcbIUScale.mmToIU( DEFAULT_LINE_WIDTH ),
|
2023-06-03 15:59:00 +00:00
|
|
|
minStroke, maxStroke, pcbIUScale.MM_PER_IU ) );
|
2020-05-31 21:42:04 +00:00
|
|
|
|
|
|
|
m_params.emplace_back( new PARAM_SCALED<int>( "defaults.other_text_size_v",
|
2023-06-03 15:59:00 +00:00
|
|
|
&m_TextSize[LAYER_CLASS_OTHERS].y, pcbIUScale.mmToIU( DEFAULT_TEXT_SIZE ),
|
|
|
|
minTextSize, maxTextSize, pcbIUScale.MM_PER_IU ) );
|
2020-05-31 21:42:04 +00:00
|
|
|
|
|
|
|
m_params.emplace_back( new PARAM_SCALED<int>( "defaults.other_text_size_h",
|
2023-06-03 15:59:00 +00:00
|
|
|
&m_TextSize[LAYER_CLASS_OTHERS].x, pcbIUScale.mmToIU( DEFAULT_TEXT_SIZE ),
|
|
|
|
minTextSize, maxTextSize, pcbIUScale.MM_PER_IU ) );
|
2020-05-31 21:42:04 +00:00
|
|
|
|
|
|
|
m_params.emplace_back( new PARAM_SCALED<int>( "defaults.other_text_thickness",
|
2022-09-16 11:33:56 +00:00
|
|
|
&m_TextThickness[LAYER_CLASS_OTHERS], pcbIUScale.mmToIU( DEFAULT_TEXT_WIDTH ),
|
2023-06-03 15:59:00 +00:00
|
|
|
minStroke, maxStroke, pcbIUScale.MM_PER_IU ) );
|
2020-05-31 21:42:04 +00:00
|
|
|
|
2020-08-30 14:18:35 +00:00
|
|
|
m_params.emplace_back( new PARAM<bool>( "defaults.other_text_italic",
|
|
|
|
&m_TextItalic[LAYER_CLASS_OTHERS], false ) );
|
2020-05-31 21:42:04 +00:00
|
|
|
|
2020-08-30 14:18:35 +00:00
|
|
|
m_params.emplace_back( new PARAM<bool>( "defaults.other_text_upright",
|
|
|
|
&m_TextUpright[LAYER_CLASS_OTHERS], true ) );
|
2020-05-31 21:42:04 +00:00
|
|
|
|
2020-09-12 00:36:43 +00:00
|
|
|
m_params.emplace_back( new PARAM_ENUM<DIM_UNITS_MODE>( "defaults.dimension_units",
|
|
|
|
&m_DimensionUnitsMode, DIM_UNITS_MODE::AUTOMATIC, DIM_UNITS_MODE::INCHES,
|
|
|
|
DIM_UNITS_MODE::AUTOMATIC ) );
|
2020-05-31 21:42:04 +00:00
|
|
|
|
2023-03-05 13:27:22 +00:00
|
|
|
m_params.emplace_back( new PARAM_ENUM<DIM_PRECISION>( "defaults.dimension_precision",
|
|
|
|
&m_DimensionPrecision, DIM_PRECISION::X_XXXX, DIM_PRECISION::X, DIM_PRECISION::V_VVVVV ) );
|
2020-05-31 21:42:04 +00:00
|
|
|
|
2020-09-12 00:36:43 +00:00
|
|
|
m_params.emplace_back( new PARAM_ENUM<DIM_UNITS_FORMAT>( "defaults.dimensions.units_format",
|
|
|
|
&m_DimensionUnitsFormat, DIM_UNITS_FORMAT::BARE_SUFFIX, DIM_UNITS_FORMAT::NO_SUFFIX,
|
2020-09-12 15:46:33 +00:00
|
|
|
DIM_UNITS_FORMAT::PAREN_SUFFIX ) );
|
|
|
|
|
|
|
|
m_params.emplace_back( new PARAM<bool>( "defaults.dimensions.suppress_zeroes",
|
|
|
|
&m_DimensionSuppressZeroes, false ) );
|
2020-09-12 00:36:43 +00:00
|
|
|
|
|
|
|
// NOTE: excluding DIM_TEXT_POSITION::MANUAL from the valid range here
|
|
|
|
m_params.emplace_back( new PARAM_ENUM<DIM_TEXT_POSITION>( "defaults.dimensions.text_position",
|
|
|
|
&m_DimensionTextPosition, DIM_TEXT_POSITION::OUTSIDE, DIM_TEXT_POSITION::OUTSIDE,
|
|
|
|
DIM_TEXT_POSITION::INLINE ) );
|
|
|
|
|
|
|
|
m_params.emplace_back( new PARAM<bool>( "defaults.dimensions.keep_text_aligned",
|
2020-09-12 15:46:33 +00:00
|
|
|
&m_DimensionKeepTextAligned, true ) );
|
2020-09-12 00:36:43 +00:00
|
|
|
|
|
|
|
m_params.emplace_back( new PARAM<int>( "defaults.dimensions.arrow_length",
|
2020-09-12 15:46:33 +00:00
|
|
|
&m_DimensionArrowLength,
|
2022-09-16 23:42:20 +00:00
|
|
|
pcbIUScale.MilsToIU( DEFAULT_DIMENSION_ARROW_LENGTH ) ) );
|
2020-09-12 15:46:33 +00:00
|
|
|
|
|
|
|
m_params.emplace_back( new PARAM<int>( "defaults.dimensions.extension_offset",
|
|
|
|
&m_DimensionExtensionOffset,
|
2022-09-16 11:33:56 +00:00
|
|
|
pcbIUScale.mmToIU( DEFAULT_DIMENSION_EXTENSION_OFFSET ) ) );
|
2020-09-12 00:36:43 +00:00
|
|
|
|
2023-10-02 21:10:13 +00:00
|
|
|
m_params.emplace_back( new PARAM<bool>( "defaults.apply_defaults_to_fp_fields",
|
|
|
|
&m_StyleFPFields, false ) );
|
|
|
|
m_params.emplace_back( new PARAM<bool>( "defaults.apply_defaults_to_fp_text",
|
|
|
|
&m_StyleFPText, false ) );
|
|
|
|
m_params.emplace_back( new PARAM<bool>( "defaults.apply_defaults_to_fp_shapes",
|
|
|
|
&m_StyleFPShapes, false ) );
|
|
|
|
|
2020-05-31 21:42:04 +00:00
|
|
|
m_params.emplace_back( new PARAM_SCALED<int>( "defaults.zones.min_clearance",
|
2023-02-11 02:54:40 +00:00
|
|
|
&m_defaultZoneSettings.m_ZoneClearance, pcbIUScale.mmToIU( ZONE_CLEARANCE_MM ),
|
2022-09-16 22:56:24 +00:00
|
|
|
pcbIUScale.mmToIU( 0.0 ), pcbIUScale.mmToIU( 25.0 ), pcbIUScale.MM_PER_IU ) );
|
2020-05-31 21:42:04 +00:00
|
|
|
|
|
|
|
m_params.emplace_back( new PARAM_LAMBDA<nlohmann::json>( "defaults.pads",
|
|
|
|
[&]() -> nlohmann::json
|
|
|
|
{
|
|
|
|
nlohmann::json ret =
|
|
|
|
{
|
2022-09-16 11:33:56 +00:00
|
|
|
{ "width", pcbIUScale.IUTomm( m_Pad_Master->GetSize().x ) },
|
|
|
|
{ "height", pcbIUScale.IUTomm( m_Pad_Master->GetSize().y ) },
|
|
|
|
{ "drill", pcbIUScale.IUTomm( m_Pad_Master->GetDrillSize().x ) }
|
2020-05-31 21:42:04 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
return ret;
|
|
|
|
},
|
|
|
|
[&]( const nlohmann::json& aJson )
|
|
|
|
{
|
|
|
|
if( aJson.contains( "width" ) && aJson.contains( "height" )
|
|
|
|
&& aJson.contains( "drill" ) )
|
|
|
|
{
|
2023-02-19 03:40:07 +00:00
|
|
|
VECTOR2I sz;
|
|
|
|
sz.x = pcbIUScale.mmToIU( aJson["width"].get<double>() );
|
|
|
|
sz.y = pcbIUScale.mmToIU( aJson["height"].get<double>() );
|
2020-05-31 21:42:04 +00:00
|
|
|
|
2021-06-06 19:03:10 +00:00
|
|
|
m_Pad_Master->SetSize( sz );
|
2020-05-31 21:42:04 +00:00
|
|
|
|
2022-09-16 11:33:56 +00:00
|
|
|
int drill = pcbIUScale.mmToIU( aJson["drill"].get<double>() );
|
2020-05-31 21:42:04 +00:00
|
|
|
|
2023-02-19 03:40:07 +00:00
|
|
|
m_Pad_Master->SetDrillSize( VECTOR2I( drill, drill ) );
|
2020-05-31 21:42:04 +00:00
|
|
|
}
|
|
|
|
}, {} ) );
|
|
|
|
|
2021-08-22 22:05:47 +00:00
|
|
|
m_params.emplace_back( new PARAM_SCALED<int>( "rules.max_error",
|
2022-09-16 22:56:24 +00:00
|
|
|
&m_MaxError, ARC_HIGH_DEF, pcbIUScale.mmToIU( 0.0001 ), pcbIUScale.mmToIU( 1.0 ), pcbIUScale.MM_PER_IU ) );
|
2021-08-22 22:05:47 +00:00
|
|
|
|
|
|
|
m_params.emplace_back( new PARAM_SCALED<int>( "rules.solder_mask_to_copper_clearance",
|
2022-09-16 11:33:56 +00:00
|
|
|
&m_SolderMaskToCopperClearance, pcbIUScale.mmToIU( DEFAULT_SOLDERMASK_TO_COPPER_CLEARANCE ),
|
2022-09-16 22:56:24 +00:00
|
|
|
pcbIUScale.mmToIU( 0.0 ), pcbIUScale.mmToIU( 25.0 ), pcbIUScale.MM_PER_IU ) );
|
2020-05-31 21:42:04 +00:00
|
|
|
|
2020-08-30 14:18:35 +00:00
|
|
|
m_params.emplace_back( new PARAM<bool>( "zones_allow_external_fillets",
|
|
|
|
&m_ZoneKeepExternalFillets, false ) );
|
2020-10-06 03:21:57 +00:00
|
|
|
|
|
|
|
registerMigration( 0, 1, std::bind( &BOARD_DESIGN_SETTINGS::migrateSchema0to1, this ) );
|
2021-02-28 19:04:28 +00:00
|
|
|
|
|
|
|
registerMigration( 1, 2,
|
|
|
|
[&]() -> bool
|
|
|
|
{
|
|
|
|
// Schema 1 to 2: move mask and paste margin settings back to board.
|
|
|
|
// The parameters are removed, so we just have to manually load them here and
|
|
|
|
// they will get saved with the board
|
2022-08-25 22:50:47 +00:00
|
|
|
if( std::optional<double> optval = Get<double>( "rules.solder_mask_clearance" ) )
|
2022-09-17 00:45:14 +00:00
|
|
|
m_SolderMaskExpansion = static_cast<int>( *optval * pcbIUScale.IU_PER_MM );
|
2021-02-28 19:04:28 +00:00
|
|
|
|
2022-08-25 22:50:47 +00:00
|
|
|
if( std::optional<double> optval = Get<double>( "rules.solder_mask_min_width" ) )
|
2022-09-17 00:45:14 +00:00
|
|
|
m_SolderMaskMinWidth = static_cast<int>( *optval * pcbIUScale.IU_PER_MM );
|
2021-02-28 19:04:28 +00:00
|
|
|
|
2022-08-25 22:50:47 +00:00
|
|
|
if( std::optional<double> optval = Get<double>( "rules.solder_paste_clearance" ) )
|
2022-09-17 00:45:14 +00:00
|
|
|
m_SolderPasteMargin = static_cast<int>( *optval * pcbIUScale.IU_PER_MM );
|
2021-02-28 19:04:28 +00:00
|
|
|
|
2022-08-25 22:50:47 +00:00
|
|
|
if( std::optional<double> optval = Get<double>( "rules.solder_paste_margin_ratio" ) )
|
2021-02-28 19:04:28 +00:00
|
|
|
m_SolderPasteMarginRatio = *optval;
|
|
|
|
|
|
|
|
try
|
|
|
|
{
|
2021-06-04 03:52:50 +00:00
|
|
|
At( "rules" ).erase( "solder_mask_clearance" );
|
|
|
|
At( "rules" ).erase( "solder_mask_min_width" );
|
|
|
|
At( "rules" ).erase( "solder_paste_clearance" );
|
|
|
|
At( "rules" ).erase( "solder_paste_margin_ratio" );
|
2021-02-28 19:04:28 +00:00
|
|
|
}
|
|
|
|
catch( ... )
|
|
|
|
{}
|
|
|
|
|
|
|
|
return true;
|
|
|
|
} );
|
2020-05-31 21:42:04 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
BOARD_DESIGN_SETTINGS::~BOARD_DESIGN_SETTINGS()
|
|
|
|
{
|
|
|
|
if( m_parent )
|
|
|
|
{
|
|
|
|
m_parent->ReleaseNestedSettings( this );
|
|
|
|
m_parent = nullptr;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2020-07-06 16:45:57 +00:00
|
|
|
BOARD_DESIGN_SETTINGS::BOARD_DESIGN_SETTINGS( const BOARD_DESIGN_SETTINGS& aOther ) :
|
|
|
|
NESTED_SETTINGS( "board_design_settings", bdsSchemaVersion, aOther.m_parent,
|
|
|
|
aOther.m_path ),
|
|
|
|
m_Pad_Master( nullptr )
|
|
|
|
{
|
|
|
|
initFromOther( aOther );
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2020-07-03 23:13:06 +00:00
|
|
|
BOARD_DESIGN_SETTINGS& BOARD_DESIGN_SETTINGS::operator=( const BOARD_DESIGN_SETTINGS& aOther )
|
2020-07-06 16:45:57 +00:00
|
|
|
{
|
|
|
|
initFromOther( aOther );
|
|
|
|
return *this;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
void BOARD_DESIGN_SETTINGS::initFromOther( const BOARD_DESIGN_SETTINGS& aOther )
|
2020-07-03 23:13:06 +00:00
|
|
|
{
|
|
|
|
// Copy of NESTED_SETTINGS around is not allowed, so let's just update the params.
|
|
|
|
m_TrackWidthList = aOther.m_TrackWidthList;
|
|
|
|
m_ViasDimensionsList = aOther.m_ViasDimensionsList;
|
|
|
|
m_DiffPairDimensionsList = aOther.m_DiffPairDimensionsList;
|
|
|
|
m_CurrentViaType = aOther.m_CurrentViaType;
|
|
|
|
m_UseConnectedTrackWidth = aOther.m_UseConnectedTrackWidth;
|
2023-06-15 22:49:24 +00:00
|
|
|
m_TempOverrideTrackWidth = aOther.m_TempOverrideTrackWidth;
|
2020-07-03 23:13:06 +00:00
|
|
|
m_MinClearance = aOther.m_MinClearance;
|
2022-07-11 19:26:56 +00:00
|
|
|
m_MinConn = aOther.m_MinConn;
|
2020-07-03 23:13:06 +00:00
|
|
|
m_TrackMinWidth = aOther.m_TrackMinWidth;
|
2021-06-26 09:11:22 +00:00
|
|
|
m_ViasMinAnnularWidth = aOther.m_ViasMinAnnularWidth;
|
2020-07-03 23:13:06 +00:00
|
|
|
m_ViasMinSize = aOther.m_ViasMinSize;
|
|
|
|
m_MinThroughDrill = aOther.m_MinThroughDrill;
|
|
|
|
m_MicroViasMinSize = aOther.m_MicroViasMinSize;
|
|
|
|
m_MicroViasMinDrill = aOther.m_MicroViasMinDrill;
|
|
|
|
m_CopperEdgeClearance = aOther.m_CopperEdgeClearance;
|
2020-11-29 22:01:40 +00:00
|
|
|
m_HoleClearance = aOther.m_HoleClearance;
|
2020-07-03 23:13:06 +00:00
|
|
|
m_HoleToHoleMin = aOther.m_HoleToHoleMin;
|
2020-10-12 13:10:50 +00:00
|
|
|
m_SilkClearance = aOther.m_SilkClearance;
|
2023-06-15 22:49:24 +00:00
|
|
|
m_MinResolvedSpokes = aOther.m_MinResolvedSpokes;
|
2021-07-11 15:12:28 +00:00
|
|
|
m_MinSilkTextHeight = aOther.m_MinSilkTextHeight;
|
|
|
|
m_MinSilkTextThickness = aOther.m_MinSilkTextThickness;
|
2020-07-03 23:13:06 +00:00
|
|
|
m_DRCSeverities = aOther.m_DRCSeverities;
|
|
|
|
m_DrcExclusions = aOther.m_DrcExclusions;
|
2024-01-29 15:59:28 +00:00
|
|
|
m_DrcExclusionComments = aOther.m_DrcExclusionComments;
|
2021-08-22 22:05:47 +00:00
|
|
|
m_ZoneKeepExternalFillets = aOther.m_ZoneKeepExternalFillets;
|
|
|
|
m_MaxError = aOther.m_MaxError;
|
|
|
|
m_SolderMaskExpansion = aOther.m_SolderMaskExpansion;
|
|
|
|
m_SolderMaskMinWidth = aOther.m_SolderMaskMinWidth;
|
|
|
|
m_SolderMaskToCopperClearance = aOther.m_SolderMaskToCopperClearance;
|
|
|
|
m_SolderPasteMargin = aOther.m_SolderPasteMargin;
|
|
|
|
m_SolderPasteMarginRatio = aOther.m_SolderPasteMarginRatio;
|
2023-06-15 22:49:24 +00:00
|
|
|
m_AllowSoldermaskBridgesInFPs = aOther.m_AllowSoldermaskBridgesInFPs;
|
2021-08-22 22:05:47 +00:00
|
|
|
m_DefaultFPTextItems = aOther.m_DefaultFPTextItems;
|
2020-07-03 23:13:06 +00:00
|
|
|
|
|
|
|
std::copy( std::begin( aOther.m_LineThickness ), std::end( aOther.m_LineThickness ),
|
|
|
|
std::begin( m_LineThickness ) );
|
|
|
|
|
|
|
|
std::copy( std::begin( aOther.m_TextSize ), std::end( aOther.m_TextSize ),
|
|
|
|
std::begin( m_TextSize ) );
|
|
|
|
|
|
|
|
std::copy( std::begin( aOther.m_TextThickness ), std::end( aOther.m_TextThickness ),
|
|
|
|
std::begin( m_TextThickness ) );
|
|
|
|
|
|
|
|
std::copy( std::begin( aOther.m_TextItalic ), std::end( aOther.m_TextItalic ),
|
|
|
|
std::begin( m_TextItalic ) );
|
|
|
|
|
|
|
|
std::copy( std::begin( aOther.m_TextUpright ), std::end( aOther.m_TextUpright ),
|
|
|
|
std::begin( m_TextUpright ) );
|
2020-07-18 22:55:06 +00:00
|
|
|
|
2020-09-12 00:36:43 +00:00
|
|
|
m_DimensionUnitsMode = aOther.m_DimensionUnitsMode;
|
|
|
|
m_DimensionPrecision = aOther.m_DimensionPrecision;
|
|
|
|
m_DimensionUnitsFormat = aOther.m_DimensionUnitsFormat;
|
2020-09-12 15:46:33 +00:00
|
|
|
m_DimensionSuppressZeroes = aOther.m_DimensionSuppressZeroes;
|
2020-09-12 00:36:43 +00:00
|
|
|
m_DimensionTextPosition = aOther.m_DimensionTextPosition;
|
|
|
|
m_DimensionKeepTextAligned = aOther.m_DimensionKeepTextAligned;
|
|
|
|
m_DimensionArrowLength = aOther.m_DimensionArrowLength;
|
2020-09-12 15:46:33 +00:00
|
|
|
m_DimensionExtensionOffset = aOther.m_DimensionExtensionOffset;
|
2020-09-12 00:36:43 +00:00
|
|
|
|
2021-11-09 03:36:40 +00:00
|
|
|
m_auxOrigin = aOther.m_auxOrigin;
|
|
|
|
m_gridOrigin = aOther.m_gridOrigin;
|
2020-07-18 22:55:06 +00:00
|
|
|
m_HasStackup = aOther.m_HasStackup;
|
2021-06-01 07:04:37 +00:00
|
|
|
m_UseHeightForLengthCalcs= aOther.m_UseHeightForLengthCalcs;
|
2020-07-18 22:55:06 +00:00
|
|
|
|
|
|
|
m_trackWidthIndex = aOther.m_trackWidthIndex;
|
|
|
|
m_viaSizeIndex = aOther.m_viaSizeIndex;
|
|
|
|
m_diffPairIndex = aOther.m_diffPairIndex;
|
|
|
|
m_useCustomTrackVia = aOther.m_useCustomTrackVia;
|
|
|
|
m_customTrackWidth = aOther.m_customTrackWidth;
|
|
|
|
m_customViaSize = aOther.m_customViaSize;
|
|
|
|
m_useCustomDiffPair = aOther.m_useCustomDiffPair;
|
|
|
|
m_customDiffPair = aOther.m_customDiffPair;
|
|
|
|
m_copperLayerCount = aOther.m_copperLayerCount;
|
|
|
|
m_enabledLayers = aOther.m_enabledLayers;
|
|
|
|
m_boardThickness = aOther.m_boardThickness;
|
|
|
|
m_currentNetClassName = aOther.m_currentNetClassName;
|
|
|
|
m_stackup = aOther.m_stackup;
|
2022-08-14 11:03:18 +00:00
|
|
|
m_NetSettings = aOther.m_NetSettings;
|
|
|
|
m_Pad_Master = std::make_unique<PAD>( *aOther.m_Pad_Master );
|
|
|
|
m_defaultZoneSettings = aOther.m_defaultZoneSettings;
|
2023-12-19 14:32:31 +00:00
|
|
|
|
|
|
|
m_StyleFPFields = aOther.m_StyleFPFields;
|
|
|
|
m_StyleFPText = aOther.m_StyleFPText;
|
|
|
|
m_StyleFPShapes = aOther.m_StyleFPShapes;
|
2020-07-03 23:13:06 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2024-01-01 18:37:31 +00:00
|
|
|
bool BOARD_DESIGN_SETTINGS::operator==( const BOARD_DESIGN_SETTINGS& aOther ) const
|
|
|
|
{
|
|
|
|
if( m_TrackWidthList != aOther.m_TrackWidthList ) return false;
|
|
|
|
if( m_ViasDimensionsList != aOther.m_ViasDimensionsList ) return false;
|
|
|
|
if( m_DiffPairDimensionsList != aOther.m_DiffPairDimensionsList ) return false;
|
|
|
|
if( m_CurrentViaType != aOther.m_CurrentViaType ) return false;
|
|
|
|
if( m_UseConnectedTrackWidth != aOther.m_UseConnectedTrackWidth ) return false;
|
|
|
|
if( m_TempOverrideTrackWidth != aOther.m_TempOverrideTrackWidth ) return false;
|
|
|
|
if( m_MinClearance != aOther.m_MinClearance ) return false;
|
|
|
|
if( m_MinConn != aOther.m_MinConn ) return false;
|
|
|
|
if( m_TrackMinWidth != aOther.m_TrackMinWidth ) return false;
|
|
|
|
if( m_ViasMinAnnularWidth != aOther.m_ViasMinAnnularWidth ) return false;
|
|
|
|
if( m_ViasMinSize != aOther.m_ViasMinSize ) return false;
|
|
|
|
if( m_MinThroughDrill != aOther.m_MinThroughDrill ) return false;
|
|
|
|
if( m_MicroViasMinSize != aOther.m_MicroViasMinSize ) return false;
|
|
|
|
if( m_MicroViasMinDrill != aOther.m_MicroViasMinDrill ) return false;
|
|
|
|
if( m_CopperEdgeClearance != aOther.m_CopperEdgeClearance ) return false;
|
|
|
|
if( m_HoleClearance != aOther.m_HoleClearance ) return false;
|
|
|
|
if( m_HoleToHoleMin != aOther.m_HoleToHoleMin ) return false;
|
|
|
|
if( m_SilkClearance != aOther.m_SilkClearance ) return false;
|
|
|
|
if( m_MinResolvedSpokes != aOther.m_MinResolvedSpokes ) return false;
|
|
|
|
if( m_MinSilkTextHeight != aOther.m_MinSilkTextHeight ) return false;
|
|
|
|
if( m_MinSilkTextThickness != aOther.m_MinSilkTextThickness ) return false;
|
|
|
|
if( m_DRCSeverities != aOther.m_DRCSeverities ) return false;
|
|
|
|
if( m_DrcExclusions != aOther.m_DrcExclusions ) return false;
|
2024-01-29 15:59:28 +00:00
|
|
|
if( m_DrcExclusionComments != aOther.m_DrcExclusionComments ) return false;
|
2024-01-01 18:37:31 +00:00
|
|
|
if( m_ZoneKeepExternalFillets != aOther.m_ZoneKeepExternalFillets ) return false;
|
|
|
|
if( m_MaxError != aOther.m_MaxError ) return false;
|
|
|
|
if( m_SolderMaskExpansion != aOther.m_SolderMaskExpansion ) return false;
|
|
|
|
if( m_SolderMaskMinWidth != aOther.m_SolderMaskMinWidth ) return false;
|
|
|
|
if( m_SolderMaskToCopperClearance != aOther.m_SolderMaskToCopperClearance ) return false;
|
|
|
|
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_DefaultFPTextItems != aOther.m_DefaultFPTextItems ) return false;
|
|
|
|
|
|
|
|
if( !std::equal( std::begin( m_LineThickness ), std::end( m_LineThickness ),
|
|
|
|
std::begin( aOther.m_LineThickness ) ) )
|
|
|
|
return false;
|
|
|
|
|
|
|
|
if( !std::equal( std::begin( m_TextSize ), std::end( m_TextSize ),
|
|
|
|
std::begin( aOther.m_TextSize ) ) )
|
|
|
|
return false;
|
|
|
|
|
|
|
|
if( !std::equal( std::begin( m_TextThickness ), std::end( m_TextThickness ),
|
|
|
|
std::begin( aOther.m_TextThickness ) ) )
|
|
|
|
return false;
|
|
|
|
|
|
|
|
if( !std::equal( std::begin( m_TextItalic ), std::end( m_TextItalic ),
|
|
|
|
std::begin( aOther.m_TextItalic ) ) )
|
|
|
|
return false;
|
|
|
|
|
|
|
|
if( !std::equal( std::begin( m_TextUpright ), std::end( m_TextUpright ),
|
|
|
|
std::begin( aOther.m_TextUpright ) ) )
|
|
|
|
return false;
|
|
|
|
|
|
|
|
if( m_DimensionUnitsMode != aOther.m_DimensionUnitsMode ) return false;
|
|
|
|
if( m_DimensionPrecision != aOther.m_DimensionPrecision ) return false;
|
|
|
|
if( m_DimensionUnitsFormat != aOther.m_DimensionUnitsFormat ) return false;
|
|
|
|
if( m_DimensionSuppressZeroes != aOther.m_DimensionSuppressZeroes ) return false;
|
|
|
|
if( m_DimensionTextPosition != aOther.m_DimensionTextPosition ) return false;
|
|
|
|
if( m_DimensionKeepTextAligned != aOther.m_DimensionKeepTextAligned ) return false;
|
|
|
|
if( m_DimensionArrowLength != aOther.m_DimensionArrowLength ) return false;
|
|
|
|
if( m_DimensionExtensionOffset != aOther.m_DimensionExtensionOffset ) return false;
|
|
|
|
if( m_auxOrigin != aOther.m_auxOrigin ) return false;
|
|
|
|
if( m_gridOrigin != aOther.m_gridOrigin ) return false;
|
|
|
|
if( m_HasStackup != aOther.m_HasStackup ) return false;
|
|
|
|
if( m_UseHeightForLengthCalcs != aOther.m_UseHeightForLengthCalcs ) return false;
|
|
|
|
if( m_trackWidthIndex != aOther.m_trackWidthIndex ) return false;
|
|
|
|
if( m_viaSizeIndex != aOther.m_viaSizeIndex ) return false;
|
|
|
|
if( m_diffPairIndex != aOther.m_diffPairIndex ) return false;
|
|
|
|
if( m_useCustomTrackVia != aOther.m_useCustomTrackVia ) return false;
|
|
|
|
if( m_customTrackWidth != aOther.m_customTrackWidth ) return false;
|
|
|
|
if( m_customViaSize != aOther.m_customViaSize ) return false;
|
|
|
|
if( m_useCustomDiffPair != aOther.m_useCustomDiffPair ) return false;
|
|
|
|
if( m_customDiffPair != aOther.m_customDiffPair ) return false;
|
|
|
|
if( m_copperLayerCount != aOther.m_copperLayerCount ) return false;
|
|
|
|
if( m_enabledLayers != aOther.m_enabledLayers ) return false;
|
|
|
|
if( m_boardThickness != aOther.m_boardThickness ) return false;
|
|
|
|
if( m_currentNetClassName != aOther.m_currentNetClassName ) return false;
|
|
|
|
if( m_stackup != aOther.m_stackup ) return false;
|
|
|
|
if( *m_NetSettings != *aOther.m_NetSettings ) return false;
|
|
|
|
if( *m_Pad_Master != *aOther.m_Pad_Master ) return false;
|
|
|
|
if( m_defaultZoneSettings != aOther.m_defaultZoneSettings ) return false;
|
|
|
|
|
|
|
|
if( m_StyleFPFields != aOther.m_StyleFPFields ) return false;
|
|
|
|
if( m_StyleFPText != aOther.m_StyleFPText ) return false;
|
|
|
|
if( m_StyleFPShapes != aOther.m_StyleFPShapes ) return false;
|
|
|
|
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2020-09-11 01:28:49 +00:00
|
|
|
bool BOARD_DESIGN_SETTINGS::migrateSchema0to1()
|
|
|
|
{
|
|
|
|
/**
|
|
|
|
* Schema 0 to 1: default dimension precision changed in meaning.
|
|
|
|
* Previously it was an enum with the following meaning:
|
|
|
|
*
|
|
|
|
* 0: 0.01mm / 1 mil / 0.001 in
|
|
|
|
* 1: 0.001mm / 0.1 mil / 0.0001 in
|
|
|
|
* 2: 0.0001mm / 0.01 mil / 0.00001 in
|
|
|
|
*
|
2021-06-09 19:32:58 +00:00
|
|
|
* Now it is independent of display units and is an integer meaning the number of digits
|
2020-09-11 01:28:49 +00:00
|
|
|
* displayed after the decimal point, so we have to migrate based on the default units.
|
|
|
|
*
|
|
|
|
* The units is an integer with the following mapping:
|
|
|
|
*
|
|
|
|
* 0: Inches
|
|
|
|
* 1: Mils
|
2021-11-08 23:51:57 +00:00
|
|
|
* 2: Millimeters
|
2020-09-11 01:28:49 +00:00
|
|
|
*/
|
2021-06-04 03:52:50 +00:00
|
|
|
std::string units_ptr( "defaults.dimension_units" );
|
|
|
|
std::string precision_ptr( "defaults.dimension_precision" );
|
2020-09-11 01:28:49 +00:00
|
|
|
|
2021-06-04 03:52:50 +00:00
|
|
|
if( !( Contains( units_ptr ) && Contains( precision_ptr ) &&
|
|
|
|
At( units_ptr ).is_number_integer() &&
|
|
|
|
At( precision_ptr ).is_number_integer() ) )
|
2020-09-11 01:28:49 +00:00
|
|
|
{
|
|
|
|
// if either is missing or invalid, migration doesn't make sense
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
2022-08-30 20:58:43 +00:00
|
|
|
int units = *Get<int>( units_ptr );
|
|
|
|
int precision = *Get<int>( precision_ptr );
|
2020-09-11 01:28:49 +00:00
|
|
|
|
|
|
|
// The enum maps directly to precision if the units is mils
|
|
|
|
int extraDigits = 0;
|
|
|
|
|
|
|
|
switch( units )
|
|
|
|
{
|
|
|
|
case 0: extraDigits = 3; break;
|
|
|
|
case 2: extraDigits = 2; break;
|
|
|
|
default: break;
|
|
|
|
}
|
|
|
|
|
|
|
|
precision += extraDigits;
|
|
|
|
|
2021-06-04 03:52:50 +00:00
|
|
|
Set( precision_ptr, precision );
|
2020-09-11 01:28:49 +00:00
|
|
|
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2020-08-02 09:23:21 +00:00
|
|
|
bool BOARD_DESIGN_SETTINGS::LoadFromFile( const wxString& aDirectory )
|
2020-05-31 21:42:04 +00:00
|
|
|
{
|
|
|
|
bool ret = NESTED_SETTINGS::LoadFromFile( aDirectory );
|
|
|
|
|
|
|
|
// A number of things won't have been translated by the PROJECT_FILE migration because of
|
|
|
|
// descoped objects required to decode this data. So, it will be in the legacy.pcbnew
|
|
|
|
// section and needs to be pulled out here
|
|
|
|
|
|
|
|
PROJECT_FILE* project = dynamic_cast<PROJECT_FILE*>( GetParent() );
|
|
|
|
|
|
|
|
if( !project )
|
|
|
|
return ret;
|
|
|
|
|
|
|
|
bool migrated = false;
|
|
|
|
|
|
|
|
auto drcName =
|
2020-06-08 02:19:46 +00:00
|
|
|
[]( int aCode ) -> std::string
|
2020-05-31 21:42:04 +00:00
|
|
|
{
|
2020-08-11 13:33:16 +00:00
|
|
|
std::shared_ptr<DRC_ITEM> item = DRC_ITEM::Create( aCode );
|
2020-06-08 02:19:46 +00:00
|
|
|
wxString name = item->GetSettingsKey();
|
2020-05-31 21:42:04 +00:00
|
|
|
return std::string( name.ToUTF8() );
|
|
|
|
};
|
|
|
|
|
2022-11-04 02:22:35 +00:00
|
|
|
const std::string rs = "rule_severities.";
|
|
|
|
const std::string no_courtyard_key = "legacy_no_courtyard_defined";
|
|
|
|
const std::string courtyard_overlap_key = "legacy_courtyards_overlap";
|
2020-05-31 21:42:04 +00:00
|
|
|
|
2022-11-04 02:22:35 +00:00
|
|
|
try
|
2020-05-31 21:42:04 +00:00
|
|
|
{
|
2022-11-04 02:22:35 +00:00
|
|
|
nlohmann::json& severities =
|
|
|
|
project->Internals()->at( "/board/design_settings/rule_severities"_json_pointer );
|
|
|
|
|
|
|
|
if( severities.contains( no_courtyard_key ) )
|
|
|
|
{
|
|
|
|
if( severities[no_courtyard_key].get<bool>() )
|
|
|
|
Set( rs + drcName( DRCE_MISSING_COURTYARD ), "error" );
|
|
|
|
else
|
|
|
|
Set( rs + drcName( DRCE_MISSING_COURTYARD ), "ignore" );
|
|
|
|
|
|
|
|
severities.erase( no_courtyard_key );
|
|
|
|
migrated = true;
|
|
|
|
}
|
|
|
|
|
|
|
|
if( severities.contains( courtyard_overlap_key ) )
|
|
|
|
{
|
|
|
|
if( severities[courtyard_overlap_key].get<bool>() )
|
|
|
|
Set( rs + drcName( DRCE_OVERLAPPING_FOOTPRINTS ), "error" );
|
|
|
|
else
|
|
|
|
Set( rs + drcName( DRCE_OVERLAPPING_FOOTPRINTS ), "ignore" );
|
|
|
|
|
|
|
|
severities.erase( courtyard_overlap_key );
|
|
|
|
migrated = true;
|
|
|
|
}
|
2020-05-31 21:42:04 +00:00
|
|
|
}
|
2022-11-04 02:22:35 +00:00
|
|
|
catch( ... )
|
2020-05-31 21:42:04 +00:00
|
|
|
{
|
|
|
|
}
|
2021-06-04 03:52:50 +00:00
|
|
|
if( Contains( "legacy" ) )
|
2020-08-30 14:18:35 +00:00
|
|
|
{
|
|
|
|
// This defaults to false for new boards, but version 5.1.x and prior kept the fillets
|
|
|
|
// so we do the same for legacy boards.
|
|
|
|
m_ZoneKeepExternalFillets = true;
|
|
|
|
|
2021-06-04 03:52:50 +00:00
|
|
|
project->At( "legacy" ).erase( "pcbnew" );
|
2020-08-30 14:18:35 +00:00
|
|
|
}
|
2020-05-31 21:42:04 +00:00
|
|
|
|
|
|
|
// Now that we have everything, we need to load again
|
|
|
|
if( migrated )
|
|
|
|
Load();
|
|
|
|
|
|
|
|
return ret;
|
2012-02-19 04:02:19 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2020-12-14 13:33:51 +00:00
|
|
|
SEVERITY BOARD_DESIGN_SETTINGS::GetSeverity( int aDRCErrorCode )
|
2020-02-28 00:05:40 +00:00
|
|
|
{
|
|
|
|
return m_DRCSeverities[ aDRCErrorCode ];
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
bool BOARD_DESIGN_SETTINGS::Ignore( int aDRCErrorCode )
|
|
|
|
{
|
2020-03-04 09:48:18 +00:00
|
|
|
return m_DRCSeverities[ aDRCErrorCode ] == RPT_SEVERITY_IGNORE;
|
2020-02-28 00:05:40 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2021-03-05 14:09:24 +00:00
|
|
|
int BOARD_DESIGN_SETTINGS::GetBiggestClearanceValue() const
|
2014-05-13 09:22:51 +00:00
|
|
|
{
|
2023-07-24 22:18:18 +00:00
|
|
|
int biggest = std::max( m_MinClearance, m_HoleClearance );
|
2020-09-15 19:13:45 +00:00
|
|
|
DRC_CONSTRAINT constraint;
|
2020-05-15 23:25:33 +00:00
|
|
|
|
2023-07-24 22:18:18 +00:00
|
|
|
biggest = std::max( biggest, m_HoleToHoleMin );
|
|
|
|
biggest = std::max( biggest, m_CopperEdgeClearance );
|
|
|
|
|
2020-09-16 00:10:16 +00:00
|
|
|
if( m_DRCEngine )
|
2020-12-30 15:20:45 +00:00
|
|
|
{
|
2020-11-02 16:20:00 +00:00
|
|
|
m_DRCEngine->QueryWorstConstraint( CLEARANCE_CONSTRAINT, constraint );
|
2020-12-30 15:20:45 +00:00
|
|
|
biggest = std::max( biggest, constraint.Value().Min() );
|
|
|
|
|
|
|
|
m_DRCEngine->QueryWorstConstraint( HOLE_CLEARANCE_CONSTRAINT, constraint );
|
|
|
|
biggest = std::max( biggest, constraint.Value().Min() );
|
|
|
|
|
|
|
|
m_DRCEngine->QueryWorstConstraint( EDGE_CLEARANCE_CONSTRAINT, constraint );
|
|
|
|
biggest = std::max( biggest, constraint.Value().Min() );
|
2022-01-12 23:42:08 +00:00
|
|
|
|
|
|
|
m_DRCEngine->QueryWorstConstraint( HOLE_TO_HOLE_CONSTRAINT, constraint );
|
|
|
|
biggest = std::max( biggest, constraint.Value().Min() );
|
2020-12-30 15:20:45 +00:00
|
|
|
}
|
2014-05-13 09:22:51 +00:00
|
|
|
|
2020-12-30 15:20:45 +00:00
|
|
|
return biggest;
|
2014-05-13 09:22:51 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2021-03-05 14:09:24 +00:00
|
|
|
int BOARD_DESIGN_SETTINGS::GetSmallestClearanceValue() const
|
2014-05-13 09:22:51 +00:00
|
|
|
{
|
2022-08-14 11:03:18 +00:00
|
|
|
int clearance = m_NetSettings->m_DefaultNetClass->GetClearance();
|
2014-05-13 09:22:51 +00:00
|
|
|
|
2022-08-14 11:03:18 +00:00
|
|
|
for( const auto& [ name, netclass ] : m_NetSettings->m_NetClasses )
|
|
|
|
clearance = std::min( clearance, netclass->GetClearance() );
|
2020-05-15 23:25:33 +00:00
|
|
|
|
|
|
|
return clearance;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2014-05-13 09:22:51 +00:00
|
|
|
void BOARD_DESIGN_SETTINGS::SetViaSizeIndex( unsigned aIndex )
|
|
|
|
{
|
2018-04-28 15:22:25 +00:00
|
|
|
m_viaSizeIndex = std::min( aIndex, (unsigned) m_ViasDimensionsList.size() );
|
2014-06-03 14:09:27 +00:00
|
|
|
m_useCustomTrackVia = false;
|
2014-05-13 09:22:51 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2020-10-10 23:50:56 +00:00
|
|
|
int BOARD_DESIGN_SETTINGS::GetCurrentViaSize() const
|
|
|
|
{
|
|
|
|
if( m_useCustomTrackVia )
|
|
|
|
return m_customViaSize.m_Diameter;
|
|
|
|
else if( m_viaSizeIndex == 0 )
|
2022-08-14 11:03:18 +00:00
|
|
|
return m_NetSettings->m_DefaultNetClass->GetViaDiameter();
|
2020-10-10 23:50:56 +00:00
|
|
|
else
|
|
|
|
return m_ViasDimensionsList[ m_viaSizeIndex ].m_Diameter;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2014-05-13 09:22:51 +00:00
|
|
|
int BOARD_DESIGN_SETTINGS::GetCurrentViaDrill() const
|
|
|
|
{
|
|
|
|
int drill;
|
|
|
|
|
|
|
|
if( m_useCustomTrackVia )
|
|
|
|
drill = m_customViaSize.m_Drill;
|
2020-10-10 23:50:56 +00:00
|
|
|
else if( m_viaSizeIndex == 0 )
|
2022-08-14 11:03:18 +00:00
|
|
|
drill = m_NetSettings->m_DefaultNetClass->GetViaDrill();
|
2014-05-13 09:22:51 +00:00
|
|
|
else
|
2020-10-10 23:50:56 +00:00
|
|
|
drill = m_ViasDimensionsList[ m_viaSizeIndex ].m_Drill;
|
2014-05-13 09:22:51 +00:00
|
|
|
|
|
|
|
return drill > 0 ? drill : -1;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
void BOARD_DESIGN_SETTINGS::SetTrackWidthIndex( unsigned aIndex )
|
|
|
|
{
|
2018-04-28 15:22:25 +00:00
|
|
|
m_trackWidthIndex = std::min( aIndex, (unsigned) m_TrackWidthList.size() );
|
2014-06-03 14:09:27 +00:00
|
|
|
m_useCustomTrackVia = false;
|
2014-05-13 09:22:51 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2020-10-10 23:50:56 +00:00
|
|
|
int BOARD_DESIGN_SETTINGS::GetCurrentTrackWidth() const
|
|
|
|
{
|
|
|
|
if( m_useCustomTrackVia )
|
|
|
|
return m_customTrackWidth;
|
|
|
|
else if( m_trackWidthIndex == 0 )
|
2022-08-14 11:03:18 +00:00
|
|
|
return m_NetSettings->m_DefaultNetClass->GetTrackWidth();
|
2020-10-10 23:50:56 +00:00
|
|
|
else
|
|
|
|
return m_TrackWidthList[ m_trackWidthIndex ];
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2018-04-28 15:22:25 +00:00
|
|
|
void BOARD_DESIGN_SETTINGS::SetDiffPairIndex( unsigned aIndex )
|
2018-04-14 14:58:01 +00:00
|
|
|
{
|
2021-10-25 17:45:06 +00:00
|
|
|
if( !m_DiffPairDimensionsList.empty() )
|
|
|
|
{
|
|
|
|
m_diffPairIndex = std::min( aIndex,
|
|
|
|
static_cast<unsigned>( m_DiffPairDimensionsList.size() ) - 1 );
|
|
|
|
}
|
|
|
|
|
2018-04-28 15:22:25 +00:00
|
|
|
m_useCustomDiffPair = false;
|
2018-04-14 14:58:01 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2021-03-05 15:30:12 +00:00
|
|
|
int BOARD_DESIGN_SETTINGS::GetCurrentDiffPairWidth() const
|
|
|
|
{
|
|
|
|
if( m_useCustomDiffPair )
|
|
|
|
{
|
|
|
|
return m_customDiffPair.m_Width;
|
|
|
|
}
|
|
|
|
else if( m_diffPairIndex == 0 )
|
|
|
|
{
|
2022-08-14 11:03:18 +00:00
|
|
|
if( m_NetSettings->m_DefaultNetClass->HasDiffPairWidth() )
|
|
|
|
return m_NetSettings->m_DefaultNetClass->GetDiffPairWidth();
|
2021-03-05 15:30:12 +00:00
|
|
|
else
|
2022-08-14 11:03:18 +00:00
|
|
|
return m_NetSettings->m_DefaultNetClass->GetTrackWidth();
|
2021-03-05 15:30:12 +00:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
return m_DiffPairDimensionsList[m_diffPairIndex].m_Width;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
int BOARD_DESIGN_SETTINGS::GetCurrentDiffPairGap() const
|
|
|
|
{
|
|
|
|
if( m_useCustomDiffPair )
|
|
|
|
{
|
|
|
|
return m_customDiffPair.m_Gap;
|
|
|
|
}
|
|
|
|
else if( m_diffPairIndex == 0 )
|
|
|
|
{
|
2022-08-14 11:03:18 +00:00
|
|
|
if( m_NetSettings->m_DefaultNetClass->HasDiffPairGap() )
|
|
|
|
return m_NetSettings->m_DefaultNetClass->GetDiffPairGap();
|
2021-03-05 15:30:12 +00:00
|
|
|
else
|
2022-08-14 11:03:18 +00:00
|
|
|
return m_NetSettings->m_DefaultNetClass->GetClearance();
|
2021-03-05 15:30:12 +00:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
return m_DiffPairDimensionsList[m_diffPairIndex].m_Gap;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
int BOARD_DESIGN_SETTINGS::GetCurrentDiffPairViaGap() const
|
|
|
|
{
|
|
|
|
if( m_useCustomDiffPair )
|
|
|
|
{
|
|
|
|
return m_customDiffPair.m_ViaGap;
|
|
|
|
}
|
|
|
|
else if( m_diffPairIndex == 0 )
|
|
|
|
{
|
2022-08-14 11:03:18 +00:00
|
|
|
if( m_NetSettings->m_DefaultNetClass->HasDiffPairViaGap() )
|
|
|
|
return m_NetSettings->m_DefaultNetClass->GetDiffPairViaGap();
|
2021-03-05 15:30:12 +00:00
|
|
|
else
|
|
|
|
return GetCurrentDiffPairGap();
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
return m_DiffPairDimensionsList[m_diffPairIndex].m_ViaGap;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2010-01-31 20:01:46 +00:00
|
|
|
void BOARD_DESIGN_SETTINGS::SetCopperLayerCount( int aNewLayerCount )
|
2009-10-28 11:48:47 +00:00
|
|
|
{
|
2014-05-13 09:22:51 +00:00
|
|
|
m_copperLayerCount = aNewLayerCount;
|
2009-11-04 19:08:08 +00:00
|
|
|
|
2014-06-30 15:46:47 +00:00
|
|
|
// Update only enabled copper layers mask
|
|
|
|
m_enabledLayers &= ~LSET::AllCuMask();
|
2020-06-18 13:49:32 +00:00
|
|
|
|
|
|
|
if( aNewLayerCount > 0 )
|
|
|
|
m_enabledLayers |= LSET::AllCuMask( aNewLayerCount );
|
2009-10-28 11:48:47 +00:00
|
|
|
}
|
2009-12-07 03:46:13 +00:00
|
|
|
|
2011-09-23 13:57:12 +00:00
|
|
|
|
2014-06-24 16:17:18 +00:00
|
|
|
void BOARD_DESIGN_SETTINGS::SetEnabledLayers( LSET aMask )
|
2009-12-21 12:05:36 +00:00
|
|
|
{
|
2010-01-21 07:41:30 +00:00
|
|
|
// Back and front layers are always enabled.
|
2014-06-24 16:17:18 +00:00
|
|
|
aMask.set( B_Cu ).set( F_Cu );
|
2010-01-21 07:41:30 +00:00
|
|
|
|
2014-05-13 09:22:51 +00:00
|
|
|
m_enabledLayers = aMask;
|
2009-12-21 12:05:36 +00:00
|
|
|
|
2010-01-21 07:41:30 +00:00
|
|
|
// update m_CopperLayerCount to ensure its consistency with m_EnabledLayers
|
2014-06-24 16:17:18 +00:00
|
|
|
m_copperLayerCount = ( aMask & LSET::AllCuMask() ).count();
|
2009-12-21 12:05:36 +00:00
|
|
|
}
|
2014-02-07 19:54:58 +00:00
|
|
|
|
|
|
|
|
2020-05-01 16:24:01 +00:00
|
|
|
// Return the layer class index { silk, copper, edges & courtyards, fab, others } of the
|
2018-04-28 15:22:25 +00:00
|
|
|
// given layer.
|
|
|
|
int BOARD_DESIGN_SETTINGS::GetLayerClass( PCB_LAYER_ID aLayer ) const
|
|
|
|
{
|
|
|
|
if( aLayer == F_SilkS || aLayer == B_SilkS )
|
2018-10-07 15:31:16 +00:00
|
|
|
return LAYER_CLASS_SILK;
|
2018-04-28 15:22:25 +00:00
|
|
|
else if( IsCopperLayer( aLayer ) )
|
2018-10-07 15:31:16 +00:00
|
|
|
return LAYER_CLASS_COPPER;
|
|
|
|
else if( aLayer == Edge_Cuts )
|
|
|
|
return LAYER_CLASS_EDGES;
|
|
|
|
else if( aLayer == F_CrtYd || aLayer == B_CrtYd )
|
|
|
|
return LAYER_CLASS_COURTYARD;
|
2020-05-01 16:24:01 +00:00
|
|
|
else if( aLayer == F_Fab || aLayer == B_Fab )
|
|
|
|
return LAYER_CLASS_FAB;
|
2018-04-28 15:22:25 +00:00
|
|
|
else
|
2018-10-07 15:31:16 +00:00
|
|
|
return LAYER_CLASS_OTHERS;
|
2018-04-28 15:22:25 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2020-09-02 22:15:30 +00:00
|
|
|
int BOARD_DESIGN_SETTINGS::GetDRCEpsilon() const
|
|
|
|
{
|
2022-09-16 11:33:56 +00:00
|
|
|
return pcbIUScale.mmToIU( ADVANCED_CFG::GetCfg().m_DRCEpsilon );
|
2020-09-02 22:15:30 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2020-09-03 14:58:49 +00:00
|
|
|
int BOARD_DESIGN_SETTINGS::GetHolePlatingThickness() const
|
|
|
|
{
|
2022-09-16 11:33:56 +00:00
|
|
|
return pcbIUScale.mmToIU( ADVANCED_CFG::GetCfg().m_HoleWallThickness );
|
2020-09-03 14:58:49 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2018-04-28 15:22:25 +00:00
|
|
|
int BOARD_DESIGN_SETTINGS::GetLineThickness( PCB_LAYER_ID aLayer ) const
|
|
|
|
{
|
|
|
|
return m_LineThickness[ GetLayerClass( aLayer ) ];
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2023-02-19 03:40:07 +00:00
|
|
|
VECTOR2I BOARD_DESIGN_SETTINGS::GetTextSize( PCB_LAYER_ID aLayer ) const
|
2018-04-28 15:22:25 +00:00
|
|
|
{
|
|
|
|
return m_TextSize[ GetLayerClass( aLayer ) ];
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
int BOARD_DESIGN_SETTINGS::GetTextThickness( PCB_LAYER_ID aLayer ) const
|
|
|
|
{
|
|
|
|
return m_TextThickness[ GetLayerClass( aLayer ) ];
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
bool BOARD_DESIGN_SETTINGS::GetTextItalic( PCB_LAYER_ID aLayer ) const
|
|
|
|
{
|
|
|
|
return m_TextItalic[ GetLayerClass( aLayer ) ];
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
bool BOARD_DESIGN_SETTINGS::GetTextUpright( PCB_LAYER_ID aLayer ) const
|
|
|
|
{
|
|
|
|
return m_TextUpright[ GetLayerClass( aLayer ) ];
|
|
|
|
}
|
2024-03-02 00:13:39 +00:00
|
|
|
|
|
|
|
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 ) );
|
|
|
|
}
|