KiCad PCB EDA Suite
Loading...
Searching...
No Matches
board_design_settings.cpp
Go to the documentation of this file.
1/*
2 * This program source code file is part of KiCad, a free EDA CAD application.
3 *
4 * Copyright (C) 1992-2023 KiCad Developers, see AUTHORS.txt for contributors.
5 *
6 * This program is free software; you can redistribute it and/or
7 * modify it under the terms of the GNU General Public License
8 * as published by the Free Software Foundation; either version 2
9 * of the License, or (at your option) any later version.
10 *
11 * This program is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 * GNU General Public License for more details.
15 *
16 * You should have received a copy of the GNU General Public License
17 * along with this program; if not, you may find one here:
18 * http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
19 * or you may search the http://www.gnu.org website for the version 2 license,
20 * or you may write to the Free Software Foundation, Inc.,
21 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
22 */
23
24#include <pcb_dimension.h>
25#include <pcb_track.h>
26#include <layer_ids.h>
27#include <kiface_base.h>
28#include <pad.h>
30#include <drc/drc_item.h>
31#include <drc/drc_engine.h>
33#include <settings/parameters.h>
35#include <advanced_config.h>
36
37const int bdsSchemaVersion = 2;
38
39
40BOARD_DESIGN_SETTINGS::BOARD_DESIGN_SETTINGS( JSON_SETTINGS* aParent, const std::string& aPath ) :
41 NESTED_SETTINGS( "board_design_settings", bdsSchemaVersion, aParent, aPath )
42{
43 // We want to leave alone parameters that aren't found in the project JSON as they may be
44 // initialized by the board file parser before NESTED_SETTINGS::LoadFromFile is called.
46
47 // Create a default NET_SETTINGS so that things don't break horribly if there's no project
48 // loaded. This also is used during file load for legacy boards that have netclasses stored
49 // in the file. After load, this information will be moved to the project and the pointer
50 // updated.
51 m_NetSettings = std::make_shared<NET_SETTINGS>( nullptr, "" );
52
53 m_HasStackup = false; // no stackup defined by default
54
55 m_Pad_Master = std::make_unique<PAD>( nullptr );
56
57 LSET all_set = LSET().set();
58 m_enabledLayers = all_set; // All layers enabled at first.
59 // SetCopperLayerCount() will adjust this.
60
61 SetCopperLayerCount( 2 ); // Default design is a double sided board
62 m_CurrentViaType = VIATYPE::THROUGH;
63
64 // if true, when creating a new track starting on an existing track, use this track width
67
68 // First is always the reference designator
69 m_DefaultFPTextItems.emplace_back( wxT( "REF**" ), true, F_SilkS );
70 // Second is always the value
71 m_DefaultFPTextItems.emplace_back( wxT( "" ), true, F_Fab );
72 // Any following ones are freebies
73 m_DefaultFPTextItems.emplace_back( wxT( "${REFERENCE}" ), true, F_Fab );
74
81
88
89 // Edges & Courtyards; text properties aren't used but better to have them holding
90 // reasonable values than not.
97
104
109 m_TextItalic[ LAYER_CLASS_FAB ] = false;
111
118
119 m_StyleFPFields = false;
120 m_StyleFPText = false;
121 m_StyleFPShapes = false;
122
123 m_DimensionPrecision = DIM_PRECISION::X_XXXX;
124 m_DimensionUnitsMode = DIM_UNITS_MODE::AUTOMATIC;
125 m_DimensionUnitsFormat = DIM_UNITS_FORMAT::BARE_SUFFIX;
127 m_DimensionTextPosition = DIM_TEXT_POSITION::OUTSIDE;
131
132 m_useCustomTrackVia = false;
136
137 m_useCustomDiffPair = false;
141
157
158 for( int errorCode = DRCE_FIRST; errorCode <= DRCE_LAST; ++errorCode )
159 m_DRCSeverities[ errorCode ] = RPT_SEVERITY_ERROR;
160
162
166
169
172
174
179
185
187
190
192
196
197 // Global mask margins:
201
202 // Solder paste margin absolute value
204 // Solder paste margin as a ratio of pad size
205 // The final margin is the sum of these 2 values
206 // Usually < 0 because the mask is smaller than pad
208
210
211 // Layer thickness for 3D viewer
213
214 m_viaSizeIndex = 0;
216 m_diffPairIndex = 0;
217
218 // Parameters stored in JSON in the project file
219
220 // NOTE: Previously, BOARD_DESIGN_SETTINGS stored the basic board layer information (layer
221 // names and enable/disable state) in the project file even though this information is also
222 // stored in the board file. This was implemented for importing these settings from another
223 // project. Going forward, the import feature will just import from other board files (since
224 // we could have multi-board projects in the future anyway) so this functionality is dropped.
225
226
227 m_params.emplace_back( new PARAM<bool>( "rules.use_height_for_length_calcs",
228 &m_UseHeightForLengthCalcs, true ) );
229
230 m_params.emplace_back( new PARAM_SCALED<int>( "rules.min_clearance",
233
234 m_params.emplace_back( new PARAM_SCALED<int>( "rules.min_connection",
236 pcbIUScale.mmToIU( 0.00 ), pcbIUScale.mmToIU( 100.0 ), pcbIUScale.MM_PER_IU ) );
237
238 m_params.emplace_back( new PARAM_SCALED<int>( "rules.min_track_width",
241
242 m_params.emplace_back( new PARAM_SCALED<int>( "rules.min_via_annular_width",
245
246 m_params.emplace_back( new PARAM_SCALED<int>( "rules.min_via_diameter",
249
250 m_params.emplace_back( new PARAM_SCALED<int>( "rules.min_through_hole_diameter",
253
254 m_params.emplace_back( new PARAM_SCALED<int>( "rules.min_microvia_diameter",
257
258 m_params.emplace_back( new PARAM_SCALED<int>( "rules.min_microvia_drill",
261
262 m_params.emplace_back( new PARAM_SCALED<int>( "rules.min_hole_to_hole",
265
266 m_params.emplace_back( new PARAM_SCALED<int>( "rules.min_hole_clearance",
268 pcbIUScale.mmToIU( 0.00 ), pcbIUScale.mmToIU( 100.0 ), pcbIUScale.MM_PER_IU ) );
269
270 m_params.emplace_back( new PARAM_SCALED<int>( "rules.min_silk_clearance",
272 pcbIUScale.mmToIU( 0.00 ), pcbIUScale.mmToIU( 100.0 ), pcbIUScale.MM_PER_IU ) );
273
274 // While the maximum *effective* value is 4, we've had users interpret this as the count on
275 // all layers, and enter something like 10. They'll figure it out soon enough *unless* we
276 // enforce a max of 4 (and therefore reset it back to the default of 2), at which point it
277 // just looks buggy.
278 m_params.emplace_back( new PARAM<int>( "rules.min_resolved_spokes",
280
281 m_params.emplace_back( new PARAM_SCALED<int>( "rules.min_text_height",
283 pcbIUScale.mmToIU( 0.00 ), pcbIUScale.mmToIU( 100.0 ), pcbIUScale.MM_PER_IU ) );
284
285 m_params.emplace_back( new PARAM_SCALED<int>( "rules.min_text_thickness",
288
289 // Note: a clearance of -0.01 is a flag indicating we should use the legacy (pre-6.0) method
290 // based on the edge cut thicknesses.
291 m_params.emplace_back( new PARAM_SCALED<int>( "rules.min_copper_edge_clearance",
293 pcbIUScale.mmToIU( -0.01 ), pcbIUScale.mmToIU( 25.0 ), pcbIUScale.MM_PER_IU ) );
294
295 m_params.emplace_back( new PARAM_LAMBDA<nlohmann::json>( "rule_severities",
296 [&]() -> nlohmann::json
297 {
298 nlohmann::json ret = {};
299
300 for( const RC_ITEM& item : DRC_ITEM::GetItemsWithSeverities() )
301 {
302 wxString name = item.GetSettingsKey();
303 int code = item.GetErrorCode();
304
305 if( name.IsEmpty() || m_DRCSeverities.count( code ) == 0 )
306 continue;
307
308 ret[std::string( name.ToUTF8() )] = SeverityToString( m_DRCSeverities[code] );
309 }
310
311 return ret;
312 },
313 [&]( const nlohmann::json& aJson )
314 {
315 if( !aJson.is_object() )
316 return;
317
318 for( const RC_ITEM& item : DRC_ITEM::GetItemsWithSeverities() )
319 {
320 wxString name = item.GetSettingsKey();
321 std::string key( name.ToUTF8() );
322
323 if( aJson.contains( key ) )
324 m_DRCSeverities[item.GetErrorCode()] = SeverityFromString( aJson[key] );
325 }
326 }, {} ) );
327
328 m_params.emplace_back( new PARAM_LAMBDA<nlohmann::json>( "drc_exclusions",
329 [&]() -> nlohmann::json
330 {
331 nlohmann::json js = nlohmann::json::array();
332
333 for( const auto& entry : m_DrcExclusions )
334 js.push_back( entry );
335
336 return js;
337 },
338 [&]( const nlohmann::json& aObj )
339 {
340 m_DrcExclusions.clear();
341
342 if( !aObj.is_array() )
343 return;
344
345 for( const nlohmann::json& entry : aObj )
346 {
347 if( entry.empty() )
348 continue;
349
350 m_DrcExclusions.insert( entry.get<wxString>() );
351 }
352 },
353 {} ) );
354
355 m_params.emplace_back( new PARAM_LAMBDA<nlohmann::json>( "track_widths",
356 [&]() -> nlohmann::json
357 {
358 nlohmann::json js = nlohmann::json::array();
359
360 for( const int& width : m_TrackWidthList )
361 js.push_back( pcbIUScale.IUTomm( width ) );
362
363 return js;
364 },
365 [&]( const nlohmann::json& aJson )
366 {
367 if( !aJson.is_array() )
368 return;
369
370 m_TrackWidthList.clear();
371
372 for( const nlohmann::json& entry : aJson )
373 {
374 if( entry.empty() )
375 continue;
376
377 m_TrackWidthList.emplace_back( pcbIUScale.mmToIU( entry.get<double>() ) );
378 }
379 },
380 {} ) );
381
382 m_params.emplace_back( new PARAM_LAMBDA<nlohmann::json>( "via_dimensions",
383 [&]() -> nlohmann::json
384 {
385 nlohmann::json js = nlohmann::json::array();
386
387 for( const auto& via : m_ViasDimensionsList )
388 {
389 nlohmann::json entry = {};
390
391 entry["diameter"] = pcbIUScale.IUTomm( via.m_Diameter );
392 entry["drill"] = pcbIUScale.IUTomm( via.m_Drill );
393
394 js.push_back( entry );
395 }
396
397 return js;
398 },
399 [&]( const nlohmann::json& aObj )
400 {
401 if( !aObj.is_array() )
402 return;
403
404 m_ViasDimensionsList.clear();
405
406 for( const nlohmann::json& entry : aObj )
407 {
408 if( entry.empty() || !entry.is_object() )
409 continue;
410
411 if( !entry.contains( "diameter" ) || !entry.contains( "drill" ) )
412 continue;
413
414 int diameter = pcbIUScale.mmToIU( entry["diameter"].get<double>() );
415 int drill = pcbIUScale.mmToIU( entry["drill"].get<double>() );
416
417 m_ViasDimensionsList.emplace_back( VIA_DIMENSION( diameter, drill ) );
418 }
419 },
420 {} ) );
421
422 m_params.emplace_back( new PARAM_LAMBDA<nlohmann::json>( "diff_pair_dimensions",
423 [&]() -> nlohmann::json
424 {
425 nlohmann::json js = nlohmann::json::array();
426
427 for( const auto& pair : m_DiffPairDimensionsList )
428 {
429 nlohmann::json entry = {};
430
431 entry["width"] = pcbIUScale.IUTomm( pair.m_Width );
432 entry["gap"] = pcbIUScale.IUTomm( pair.m_Gap );
433 entry["via_gap"] = pcbIUScale.IUTomm( pair.m_ViaGap );
434
435 js.push_back( entry );
436 }
437
438 return js;
439 },
440 [&]( const nlohmann::json& aObj )
441 {
442 if( !aObj.is_array() )
443 return;
444
446
447 for( const nlohmann::json& entry : aObj )
448 {
449 if( entry.empty() || !entry.is_object() )
450 continue;
451
452 if( !entry.contains( "width" ) || !entry.contains( "gap" )
453 || !entry.contains( "via_gap" ) )
454 continue;
455
456 int width = pcbIUScale.mmToIU( entry["width"].get<double>() );
457 int gap = pcbIUScale.mmToIU( entry["gap"].get<double>() );
458 int via_gap = pcbIUScale.mmToIU( entry["via_gap"].get<double>() );
459
460 m_DiffPairDimensionsList.emplace_back(
461 DIFF_PAIR_DIMENSION( width, gap, via_gap ) );
462 }
463 },
464 {} ) );
465
466 // Handle options for teardrops (targets and some others):
467 m_params.emplace_back( new PARAM_LAMBDA<nlohmann::json>( "teardrop_options",
468 [&]() -> nlohmann::json
469 {
470 nlohmann::json js = nlohmann::json::array();
471 nlohmann::json entry = {};
472
473 entry["td_onviapad"] = m_TeardropParamsList.m_TargetViasPads;
474 entry["td_onpadsmd"] = m_TeardropParamsList.m_TargetPadsWithNoHole;
475 entry["td_ontrackend"] = m_TeardropParamsList.m_TargetTrack2Track;
476 entry["td_onroundshapesonly"] = m_TeardropParamsList.m_UseRoundShapesOnly;
477
478 js.push_back( entry );
479
480 return js;
481 },
482 [&]( const nlohmann::json& aObj )
483 {
484 if( !aObj.is_array() )
485 return;
486
487 for( const nlohmann::json& entry : aObj )
488 {
489 if( entry.empty() || !entry.is_object() )
490 continue;
491
492 if( entry.contains( "td_onviapad" ) )
493 m_TeardropParamsList.m_TargetViasPads = entry["td_onviapad"].get<bool>();
494
495 if( entry.contains( "td_onpadsmd" ) )
496 m_TeardropParamsList.m_TargetPadsWithNoHole = entry["td_onpadsmd"].get<bool>();
497
498 if( entry.contains( "td_ontrackend" ) )
499 m_TeardropParamsList.m_TargetTrack2Track = entry["td_ontrackend"].get<bool>();
500
501 if( entry.contains( "td_onroundshapesonly" ) )
502 m_TeardropParamsList.m_UseRoundShapesOnly = entry["td_onroundshapesonly"].get<bool>();
503
504 // Legacy settings
505 for( int ii = 0; ii < 3; ++ii )
506 {
508
509 if( entry.contains( "td_allow_use_two_tracks" ) )
510 td_prm->m_AllowUseTwoTracks = entry["td_allow_use_two_tracks"].get<bool>();
511
512 if( entry.contains( "td_curve_segcount" ) )
513 td_prm->m_CurveSegCount = entry["td_curve_segcount"].get<int>();
514
515 if( entry.contains( "td_on_pad_in_zone" ) )
516 td_prm->m_TdOnPadsInZones = entry["td_on_pad_in_zone"].get<bool>();
517 }
518 }
519 },
520 {} ) );
521
522 // Handle parameters (sizes, shape) for each type of teardrop:
523 m_params.emplace_back( new PARAM_LAMBDA<nlohmann::json>( "teardrop_parameters",
524 [&]() -> nlohmann::json
525 {
526 nlohmann::json js = nlohmann::json::array();
527
528 for( size_t ii = 0; ii < m_TeardropParamsList.GetParametersCount(); ii++ )
529 {
530 nlohmann::json entry = {};
532
533 entry["td_target_name"] = GetTeardropTargetCanonicalName( (TARGET_TD)ii );
534 entry["td_maxlen"] = pcbIUScale.IUTomm( td_prm->m_TdMaxLen );
535 entry["td_maxheight"] = pcbIUScale.IUTomm( td_prm->m_TdMaxWidth );
536 entry["td_length_ratio"] = td_prm->m_BestLengthRatio;
537 entry["td_height_ratio"] = td_prm->m_BestWidthRatio;
538 entry["td_curve_segcount"] = td_prm->m_CurveSegCount;
539 entry["td_width_to_size_filter_ratio"] = td_prm->m_WidthtoSizeFilterRatio;
540 entry["td_allow_use_two_tracks"] = td_prm->m_AllowUseTwoTracks;
541 entry["td_curve_segcount"] = td_prm->m_CurveSegCount;
542 entry["td_on_pad_in_zone"] = td_prm->m_TdOnPadsInZones;
543
544 js.push_back( entry );
545 }
546
547 return js;
548 },
549 [&]( const nlohmann::json& aObj )
550 {
551 if( !aObj.is_array() )
552 return;
553
554 for( const nlohmann::json& entry : aObj )
555 {
556 if( entry.empty() || !entry.is_object() )
557 continue;
558
559 if( !entry.contains( "td_target_name" ) )
560 continue;
561
562 int idx = GetTeardropTargetTypeFromCanonicalName( entry["td_target_name"].get<std::string>() );
563
564 if( idx >= 0 && idx < 3 )
565 {
567
568 if( entry.contains( "td_maxlen" ) )
569 td_prm->m_TdMaxLen = pcbIUScale.mmToIU( entry["td_maxlen"].get<double>() );
570
571 if( entry.contains( "td_maxheight" ) )
572 td_prm->m_TdMaxWidth = pcbIUScale.mmToIU( entry["td_maxheight"].get<double>() );
573
574 if( entry.contains( "td_length_ratio" ) )
575 td_prm->m_BestLengthRatio = entry["td_length_ratio"].get<double>();
576
577 if( entry.contains( "td_height_ratio" ) )
578 td_prm->m_BestWidthRatio = entry["td_height_ratio"].get<double>();
579
580 if( entry.contains( "td_curve_segcount" ) )
581 td_prm->m_CurveSegCount = entry["td_curve_segcount"].get<int>();
582
583 if( entry.contains( "td_width_to_size_filter_ratio" ) )
584 td_prm->m_WidthtoSizeFilterRatio = entry["td_width_to_size_filter_ratio"].get<double>();
585
586 if( entry.contains( "td_allow_use_two_tracks" ) )
587 td_prm->m_AllowUseTwoTracks = entry["td_allow_use_two_tracks"].get<bool>();
588
589 if( entry.contains( "td_curve_segcount" ) )
590 td_prm->m_CurveSegCount = entry["td_curve_segcount"].get<int>();
591
592 if( entry.contains( "td_on_pad_in_zone" ) )
593 td_prm->m_TdOnPadsInZones = entry["td_on_pad_in_zone"].get<bool>();
594 }
595 }
596 },
597 {} ) );
598
599 m_params.emplace_back( new PARAM_LAMBDA<nlohmann::json>( "tuning_pattern_settings",
600 [&]() -> nlohmann::json
601 {
602 nlohmann::json js = {};
603
604 auto make_settings =
605 []( const PNS::MEANDER_SETTINGS& aSettings )
606 {
607 nlohmann::json entry = {};
608
609 entry["min_amplitude"] = pcbIUScale.IUTomm( aSettings.m_minAmplitude );
610 entry["max_amplitude"] = pcbIUScale.IUTomm( aSettings.m_maxAmplitude );
611 entry["spacing"] = pcbIUScale.IUTomm( aSettings.m_spacing );
612 entry["corner_style"] = aSettings.m_cornerStyle == PNS::MEANDER_STYLE_CHAMFER ? 0 : 1;
613 entry["corner_radius_percentage"] = aSettings.m_cornerRadiusPercentage;
614 entry["single_sided"] = aSettings.m_singleSided;
615
616 return entry;
617 };
618
619 js["single_track_defaults"] = make_settings( m_singleTrackMeanderSettings );
620 js["diff_pair_defaults"] = make_settings( m_diffPairMeanderSettings );
621 js["diff_pair_skew_defaults"] = make_settings( m_skewMeanderSettings );
622
623 return js;
624 },
625 [&]( const nlohmann::json& aObj )
626 {
627 auto read_settings =
628 []( const nlohmann::json& entry ) -> PNS::MEANDER_SETTINGS
629 {
630 PNS::MEANDER_SETTINGS settings;
631
632 if( entry.contains( "min_amplitude" ) )
633 settings.m_minAmplitude = pcbIUScale.mmToIU( entry["min_amplitude"].get<double>() );
634
635 if( entry.contains( "max_amplitude" ) )
636 settings.m_maxAmplitude = pcbIUScale.mmToIU( entry["max_amplitude"].get<double>() );
637
638 if( entry.contains( "spacing" ) )
639 settings.m_spacing = pcbIUScale.mmToIU( entry["spacing"].get<double>() );
640
641 if( entry.contains( "corner_style" ) )
642 {
643 settings.m_cornerStyle = entry["corner_style"] == 0 ? PNS::MEANDER_STYLE_CHAMFER
645 }
646
647 if( entry.contains( "corner_radius_percentage" ) )
648 settings.m_cornerRadiusPercentage = entry["corner_radius_percentage"].get<int>();
649
650 if( entry.contains( "single_sided" ) )
651 settings.m_singleSided = entry["single_sided"].get<bool>();
652
653 return settings;
654 };
655
656 if( aObj.contains( "single_track_defaults" ) )
657 m_singleTrackMeanderSettings = read_settings( aObj["single_track_defaults"] );
658
659 if( aObj.contains( "diff_pair_defaults" ) )
660 m_diffPairMeanderSettings = read_settings( aObj["diff_pair_defaults"] );
661
662 if( aObj.contains( "diff_pair_skew_defaults" ) )
663 m_skewMeanderSettings = read_settings( aObj["diff_pair_skew_defaults"] );
664 },
665 {} ) );
666
667 int minTextSize = pcbIUScale.MilsToIU( TEXT_MIN_SIZE_MILS );
668 int maxTextSize = pcbIUScale.MilsToIU( TEXT_MAX_SIZE_MILS );
669 int minStroke = 1;
670 int maxStroke = pcbIUScale.mmToIU( 100 );
671
672 m_params.emplace_back( new PARAM_SCALED<int>( "defaults.silk_line_width",
674 minStroke, maxStroke, pcbIUScale.MM_PER_IU ) );
675
676 m_params.emplace_back( new PARAM_SCALED<int>( "defaults.silk_text_size_v",
678 minTextSize, maxTextSize, pcbIUScale.MM_PER_IU ) );
679
680 m_params.emplace_back( new PARAM_SCALED<int>( "defaults.silk_text_size_h",
682 minTextSize, maxTextSize, pcbIUScale.MM_PER_IU ) );
683
684 m_params.emplace_back( new PARAM_SCALED<int>( "defaults.silk_text_thickness",
686 minStroke, maxStroke, pcbIUScale.MM_PER_IU ) );
687
688 m_params.emplace_back( new PARAM<bool>( "defaults.silk_text_italic",
689 &m_TextItalic[LAYER_CLASS_SILK], false ) );
690
691 m_params.emplace_back( new PARAM<bool>( "defaults.silk_text_upright",
692 &m_TextUpright[ LAYER_CLASS_SILK ], true ) );
693
694 m_params.emplace_back( new PARAM_SCALED<int>( "defaults.copper_line_width",
696 minStroke, maxStroke, pcbIUScale.MM_PER_IU ) );
697
698 m_params.emplace_back( new PARAM_SCALED<int>( "defaults.copper_text_size_v",
700 minTextSize, maxTextSize, pcbIUScale.MM_PER_IU ) );
701
702 m_params.emplace_back( new PARAM_SCALED<int>( "defaults.copper_text_size_h",
704 minTextSize, maxTextSize, pcbIUScale.MM_PER_IU ) );
705
706 m_params.emplace_back( new PARAM_SCALED<int>( "defaults.copper_text_thickness",
708 minStroke, maxStroke, pcbIUScale.MM_PER_IU ) );
709
710 m_params.emplace_back( new PARAM<bool>( "defaults.copper_text_italic",
711 &m_TextItalic[LAYER_CLASS_COPPER], false ) );
712
713 m_params.emplace_back( new PARAM<bool>( "defaults.copper_text_upright",
715
716 m_params.emplace_back( new PARAM_SCALED<int>( "defaults.board_outline_line_width",
718 minStroke, maxStroke, pcbIUScale.MM_PER_IU ) );
719
720 m_params.emplace_back( new PARAM_SCALED<int>( "defaults.courtyard_line_width",
722 minStroke, maxStroke, pcbIUScale.MM_PER_IU ) );
723
724 m_params.emplace_back( new PARAM_SCALED<int>( "defaults.fab_line_width",
726 minStroke, maxStroke, pcbIUScale.MM_PER_IU ) );
727
728 m_params.emplace_back( new PARAM_SCALED<int>( "defaults.fab_text_size_v",
730 minTextSize, maxTextSize, pcbIUScale.MM_PER_IU ) );
731
732 m_params.emplace_back( new PARAM_SCALED<int>( "defaults.fab_text_size_h",
734 minTextSize, maxTextSize, pcbIUScale.MM_PER_IU ) );
735
736 m_params.emplace_back( new PARAM_SCALED<int>( "defaults.fab_text_thickness",
738 minStroke, maxStroke, pcbIUScale.MM_PER_IU ) );
739
740 m_params.emplace_back( new PARAM<bool>( "defaults.fab_text_italic",
741 &m_TextItalic[LAYER_CLASS_FAB], false ) );
742
743 m_params.emplace_back( new PARAM<bool>( "defaults.fab_text_upright",
744 &m_TextUpright[LAYER_CLASS_FAB], true ) );
745
746 m_params.emplace_back( new PARAM_SCALED<int>( "defaults.other_line_width",
748 minStroke, maxStroke, pcbIUScale.MM_PER_IU ) );
749
750 m_params.emplace_back( new PARAM_SCALED<int>( "defaults.other_text_size_v",
752 minTextSize, maxTextSize, pcbIUScale.MM_PER_IU ) );
753
754 m_params.emplace_back( new PARAM_SCALED<int>( "defaults.other_text_size_h",
756 minTextSize, maxTextSize, pcbIUScale.MM_PER_IU ) );
757
758 m_params.emplace_back( new PARAM_SCALED<int>( "defaults.other_text_thickness",
760 minStroke, maxStroke, pcbIUScale.MM_PER_IU ) );
761
762 m_params.emplace_back( new PARAM<bool>( "defaults.other_text_italic",
763 &m_TextItalic[LAYER_CLASS_OTHERS], false ) );
764
765 m_params.emplace_back( new PARAM<bool>( "defaults.other_text_upright",
767
768 m_params.emplace_back( new PARAM_ENUM<DIM_UNITS_MODE>( "defaults.dimension_units",
769 &m_DimensionUnitsMode, DIM_UNITS_MODE::AUTOMATIC, DIM_UNITS_MODE::INCHES,
770 DIM_UNITS_MODE::AUTOMATIC ) );
771
772 m_params.emplace_back( new PARAM_ENUM<DIM_PRECISION>( "defaults.dimension_precision",
773 &m_DimensionPrecision, DIM_PRECISION::X_XXXX, DIM_PRECISION::X, DIM_PRECISION::V_VVVVV ) );
774
775 m_params.emplace_back( new PARAM_ENUM<DIM_UNITS_FORMAT>( "defaults.dimensions.units_format",
776 &m_DimensionUnitsFormat, DIM_UNITS_FORMAT::BARE_SUFFIX, DIM_UNITS_FORMAT::NO_SUFFIX,
777 DIM_UNITS_FORMAT::PAREN_SUFFIX ) );
778
779 m_params.emplace_back( new PARAM<bool>( "defaults.dimensions.suppress_zeroes",
780 &m_DimensionSuppressZeroes, false ) );
781
782 // NOTE: excluding DIM_TEXT_POSITION::MANUAL from the valid range here
783 m_params.emplace_back( new PARAM_ENUM<DIM_TEXT_POSITION>( "defaults.dimensions.text_position",
784 &m_DimensionTextPosition, DIM_TEXT_POSITION::OUTSIDE, DIM_TEXT_POSITION::OUTSIDE,
785 DIM_TEXT_POSITION::INLINE ) );
786
787 m_params.emplace_back( new PARAM<bool>( "defaults.dimensions.keep_text_aligned",
789
790 m_params.emplace_back( new PARAM<int>( "defaults.dimensions.arrow_length",
793
794 m_params.emplace_back( new PARAM<int>( "defaults.dimensions.extension_offset",
797
798 m_params.emplace_back( new PARAM<bool>( "defaults.apply_defaults_to_fp_fields",
799 &m_StyleFPFields, false ) );
800 m_params.emplace_back( new PARAM<bool>( "defaults.apply_defaults_to_fp_text",
801 &m_StyleFPText, false ) );
802 m_params.emplace_back( new PARAM<bool>( "defaults.apply_defaults_to_fp_shapes",
803 &m_StyleFPShapes, false ) );
804
805 m_params.emplace_back( new PARAM_SCALED<int>( "defaults.zones.min_clearance",
808
809 m_params.emplace_back( new PARAM_LAMBDA<nlohmann::json>( "defaults.pads",
810 [&]() -> nlohmann::json
811 {
812 nlohmann::json ret =
813 {
814 { "width", pcbIUScale.IUTomm( m_Pad_Master->GetSize().x ) },
815 { "height", pcbIUScale.IUTomm( m_Pad_Master->GetSize().y ) },
816 { "drill", pcbIUScale.IUTomm( m_Pad_Master->GetDrillSize().x ) }
817 };
818
819 return ret;
820 },
821 [&]( const nlohmann::json& aJson )
822 {
823 if( aJson.contains( "width" ) && aJson.contains( "height" )
824 && aJson.contains( "drill" ) )
825 {
826 VECTOR2I sz;
827 sz.x = pcbIUScale.mmToIU( aJson["width"].get<double>() );
828 sz.y = pcbIUScale.mmToIU( aJson["height"].get<double>() );
829
830 m_Pad_Master->SetSize( sz );
831
832 int drill = pcbIUScale.mmToIU( aJson["drill"].get<double>() );
833
834 m_Pad_Master->SetDrillSize( VECTOR2I( drill, drill ) );
835 }
836 }, {} ) );
837
838 m_params.emplace_back( new PARAM_SCALED<int>( "rules.max_error",
840
841 m_params.emplace_back( new PARAM_SCALED<int>( "rules.solder_mask_to_copper_clearance",
844
845 m_params.emplace_back( new PARAM<bool>( "zones_allow_external_fillets",
846 &m_ZoneKeepExternalFillets, false ) );
847
849
850 registerMigration( 1, 2,
851 [&]() -> bool
852 {
853 // Schema 1 to 2: move mask and paste margin settings back to board.
854 // The parameters are removed, so we just have to manually load them here and
855 // they will get saved with the board
856 if( std::optional<double> optval = Get<double>( "rules.solder_mask_clearance" ) )
857 m_SolderMaskExpansion = static_cast<int>( *optval * pcbIUScale.IU_PER_MM );
858
859 if( std::optional<double> optval = Get<double>( "rules.solder_mask_min_width" ) )
860 m_SolderMaskMinWidth = static_cast<int>( *optval * pcbIUScale.IU_PER_MM );
861
862 if( std::optional<double> optval = Get<double>( "rules.solder_paste_clearance" ) )
863 m_SolderPasteMargin = static_cast<int>( *optval * pcbIUScale.IU_PER_MM );
864
865 if( std::optional<double> optval = Get<double>( "rules.solder_paste_margin_ratio" ) )
866 m_SolderPasteMarginRatio = *optval;
867
868 try
869 {
870 At( "rules" ).erase( "solder_mask_clearance" );
871 At( "rules" ).erase( "solder_mask_min_width" );
872 At( "rules" ).erase( "solder_paste_clearance" );
873 At( "rules" ).erase( "solder_paste_margin_ratio" );
874 }
875 catch( ... )
876 {}
877
878 return true;
879 } );
880}
881
882
884{
885 if( m_parent )
886 {
888 m_parent = nullptr;
889 }
890}
891
892
894 NESTED_SETTINGS( "board_design_settings", bdsSchemaVersion, aOther.m_parent,
895 aOther.m_path ),
896 m_Pad_Master( nullptr )
897{
898 initFromOther( aOther );
899}
900
901
903{
904 initFromOther( aOther );
905 return *this;
906}
907
908
910{
911 // Copy of NESTED_SETTINGS around is not allowed, so let's just update the params.
919 m_MinConn = aOther.m_MinConn;
936 m_MaxError = aOther.m_MaxError;
944
945 std::copy( std::begin( aOther.m_LineThickness ), std::end( aOther.m_LineThickness ),
946 std::begin( m_LineThickness ) );
947
948 std::copy( std::begin( aOther.m_TextSize ), std::end( aOther.m_TextSize ),
949 std::begin( m_TextSize ) );
950
951 std::copy( std::begin( aOther.m_TextThickness ), std::end( aOther.m_TextThickness ),
952 std::begin( m_TextThickness ) );
953
954 std::copy( std::begin( aOther.m_TextItalic ), std::end( aOther.m_TextItalic ),
955 std::begin( m_TextItalic ) );
956
957 std::copy( std::begin( aOther.m_TextUpright ), std::end( aOther.m_TextUpright ),
958 std::begin( m_TextUpright ) );
959
968
969 m_auxOrigin = aOther.m_auxOrigin;
970 m_gridOrigin = aOther.m_gridOrigin;
971 m_HasStackup = aOther.m_HasStackup;
973
986 m_stackup = aOther.m_stackup;
988 m_Pad_Master = std::make_unique<PAD>( *aOther.m_Pad_Master );
990}
991
992
994{
1012 std::string units_ptr( "defaults.dimension_units" );
1013 std::string precision_ptr( "defaults.dimension_precision" );
1014
1015 if( !( Contains( units_ptr ) && Contains( precision_ptr ) &&
1016 At( units_ptr ).is_number_integer() &&
1017 At( precision_ptr ).is_number_integer() ) )
1018 {
1019 // if either is missing or invalid, migration doesn't make sense
1020 return true;
1021 }
1022
1023 int units = *Get<int>( units_ptr );
1024 int precision = *Get<int>( precision_ptr );
1025
1026 // The enum maps directly to precision if the units is mils
1027 int extraDigits = 0;
1028
1029 switch( units )
1030 {
1031 case 0: extraDigits = 3; break;
1032 case 2: extraDigits = 2; break;
1033 default: break;
1034 }
1035
1036 precision += extraDigits;
1037
1038 Set( precision_ptr, precision );
1039
1040 return true;
1041}
1042
1043
1044bool BOARD_DESIGN_SETTINGS::LoadFromFile( const wxString& aDirectory )
1045{
1046 bool ret = NESTED_SETTINGS::LoadFromFile( aDirectory );
1047
1048 // A number of things won't have been translated by the PROJECT_FILE migration because of
1049 // descoped objects required to decode this data. So, it will be in the legacy.pcbnew
1050 // section and needs to be pulled out here
1051
1052 PROJECT_FILE* project = dynamic_cast<PROJECT_FILE*>( GetParent() );
1053
1054 if( !project )
1055 return ret;
1056
1057 bool migrated = false;
1058
1059 auto drcName =
1060 []( int aCode ) -> std::string
1061 {
1062 std::shared_ptr<DRC_ITEM> item = DRC_ITEM::Create( aCode );
1063 wxString name = item->GetSettingsKey();
1064 return std::string( name.ToUTF8() );
1065 };
1066
1067 const std::string rs = "rule_severities.";
1068 const std::string no_courtyard_key = "legacy_no_courtyard_defined";
1069 const std::string courtyard_overlap_key = "legacy_courtyards_overlap";
1070
1071 try
1072 {
1073 nlohmann::json& severities =
1074 project->Internals()->at( "/board/design_settings/rule_severities"_json_pointer );
1075
1076 if( severities.contains( no_courtyard_key ) )
1077 {
1078 if( severities[no_courtyard_key].get<bool>() )
1079 Set( rs + drcName( DRCE_MISSING_COURTYARD ), "error" );
1080 else
1081 Set( rs + drcName( DRCE_MISSING_COURTYARD ), "ignore" );
1082
1083 severities.erase( no_courtyard_key );
1084 migrated = true;
1085 }
1086
1087 if( severities.contains( courtyard_overlap_key ) )
1088 {
1089 if( severities[courtyard_overlap_key].get<bool>() )
1090 Set( rs + drcName( DRCE_OVERLAPPING_FOOTPRINTS ), "error" );
1091 else
1092 Set( rs + drcName( DRCE_OVERLAPPING_FOOTPRINTS ), "ignore" );
1093
1094 severities.erase( courtyard_overlap_key );
1095 migrated = true;
1096 }
1097 }
1098 catch( ... )
1099 {
1100 }
1101 if( Contains( "legacy" ) )
1102 {
1103 // This defaults to false for new boards, but version 5.1.x and prior kept the fillets
1104 // so we do the same for legacy boards.
1106
1107 project->At( "legacy" ).erase( "pcbnew" );
1108 }
1109
1110 // Now that we have everything, we need to load again
1111 if( migrated )
1112 Load();
1113
1114 return ret;
1115}
1116
1117
1119{
1120 return m_DRCSeverities[ aDRCErrorCode ];
1121}
1122
1123
1124bool BOARD_DESIGN_SETTINGS::Ignore( int aDRCErrorCode )
1125{
1126 return m_DRCSeverities[ aDRCErrorCode ] == RPT_SEVERITY_IGNORE;
1127}
1128
1129
1131{
1132 int biggest = std::max( m_MinClearance, m_HoleClearance );
1133 DRC_CONSTRAINT constraint;
1134
1135 biggest = std::max( biggest, m_HoleToHoleMin );
1136 biggest = std::max( biggest, m_CopperEdgeClearance );
1137
1138 if( m_DRCEngine )
1139 {
1140 m_DRCEngine->QueryWorstConstraint( CLEARANCE_CONSTRAINT, constraint );
1141 biggest = std::max( biggest, constraint.Value().Min() );
1142
1143 m_DRCEngine->QueryWorstConstraint( HOLE_CLEARANCE_CONSTRAINT, constraint );
1144 biggest = std::max( biggest, constraint.Value().Min() );
1145
1146 m_DRCEngine->QueryWorstConstraint( EDGE_CLEARANCE_CONSTRAINT, constraint );
1147 biggest = std::max( biggest, constraint.Value().Min() );
1148
1149 m_DRCEngine->QueryWorstConstraint( HOLE_TO_HOLE_CONSTRAINT, constraint );
1150 biggest = std::max( biggest, constraint.Value().Min() );
1151 }
1152
1153 return biggest;
1154}
1155
1156
1158{
1159 int clearance = m_NetSettings->m_DefaultNetClass->GetClearance();
1160
1161 for( const auto& [ name, netclass ] : m_NetSettings->m_NetClasses )
1162 clearance = std::min( clearance, netclass->GetClearance() );
1163
1164 return clearance;
1165}
1166
1167
1169{
1170 m_viaSizeIndex = std::min( aIndex, (unsigned) m_ViasDimensionsList.size() );
1171 m_useCustomTrackVia = false;
1172}
1173
1174
1176{
1179 else if( m_viaSizeIndex == 0 )
1180 return m_NetSettings->m_DefaultNetClass->GetViaDiameter();
1181 else
1182 return m_ViasDimensionsList[ m_viaSizeIndex ].m_Diameter;
1183}
1184
1185
1187{
1188 int drill;
1189
1191 drill = m_customViaSize.m_Drill;
1192 else if( m_viaSizeIndex == 0 )
1193 drill = m_NetSettings->m_DefaultNetClass->GetViaDrill();
1194 else
1195 drill = m_ViasDimensionsList[ m_viaSizeIndex ].m_Drill;
1196
1197 return drill > 0 ? drill : -1;
1198}
1199
1200
1202{
1203 m_trackWidthIndex = std::min( aIndex, (unsigned) m_TrackWidthList.size() );
1204 m_useCustomTrackVia = false;
1205}
1206
1207
1209{
1211 return m_customTrackWidth;
1212 else if( m_trackWidthIndex == 0 )
1213 return m_NetSettings->m_DefaultNetClass->GetTrackWidth();
1214 else
1216}
1217
1218
1220{
1221 if( !m_DiffPairDimensionsList.empty() )
1222 {
1223 m_diffPairIndex = std::min( aIndex,
1224 static_cast<unsigned>( m_DiffPairDimensionsList.size() ) - 1 );
1225 }
1226
1227 m_useCustomDiffPair = false;
1228}
1229
1230
1232{
1234 {
1236 }
1237 else if( m_diffPairIndex == 0 )
1238 {
1239 if( m_NetSettings->m_DefaultNetClass->HasDiffPairWidth() )
1240 return m_NetSettings->m_DefaultNetClass->GetDiffPairWidth();
1241 else
1242 return m_NetSettings->m_DefaultNetClass->GetTrackWidth();
1243 }
1244 else
1245 {
1247 }
1248}
1249
1250
1252{
1254 {
1255 return m_customDiffPair.m_Gap;
1256 }
1257 else if( m_diffPairIndex == 0 )
1258 {
1259 if( m_NetSettings->m_DefaultNetClass->HasDiffPairGap() )
1260 return m_NetSettings->m_DefaultNetClass->GetDiffPairGap();
1261 else
1262 return m_NetSettings->m_DefaultNetClass->GetClearance();
1263 }
1264 else
1265 {
1267 }
1268}
1269
1270
1272{
1274 {
1276 }
1277 else if( m_diffPairIndex == 0 )
1278 {
1279 if( m_NetSettings->m_DefaultNetClass->HasDiffPairViaGap() )
1280 return m_NetSettings->m_DefaultNetClass->GetDiffPairViaGap();
1281 else
1282 return GetCurrentDiffPairGap();
1283 }
1284 else
1285 {
1287 }
1288}
1289
1290
1292{
1293 m_copperLayerCount = aNewLayerCount;
1294
1295 // Update only enabled copper layers mask
1296 m_enabledLayers &= ~LSET::AllCuMask();
1297
1298 if( aNewLayerCount > 0 )
1299 m_enabledLayers |= LSET::AllCuMask( aNewLayerCount );
1300}
1301
1302
1304{
1305 // Back and front layers are always enabled.
1306 aMask.set( B_Cu ).set( F_Cu );
1307
1308 m_enabledLayers = aMask;
1309
1310 // update m_CopperLayerCount to ensure its consistency with m_EnabledLayers
1311 m_copperLayerCount = ( aMask & LSET::AllCuMask() ).count();
1312}
1313
1314
1315// Return the layer class index { silk, copper, edges & courtyards, fab, others } of the
1316// given layer.
1318{
1319 if( aLayer == F_SilkS || aLayer == B_SilkS )
1320 return LAYER_CLASS_SILK;
1321 else if( IsCopperLayer( aLayer ) )
1322 return LAYER_CLASS_COPPER;
1323 else if( aLayer == Edge_Cuts )
1324 return LAYER_CLASS_EDGES;
1325 else if( aLayer == F_CrtYd || aLayer == B_CrtYd )
1326 return LAYER_CLASS_COURTYARD;
1327 else if( aLayer == F_Fab || aLayer == B_Fab )
1328 return LAYER_CLASS_FAB;
1329 else
1330 return LAYER_CLASS_OTHERS;
1331}
1332
1333
1335{
1336 return pcbIUScale.mmToIU( ADVANCED_CFG::GetCfg().m_DRCEpsilon );
1337}
1338
1339
1341{
1342 return pcbIUScale.mmToIU( ADVANCED_CFG::GetCfg().m_HoleWallThickness );
1343}
1344
1345
1347{
1348 return m_LineThickness[ GetLayerClass( aLayer ) ];
1349}
1350
1351
1353{
1354 return m_TextSize[ GetLayerClass( aLayer ) ];
1355}
1356
1357
1359{
1360 return m_TextThickness[ GetLayerClass( aLayer ) ];
1361}
1362
1363
1365{
1366 return m_TextItalic[ GetLayerClass( aLayer ) ];
1367}
1368
1369
1371{
1372 return m_TextUpright[ GetLayerClass( aLayer ) ];
1373}
const char * name
Definition: DXF_plotter.cpp:57
constexpr int ARC_HIGH_DEF
Definition: base_units.h:121
constexpr EDA_IU_SCALE pcbIUScale
Definition: base_units.h:109
const int bdsSchemaVersion
#define DEFAULT_MICROVIASMINDRILL
#define DEFAULT_SOLDERPASTE_CLEARANCE
#define DEFAULT_SOLDERPASTE_RATIO
#define DEFAULT_CUSTOMDPAIRWIDTH
#define DEFAULT_VIASMINSIZE
#define DEFAULT_TEXT_WIDTH
#define DEFAULT_COPPER_TEXT_WIDTH
#define DEFAULT_CUSTOMDPAIRGAP
#define DEFAULT_MINCLEARANCE
#define DEFAULT_HOLECLEARANCE
#define DEFAULT_SOLDERMASK_EXPANSION
#define DEFAULT_SOLDERMASK_MIN_WIDTH
#define DEFAULT_DIMENSION_EXTENSION_OFFSET
#define DEFAULT_COPPEREDGECLEARANCE
#define DEFAULT_DIMENSION_ARROW_LENGTH
#define DEFAULT_TRACKMINWIDTH
#define DEFAULT_MINTHROUGHDRILL
#define DEFAULT_SILK_TEXT_SIZE
#define DEFAULT_HOLETOHOLEMIN
#define DEFAULT_MINCONNECTION
#define DEFAULT_COPPER_LINE_WIDTH
#define DEFAULT_SILK_LINE_WIDTH
#define DEFAULT_SILKCLEARANCE
#define DEFAULT_MICROVIASMINSIZE
@ LAYER_CLASS_OTHERS
@ LAYER_CLASS_FAB
@ LAYER_CLASS_COURTYARD
@ LAYER_CLASS_SILK
@ LAYER_CLASS_COPPER
@ LAYER_CLASS_EDGES
#define DEFAULT_SILK_TEXT_WIDTH
#define DEFAULT_TEXT_SIZE
#define DEFAULT_EDGE_WIDTH
#define DEFAULT_CUSTOMTRACKWIDTH
#define DEFAULT_CUSTOMDPAIRVIAGAP
#define DEFAULT_COPPER_TEXT_SIZE
#define DEFAULT_SOLDERMASK_TO_COPPER_CLEARANCE
#define DEFAULT_LINE_WIDTH
#define DEFAULT_COURTYARD_WIDTH
#define DEFAULT_BOARD_THICKNESS_MM
#define DEFAULT_MINRESOLVEDSPOKES
static const ADVANCED_CFG & GetCfg()
Get the singleton instance's config, which is shared by all consumers.
Container for design settings for a BOARD object.
DIM_PRECISION m_DimensionPrecision
Number of digits after the decimal.
std::vector< TEXT_ITEM_INFO > m_DefaultFPTextItems
int GetHolePlatingThickness() const
Pad & via drills are finish size.
VIATYPE m_CurrentViaType
(VIA_BLIND_BURIED, VIA_THROUGH, VIA_MICROVIA)
void SetDiffPairIndex(unsigned aIndex)
std::shared_ptr< NET_SETTINGS > m_NetSettings
DIM_UNITS_FORMAT m_DimensionUnitsFormat
void initFromOther(const BOARD_DESIGN_SETTINGS &aOther)
bool GetTextUpright(PCB_LAYER_ID aLayer) const
std::map< int, SEVERITY > m_DRCSeverities
VECTOR2I m_gridOrigin
origin for grid offsets
int GetTextThickness(PCB_LAYER_ID aLayer) const
Return the default text thickness from the layer class for the given layer.
VECTOR2I m_auxOrigin
origin for plot exports
bool m_TextUpright[LAYER_CLASS_COUNT]
BOARD_DESIGN_SETTINGS(JSON_SETTINGS *aParent, const std::string &aPath)
bool GetTextItalic(PCB_LAYER_ID aLayer) const
wxString m_currentNetClassName
Current net class name used to display netclass info.
std::shared_ptr< DRC_ENGINE > m_DRCEngine
void SetEnabledLayers(LSET aMask)
Change the bit-mask of enabled layers to aMask.
std::vector< DIFF_PAIR_DIMENSION > m_DiffPairDimensionsList
PNS::MEANDER_SETTINGS m_skewMeanderSettings
std::set< wxString > m_DrcExclusions
bool Ignore(int aDRCErrorCode)
Return true if the DRC error code's severity is SEVERITY_IGNORE.
PNS::MEANDER_SETTINGS m_diffPairMeanderSettings
std::unique_ptr< PAD > m_Pad_Master
void SetTrackWidthIndex(unsigned aIndex)
Set the current track width list index to aIndex.
TEARDROP_PARAMETERS_LIST m_TeardropParamsList
The parameters of teardrops for the different teardrop targets (via/pad, track end) 3 set of paramete...
void SetViaSizeIndex(unsigned aIndex)
Set the current via size list index to aIndex.
PNS::MEANDER_SETTINGS m_singleTrackMeanderSettings
int GetLayerClass(PCB_LAYER_ID aLayer) const
int m_boardThickness
Board thickness for 3D viewer.
int m_copperLayerCount
Number of copper layers for this design.
bool LoadFromFile(const wxString &aDirectory="") override
Loads the backing file from disk and then calls Load()
int m_TextThickness[LAYER_CLASS_COUNT]
ZONE_SETTINGS m_defaultZoneSettings
The default settings that will be used for new zones.
SEVERITY GetSeverity(int aDRCErrorCode)
std::vector< int > m_TrackWidthList
DIFF_PAIR_DIMENSION m_customDiffPair
int m_LineThickness[LAYER_CLASS_COUNT]
VECTOR2I GetTextSize(PCB_LAYER_ID aLayer) const
Return the default text size from the layer class for the given layer.
int GetLineThickness(PCB_LAYER_ID aLayer) const
Return the default graphic segment thickness from the layer class for the given layer.
bool m_UseHeightForLengthCalcs
Enable inclusion of stackup height in track length measurements and length tuning.
VECTOR2I m_TextSize[LAYER_CLASS_COUNT]
LSET m_enabledLayers
Bit-mask for layer enabling.
bool m_TextItalic[LAYER_CLASS_COUNT]
void SetCopperLayerCount(int aNewLayerCount)
Set the copper layer count to aNewLayerCount.
DIM_TEXT_POSITION m_DimensionTextPosition
BOARD_STACKUP m_stackup
the description of layers stackup, for board fabrication only physical layers are in layers stackup.
DIM_UNITS_MODE m_DimensionUnitsMode
std::vector< VIA_DIMENSION > m_ViasDimensionsList
BOARD_DESIGN_SETTINGS & operator=(const BOARD_DESIGN_SETTINGS &aOther)
MINOPTMAX< int > & Value()
Definition: drc_rule.h:142
static std::vector< std::reference_wrapper< RC_ITEM > > GetItemsWithSeverities()
Definition: drc_item.h:122
static std::shared_ptr< DRC_ITEM > Create(int aErrorCode)
Constructs a DRC_ITEM for the given error code.
Definition: drc_item.cpp:325
bool Contains(const std::string &aPath) const
virtual void Load()
Updates the parameters of this object based on the current JSON document contents.
std::vector< PARAM_BASE * > m_params
The list of parameters (owned by this object)
void registerMigration(int aOldSchemaVersion, int aNewSchemaVersion, std::function< bool(void)> aMigrator)
Registers a migration from one schema version to another.
nlohmann::json & At(const std::string &aPath)
Wrappers for the underlying JSON API so that most consumers don't need json.hpp All of these function...
void ReleaseNestedSettings(NESTED_SETTINGS *aSettings)
Saves and frees a nested settings object, if it exists within this one.
void Set(const std::string &aPath, ValueType aVal)
Stores a value into the JSON document Will throw an exception if ValueType isn't something that the l...
bool m_resetParamsIfMissing
Whether or not to set parameters to their default value if missing from JSON on Load()
LSET is a set of PCB_LAYER_IDs.
Definition: layer_ids.h:556
static LSET AllCuMask(int aCuLayerCount=MAX_CU_LAYERS)
Return a mask holding the requested number of Cu PCB_LAYER_IDs.
Definition: lset.cpp:782
T Min() const
Definition: minoptmax.h:33
NESTED_SETTINGS is a JSON_SETTINGS that lives inside a JSON_SETTINGS.
JSON_SETTINGS * GetParent()
JSON_SETTINGS * m_parent
A pointer to the parent object to load and store from.
bool LoadFromFile(const wxString &aDirectory="") override
Loads the JSON document from the parent and then calls Load()
Stores an enum as an integer.
Definition: parameters.h:217
Like a normal param, but with custom getter and setter functions.
Definition: parameters.h:282
Represents a parameter that has a scaling factor between the value in the file and the value used int...
Definition: parameters.h:335
Dimensions for the meandering algorithm.
Definition: pns_meander.h:68
int m_minAmplitude
Maximum meandering amplitude.
Definition: pns_meander.h:128
int m_cornerRadiusPercentage
Place meanders on one side.
Definition: pns_meander.h:154
bool m_singleSided
Initial side when placing meanders at segment.
Definition: pns_meander.h:157
MEANDER_STYLE m_cornerStyle
Rounding percentage (0 - 100).
Definition: pns_meander.h:151
int m_maxAmplitude
Meandering period/spacing (see dialog picture for explanation).
Definition: pns_meander.h:131
int m_spacing
Amplitude/spacing adjustment step.
Definition: pns_meander.h:134
The backing store for a PROJECT, in JSON format.
Definition: project_file.h:70
A holder for a rule check item, DRC in Pcbnew or ERC in Eeschema.
Definition: rc_item.h:79
bool m_TargetPadsWithNoHole
True to create teardrops for pads without holes (SMD and others.
bool m_TargetViasPads
True to create teardrops for vias and pads with holes.
bool m_UseRoundShapesOnly
True to create teardrops for round shapes only.
bool m_TargetTrack2Track
True to create teardrops at the end of a track connected to the end of another track having a differe...
TEARDROP_PARAMETERS * GetParameters(TARGET_TD aTdType)
TEARDROP_PARAMETARS is a helper class to handle parameters needed to build teardrops for a board thes...
int m_CurveSegCount
number of segments to build the curved sides of a teardrop area must be > 2.
double m_BestWidthRatio
The height of a teardrop as ratio between height and size of pad/via.
int m_TdMaxLen
max allowed length for teardrops in IU. <= 0 to disable
bool m_AllowUseTwoTracks
True to create teardrops using 2 track segments if the first in too small.
int m_TdMaxWidth
max allowed height for teardrops in IU. <= 0 to disable
double m_BestLengthRatio
The length of a teardrop as ratio between length and size of pad/via.
double m_WidthtoSizeFilterRatio
The ratio (H/D) between the via/pad size and the track width max value to create a teardrop 1....
bool m_TdOnPadsInZones
A filter to exclude pads inside zone fills.
@ DRCE_SILK_EDGE_CLEARANCE
Definition: drc_item.h:90
@ DRCE_PADSTACK
Definition: drc_item.h:59
@ DRCE_LIB_FOOTPRINT_ISSUES
Definition: drc_item.h:76
@ DRCE_OVERLAPPING_FOOTPRINTS
Definition: drc_item.h:61
@ DRCE_OVERLAPPING_SILK
Definition: drc_item.h:93
@ DRCE_MISSING_COURTYARD
Definition: drc_item.h:62
@ DRCE_ISOLATED_COPPER
Definition: drc_item.h:47
@ DRCE_COPPER_SLIVER
Definition: drc_item.h:84
@ DRCE_PTH_IN_COURTYARD
Definition: drc_item.h:65
@ DRCE_FIRST
Definition: drc_item.h:38
@ DRCE_DANGLING_VIA
Definition: drc_item.h:49
@ DRCE_FOOTPRINT_TYPE_MISMATCH
Definition: drc_item.h:75
@ DRCE_DUPLICATE_FOOTPRINT
Definition: drc_item.h:71
@ DRCE_DANGLING_TRACK
Definition: drc_item.h:50
@ DRCE_TEXT_HEIGHT
Definition: drc_item.h:91
@ DRCE_DRILLED_HOLES_COLOCATED
Definition: drc_item.h:52
@ DRCE_EXTRA_FOOTPRINT
Definition: drc_item.h:72
@ DRCE_SILK_CLEARANCE
Definition: drc_item.h:88
@ DRCE_LAST
Definition: drc_item.h:101
@ DRCE_LIB_FOOTPRINT_MISMATCH
Definition: drc_item.h:77
@ DRCE_NET_CONFLICT
Definition: drc_item.h:73
@ DRCE_MISSING_FOOTPRINT
Definition: drc_item.h:70
@ DRCE_TEXT_THICKNESS
Definition: drc_item.h:92
@ DRCE_NPTH_IN_COURTYARD
Definition: drc_item.h:66
@ DRCE_CONNECTION_WIDTH
Definition: drc_item.h:56
@ EDGE_CLEARANCE_CONSTRAINT
Definition: drc_rule.h:50
@ CLEARANCE_CONSTRAINT
Definition: drc_rule.h:47
@ HOLE_CLEARANCE_CONSTRAINT
Definition: drc_rule.h:48
@ HOLE_TO_HOLE_CONSTRAINT
Definition: drc_rule.h:49
#define TEXT_MIN_SIZE_MILS
Minimum text size in mils.
Definition: eda_text.h:42
#define TEXT_MAX_SIZE_MILS
Maximum text size in mils (10 inches)
Definition: eda_text.h:43
bool IsCopperLayer(int aLayerId)
Tests whether a layer is a copper layer.
Definition: layer_ids.h:853
PCB_LAYER_ID
A quick note on layer IDs:
Definition: layer_ids.h:60
@ F_CrtYd
Definition: layer_ids.h:118
@ Edge_Cuts
Definition: layer_ids.h:114
@ B_Cu
Definition: layer_ids.h:96
@ F_Fab
Definition: layer_ids.h:121
@ F_SilkS
Definition: layer_ids.h:105
@ B_CrtYd
Definition: layer_ids.h:117
@ B_SilkS
Definition: layer_ids.h:104
@ F_Cu
Definition: layer_ids.h:65
@ B_Fab
Definition: layer_ids.h:120
@ MEANDER_STYLE_ROUND
Definition: pns_meander.h:52
@ MEANDER_STYLE_CHAMFER
Definition: pns_meander.h:53
SEVERITY
@ RPT_SEVERITY_WARNING
@ RPT_SEVERITY_ERROR
@ RPT_SEVERITY_IGNORE
Container to handle a stock of specific differential pairs each with unique track width,...
constexpr double IUTomm(int iu) const
Definition: base_units.h:87
const double IU_PER_MM
Definition: base_units.h:77
const double MM_PER_IU
Definition: base_units.h:79
constexpr int MilsToIU(int mils) const
Definition: base_units.h:94
constexpr int mmToIU(double mm) const
Definition: base_units.h:89
Container to handle a stock of specific vias each with unique diameter and drill sizes in the BOARD c...
std::string GetTeardropTargetCanonicalName(TARGET_TD aTdType)
TARGET_TD GetTeardropTargetTypeFromCanonicalName(const std::string &aTargetName)
wxString SeverityToString(const SEVERITY &aSeverity)
Definition: ui_common.cpp:63
VECTOR2< int > VECTOR2I
Definition: vector2d.h:588
#define ZONE_CLEARANCE_MM
Definition: zones.h:37