KiCad PCB EDA Suite
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-2019 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 <fctsys.h>
25 #include <common.h>
26 #include <class_board.h>
27 #include <class_track.h>
29 #include <kiface_i.h>
30 #include <pcbnew.h>
31 #include <board_design_settings.h>
32 #include <drc/drc.h>
33 #include <widgets/ui_common.h>
34 #include <drc/drc_rule.h>
35 
36 #define CopperLayerCountKey wxT( "CopperLayerCount" )
37 #define BoardThicknessKey wxT( "BoardThickness" )
38 
39 #define LayerKeyPrefix wxT( "Layer" )
40 #define LayerNameKey wxT( "Name" )
41 #define LayerTypeKey wxT( "Type" )
42 #define LayerEnabledKey wxT( "Enabled" )
43 
44 #define NetclassNameKey wxT( "Name" )
45 #define ClearanceKey wxT( "Clearance" )
46 #define TrackWidthKey wxT( "TrackWidth" )
47 #define ViaDiameterKey wxT( "ViaDiameter" )
48 #define ViaDrillKey wxT( "ViaDrill" )
49 #define uViaDiameterKey wxT( "uViaDiameter" )
50 #define uViaDrillKey wxT( "uViaDrill" )
51 #define dPairWidthKey wxT( "dPairWidth" )
52 #define dPairGapKey wxT( "dPairGap" )
53 #define dPairViaGapKey wxT( "dPairViaGap" )
54 
55 
56 class PARAM_CFG_SEVERITIES : public PARAM_CFG
57 {
58 protected:
60 
61 public:
62  PARAM_CFG_SEVERITIES( BOARD* ptparam, const wxChar* group = nullptr ) :
63  PARAM_CFG( wxEmptyString, PARAM_SEVERITIES, group )
64  {
65  m_Pt_param = ptparam;
66  }
67 
68  void ReadParam( wxConfigBase* aConfig ) const override
69  {
70  if( !m_Pt_param || !aConfig )
71  return;
72 
73  BOARD* board = m_Pt_param;
75  wxString oldPath = aConfig->GetPath();
76 
77  // Read legacy settings first so that modern settings will overwrite them
78  bool flag;
79 
80  if( aConfig->Read( wxT( "RequireCourtyardDefinitions" ), &flag, false ) )
81  {
82  if( flag )
84  else
86  }
87 
88  if( aConfig->Read( wxT( "ProhibitOverlappingCourtyards" ), &flag, false ) )
89  {
90  if( flag )
92  else
94  }
95 
104 
105  DRC_ITEM drc( 0 );
106  wxString severity;
107 
108  auto mapSeverity = []( const wxString& aSeverity )
109  {
110  if( aSeverity == wxT( "warning" ) )
111  return RPT_SEVERITY_WARNING;
112  else if( aSeverity == wxT( "ignore" ) )
113  return RPT_SEVERITY_IGNORE;
114  else
115  return RPT_SEVERITY_ERROR;
116  };
117 
118  for( int i = DRCE_FIRST; i <= DRCE_LAST; ++i )
119  {
120  wxString name = drc.GetErrorText( i, false );
121  name.Replace( wxT( " " ), wxT( "_" ) );
122 
123  if( aConfig->Read( name, &severity, wxEmptyString ) )
124  bds.m_DRCSeverities[i] = mapSeverity( severity );
125  }
126 
127  aConfig->SetPath( oldPath );
128  }
129 
130  void SaveParam( wxConfigBase* aConfig ) const override
131  {
132  if( !m_Pt_param || !aConfig )
133  return;
134 
135  BOARD* board = m_Pt_param;
137  wxString oldPath = aConfig->GetPath();
138  DRC_ITEM drc( 0 );
139 
140  auto mapSeverity = []( int aSeverity )
141  {
142  if( aSeverity == RPT_SEVERITY_IGNORE )
143  return wxT( "ignore" );
144  else if( aSeverity == RPT_SEVERITY_WARNING )
145  return wxT( "warning" );
146  else
147  return wxT( "error" );
148  };
149 
150  for( int i = DRCE_FIRST; i <= DRCE_LAST; ++i )
151  {
152  wxString name = drc.GetErrorText( i, false );
153  name.Replace( wxT( " " ), wxT( "_" ) );
154 
155  aConfig->Write( name, mapSeverity( bds.m_DRCSeverities[i] ) );
156  }
157 
158  aConfig->SetPath( oldPath );
159  }
160 };
161 
162 
163 //
164 // NOTE: layer configuration info is stored in both the BOARD and BOARD_DESIGN_SETTINGS so one
165 // of the two needs to read/write the config so we don't end up with order dependency issues.
166 //
168 {
169 protected:
171 
172 public:
173  PARAM_CFG_LAYERS( BOARD* ptparam, const wxChar* group = nullptr ) :
174  PARAM_CFG( wxEmptyString, PARAM_LAYERS, group )
175  {
176  m_Pt_param = ptparam;
177  }
178 
179  void ReadParam( wxConfigBase* aConfig ) const override
180  {
181  if( !m_Pt_param || !aConfig )
182  return;
183 
184  BOARD* board = m_Pt_param;
186  LSET enabledLayers = bds.GetEnabledLayers();
187  wxString oldPath = aConfig->GetPath();
188  wxString layerKeyPrefix = LayerKeyPrefix;
189 
190  bds.SetCopperLayerCount( aConfig->Read( CopperLayerCountKey, 2 ) );
191 
192  double thickness = aConfig->ReadDouble( BoardThicknessKey, DEFAULT_BOARD_THICKNESS_MM );
193  bds.SetBoardThickness( Millimeter2iu( thickness ) );
194 
195  for( LSEQ seq = LSET::AllLayersMask().Seq(); seq; ++seq )
196  {
197  PCB_LAYER_ID layer = *seq;
198  wxString path = layerKeyPrefix + wxT( "." ) + board->GetStandardLayerName( layer );
199  wxString layerName;
200  int layerType;
201  bool layerEnabled;
202 
203  aConfig->SetPath( oldPath );
204  aConfig->SetPath( path );
205 
206  if( aConfig->Read( LayerNameKey, &layerName ) )
207  board->SetLayerName( layer, layerName );
208 
209  if( aConfig->Read( LayerTypeKey, &layerType ) )
210  board->SetLayerType( layer, (LAYER_T) layerType );
211 
212  if( aConfig->Read( LayerEnabledKey, &layerEnabled ) )
213  enabledLayers.set( layer, layerEnabled );
214  }
215 
216  board->SetEnabledLayers( enabledLayers );
217 
218  aConfig->SetPath( oldPath );
219  }
220 
221  void SaveParam( wxConfigBase* aConfig ) const override
222  {
223  if( !m_Pt_param || !aConfig )
224  return;
225 
226  BOARD* board = m_Pt_param;
228  wxString oldPath = aConfig->GetPath();
229  wxString layerKeyPrefix = LayerKeyPrefix;
230 
231  aConfig->Write( CopperLayerCountKey, board->GetCopperLayerCount() );
232  aConfig->Write( BoardThicknessKey, Iu2Millimeter( bds.GetBoardThickness() ) );
233 
234  for( LSEQ seq = LSET::AllLayersMask().Seq(); seq; ++seq )
235  {
236  PCB_LAYER_ID layer = *seq;
237  wxString path = layerKeyPrefix + wxT( "." ) + board->GetStandardLayerName( layer );
238  wxString layerName = board->GetLayerName( layer );
239  LAYER_T layerType = board->GetLayerType( layer );
240 
241  aConfig->SetPath( oldPath );
242  aConfig->SetPath( path );
243 
244  if( IsCopperLayer( layer ) )
245  {
246  aConfig->Write( LayerNameKey, layerName );
247  aConfig->Write( LayerTypeKey, (int) layerType );
248  }
249 
250  aConfig->Write( LayerEnabledKey, board->IsLayerEnabled( layer ) );
251  }
252 
253  aConfig->SetPath( oldPath );
254  }
255 };
256 
257 
259 {
260 protected:
261  std::vector<int>* m_Pt_param;
262 
263 public:
264  PARAM_CFG_TRACKWIDTHS( std::vector<int>* ptparam, const wxChar* group = nullptr ) :
265  PARAM_CFG( wxEmptyString, PARAM_TRACKWIDTHS, group )
266  {
267  m_Pt_param = ptparam;
268  }
269 
270  void ReadParam( wxConfigBase* aConfig ) const override
271  {
272  if( !m_Pt_param || !aConfig )
273  return;
274 
275  m_Pt_param->clear();
276 
277  for( int index = 1; ; ++index )
278  {
279  wxString key = TrackWidthKey;
280  double width;
281 
282  if( !aConfig->Read( key << index, &width ) )
283  break;
284 
285  m_Pt_param->push_back( Millimeter2iu( width ) );
286  }
287  }
288 
289  void SaveParam( wxConfigBase* aConfig ) const override
290  {
291  if( !m_Pt_param || !aConfig )
292  return;
293 
294  for( size_t index = 1; index <= m_Pt_param->size(); ++index )
295  {
296  wxString key = TrackWidthKey;
297  aConfig->Write( key << index, Iu2Millimeter( m_Pt_param->at( index - 1 ) ) );
298  }
299  }
300 };
301 
302 
304 {
305 protected:
306  std::vector<VIA_DIMENSION>* m_Pt_param;
307 
308 public:
309  PARAM_CFG_VIADIMENSIONS( std::vector<VIA_DIMENSION>* ptparam, const wxChar* group = nullptr ) :
310  PARAM_CFG( wxEmptyString, PARAM_VIADIMENSIONS, group )
311  {
312  m_Pt_param = ptparam;
313  }
314 
315  void ReadParam( wxConfigBase* aConfig ) const override
316  {
317  if( !m_Pt_param || !aConfig )
318  return;
319 
320  m_Pt_param->clear();
321 
322  for( int index = 1; ; ++index )
323  {
324  double diameter = 0.0, drill = 0.0;
325 
326  wxString key = ViaDiameterKey;
327 
328  if( !aConfig->Read( key << index, &diameter ) )
329  break;
330 
331  key = ViaDrillKey;
332  drill = aConfig->ReadDouble( key << index, 0.0 );
333 
334  m_Pt_param->emplace_back( VIA_DIMENSION( Millimeter2iu( diameter ),
335  Millimeter2iu( drill ) ) );
336  }
337  }
338 
339  void SaveParam( wxConfigBase* aConfig ) const override
340  {
341  if( !m_Pt_param || !aConfig )
342  return;
343 
344  for( size_t index = 1; index <= m_Pt_param->size(); ++index )
345  {
346  wxString key = ViaDiameterKey;
347  aConfig->Write( key << index, Iu2Millimeter( m_Pt_param->at( index - 1 ).m_Diameter ) );
348  key = ViaDrillKey;
349  aConfig->Write( key << index, Iu2Millimeter( m_Pt_param->at( index - 1 ).m_Drill ) );
350  }
351  }
352 };
353 
354 
356 {
357 protected:
358  std::vector<DIFF_PAIR_DIMENSION>* m_Pt_param;
359 
360 public:
361  PARAM_CFG_DIFFPAIRDIMENSIONS( std::vector<DIFF_PAIR_DIMENSION>* ptparam,
362  const wxChar* group = nullptr ) :
363  PARAM_CFG( wxEmptyString, PARAM_DIFFPAIRDIMENSIONS, group )
364  {
365  m_Pt_param = ptparam;
366  }
367 
368  void ReadParam( wxConfigBase* aConfig ) const override
369  {
370  if( !m_Pt_param || !aConfig )
371  return;
372 
373  m_Pt_param->clear();
374 
375  for( int index = 1; ; ++index )
376  {
377  double width, gap, viagap;
378 
379  wxString key = dPairWidthKey;
380 
381  if( !aConfig->Read( key << index, &width ) )
382  break;
383 
384  key = dPairGapKey;
385  gap = aConfig->ReadDouble( key << index, 0.0 );
386 
387  key = dPairViaGapKey;
388  viagap = aConfig->ReadDouble( key << index, 0.0 );
389 
390  m_Pt_param->emplace_back( DIFF_PAIR_DIMENSION( Millimeter2iu( width ),
391  Millimeter2iu( gap ),
392  Millimeter2iu( viagap ) ) );
393  }
394  }
395 
396  void SaveParam( wxConfigBase* aConfig ) const override
397  {
398  if( !m_Pt_param || !aConfig )
399  return;
400 
401  for( size_t index = 1; index <= m_Pt_param->size(); ++index )
402  {
403  wxString key = dPairWidthKey;
404  aConfig->Write( key << index, Iu2Millimeter( m_Pt_param->at( index - 1 ).m_Width ) );
405  key = dPairGapKey;
406  aConfig->Write( key << index, Iu2Millimeter( m_Pt_param->at( index - 1 ).m_Gap ) );
407  key = dPairViaGapKey;
408  aConfig->Write( key << index, Iu2Millimeter( m_Pt_param->at( index - 1 ).m_ViaGap ) );
409  }
410  }
411 };
412 
413 
415 {
416 protected:
418 
419 public:
420  PARAM_CFG_NETCLASSES( const wxChar* ident, NETCLASSES* ptparam,
421  const wxChar* group = nullptr ) :
422  PARAM_CFG( ident, PARAM_NETCLASSES, group )
423  {
424  m_Pt_param = ptparam;
425  }
426 
427  void ReadParam( wxConfigBase* aConfig ) const override
428  {
429  if( !m_Pt_param || !aConfig )
430  return;
431 
432  wxString oldPath = aConfig->GetPath();
433 
434  m_Pt_param->Clear();
435 
436  for( int index = 0; ; ++index )
437  {
438  wxString path = "";
439  NETCLASSPTR netclass;
440  wxString netclassName;
441 
442  if( index == 0 )
443  path = "Default";
444  else
445  path << index;
446 
447  aConfig->SetPath( oldPath );
448  aConfig->SetPath( m_Ident );
449  aConfig->SetPath( path );
450 
451  if( !aConfig->Read( NetclassNameKey, &netclassName ) )
452  break;
453 
454  if( index == 0 )
455  netclass = m_Pt_param->GetDefault();
456  else
457  netclass = std::make_shared<NETCLASS>( netclassName );
458 
459 #define READ_MM( aKey, aDefault ) Millimeter2iu( aConfig->ReadDouble( aKey, aDefault ) )
460  netclass->SetClearance( READ_MM( ClearanceKey, netclass->GetClearance() ) );
461  netclass->SetTrackWidth( READ_MM( TrackWidthKey, netclass->GetTrackWidth() ) );
462  netclass->SetViaDiameter( READ_MM( ViaDiameterKey, netclass->GetViaDiameter() ) );
463  netclass->SetViaDrill( READ_MM( ViaDrillKey, netclass->GetViaDrill() ) );
464  netclass->SetuViaDiameter( READ_MM( uViaDiameterKey, netclass->GetuViaDiameter() ) );
465  netclass->SetuViaDrill( READ_MM( uViaDrillKey, netclass->GetuViaDrill() ) );
466  netclass->SetDiffPairWidth( READ_MM( dPairWidthKey, netclass->GetDiffPairWidth() ) );
467  netclass->SetDiffPairGap( READ_MM( dPairGapKey, netclass->GetDiffPairGap() ) );
468  netclass->SetDiffPairViaGap( READ_MM( dPairViaGapKey, netclass->GetDiffPairViaGap() ) );
469 
470  if( index > 0 )
471  m_Pt_param->Add( netclass );
472  }
473 
474  aConfig->SetPath( oldPath );
475  }
476 
477  void SaveParam( wxConfigBase* aConfig ) const override
478  {
479  if( !m_Pt_param || !aConfig )
480  return;
481 
482  wxString oldPath = aConfig->GetPath();
484 
485  for( unsigned index = 0; index <= m_Pt_param->GetCount(); ++index )
486  {
487  wxString path = "";
488  NETCLASSPTR netclass;
489 
490  if( index == 0 )
491  path = "Default";
492  else
493  path << index;
494 
495  aConfig->SetPath( oldPath );
496  aConfig->SetPath( m_Ident );
497  aConfig->SetPath( path );
498 
499  if( index == 0 )
500  {
501  netclass = m_Pt_param->GetDefault();
502  }
503  else
504  {
505  netclass = nc->second;
506  ++nc;
507  }
508 
509  aConfig->Write( NetclassNameKey, netclass->GetName() );
510 
511 #define WRITE_MM( aKey, aValue ) aConfig->Write( aKey, Iu2Millimeter( aValue ) )
512  WRITE_MM( ClearanceKey, netclass->GetClearance() );
513  WRITE_MM( TrackWidthKey, netclass->GetTrackWidth() );
514  WRITE_MM( ViaDiameterKey, netclass->GetViaDiameter() );
515  WRITE_MM( ViaDrillKey, netclass->GetViaDrill() );
516  WRITE_MM( uViaDiameterKey, netclass->GetuViaDiameter() );
517  WRITE_MM( uViaDrillKey, netclass->GetuViaDrill() );
518  WRITE_MM( dPairWidthKey, netclass->GetDiffPairWidth() );
519  WRITE_MM( dPairGapKey, netclass->GetDiffPairGap() );
520  WRITE_MM( dPairViaGapKey, netclass->GetDiffPairViaGap() );
521  }
522 
523  aConfig->SetPath( oldPath );
524  }
525 };
526 
527 
529  m_Pad_Master( NULL )
530 {
531  m_HasStackup = false; // no stackup defined by default
532 
533  LSET all_set = LSET().set();
534  m_enabledLayers = all_set; // All layers enabled at first.
535  // SetCopperLayerCount() will adjust this.
536  SetVisibleLayers( all_set );
537 
538  // set all but hidden text as visible.
540 
541  SetCopperLayerCount( 2 ); // Default design is a double sided board
543 
544  // if true, when creating a new track starting on an existing track, use this track width
545  m_UseConnectedTrackWidth = false;
546 
547  m_BlindBuriedViaAllowed = false;
548  m_MicroViasAllowed = false;
549 
550  // First is always the reference designator
551  m_DefaultFPTextItems.emplace_back( wxT( "REF**" ), true, F_SilkS );
552  // Second is always the value
553  m_DefaultFPTextItems.emplace_back( wxT( "" ), true, F_Fab );
554  // Any following ones are freebies
555  m_DefaultFPTextItems.emplace_back( wxT( "${REF}" ), true, F_Fab );
556 
558  m_TextSize[ LAYER_CLASS_SILK ] = wxSize( Millimeter2iu( DEFAULT_SILK_TEXT_SIZE ),
559  Millimeter2iu( DEFAULT_SILK_TEXT_SIZE ) );
561  m_TextItalic[ LAYER_CLASS_SILK ] = false;
562  m_TextUpright[ LAYER_CLASS_SILK ] = false;
563 
565  m_TextSize[ LAYER_CLASS_COPPER ] = wxSize( Millimeter2iu( DEFAULT_COPPER_TEXT_SIZE ),
566  Millimeter2iu( DEFAULT_COPPER_TEXT_SIZE ) );
568  m_TextItalic[ LAYER_CLASS_COPPER ] = false;
570 
571  // Edges & Courtyards; text properties aren't used but better to have them holding
572  // reasonable values than not.
574  m_TextSize[ LAYER_CLASS_EDGES ] = wxSize( Millimeter2iu( DEFAULT_TEXT_SIZE ),
575  Millimeter2iu( DEFAULT_TEXT_SIZE ) );
577  m_TextItalic[ LAYER_CLASS_EDGES ] = false;
578  m_TextUpright[ LAYER_CLASS_EDGES ] = false;
579 
581  m_TextSize[ LAYER_CLASS_COURTYARD ] = wxSize( Millimeter2iu( DEFAULT_TEXT_SIZE ),
582  Millimeter2iu( DEFAULT_TEXT_SIZE ) );
586 
587  m_LineThickness[ LAYER_CLASS_FAB ] = Millimeter2iu( DEFAULT_LINE_WIDTH );
588  m_TextSize[ LAYER_CLASS_FAB ] = wxSize( Millimeter2iu( DEFAULT_TEXT_SIZE ),
589  Millimeter2iu( DEFAULT_TEXT_SIZE ) );
590  m_TextThickness[ LAYER_CLASS_FAB ] = Millimeter2iu( DEFAULT_TEXT_WIDTH );
591  m_TextItalic[ LAYER_CLASS_FAB ] = false;
592  m_TextUpright[ LAYER_CLASS_FAB ] = false;
593 
595  m_TextSize[ LAYER_CLASS_OTHERS ] = wxSize( Millimeter2iu( DEFAULT_TEXT_SIZE ),
596  Millimeter2iu( DEFAULT_TEXT_SIZE ) );
598  m_TextItalic[ LAYER_CLASS_OTHERS ] = false;
600 
601  m_DimensionUnits = 0; // Inches
602  m_DimensionPrecision = 1; // 0.001mm / 0.1 mil
603 
604  m_useCustomTrackVia = false;
605  m_customTrackWidth = Millimeter2iu( DEFAULT_CUSTOMTRACKWIDTH );
608 
609  m_useCustomDiffPair = false;
611  m_customDiffPair.m_Gap = Millimeter2iu( DEFAULT_CUSTOMDPAIRGAP );
613 
614  m_MinClearance = Millimeter2iu( DEFAULT_MINCLEARANCE );
615  m_TrackMinWidth = Millimeter2iu( DEFAULT_TRACKMINWIDTH );
617  m_ViasMinSize = Millimeter2iu( DEFAULT_VIASMINSIZE );
618  m_MinThroughDrill = Millimeter2iu( DEFAULT_MINTHROUGHDRILL );
619  m_MicroViasMinSize = Millimeter2iu( DEFAULT_MICROVIASMINSIZE );
622  m_HoleToHoleMin = Millimeter2iu( DEFAULT_HOLETOHOLEMIN );
623 
624  for( int errorCode = DRCE_FIRST; errorCode <= DRCE_LAST; ++errorCode )
625  m_DRCSeverities[ errorCode ] = RPT_SEVERITY_ERROR;
626 
630 
633 
637 
638  m_MaxError = ARC_HIGH_DEF;
639  m_ZoneUseNoOutlineInFill = false; // Use compatibility mode by default
640 
641  // Global mask margins:
644  m_SolderPasteMargin = 0; // Solder paste margin absolute value
645  m_SolderPasteMarginRatio = 0.0; // Solder paste margin as a ratio of pad size
646  // The final margin is the sum of these 2 values
647  // Usually < 0 because the mask is smaller than pad
648  // Layer thickness for 3D viewer
649  m_boardThickness = Millimeter2iu( DEFAULT_BOARD_THICKNESS_MM );
650 
651  m_viaSizeIndex = 0;
652  m_trackWidthIndex = 0;
653  m_diffPairIndex = 0;
654 }
655 
656 // Add parameters to save in project config.
657 // values are saved in mm
658 void BOARD_DESIGN_SETTINGS::AppendConfigs( BOARD* aBoard, std::vector<PARAM_CFG*>* aResult )
659 {
660  aResult->push_back( new PARAM_CFG_LAYERS( aBoard ) );
661 
662  aResult->push_back( new PARAM_CFG_BOOL( wxT( "AllowMicroVias" ),
663  &m_MicroViasAllowed, false ) );
664 
665  aResult->push_back( new PARAM_CFG_BOOL( wxT( "AllowBlindVias" ),
666  &m_BlindBuriedViaAllowed, false ) );
667 
668  aResult->push_back( new PARAM_CFG_INT_WITH_SCALE( wxT( "MinClearance" ),
670  Millimeter2iu( DEFAULT_MINCLEARANCE ), Millimeter2iu( 0.01 ), Millimeter2iu( 25.0 ),
671  nullptr, MM_PER_IU ) );
672 
673  aResult->push_back( new PARAM_CFG_INT_WITH_SCALE( wxT( "MinTrackWidth" ),
675  Millimeter2iu( DEFAULT_TRACKMINWIDTH ), Millimeter2iu( 0.01 ), Millimeter2iu( 25.0 ),
676  nullptr, MM_PER_IU ) );
677 
678  aResult->push_back( new PARAM_CFG_INT_WITH_SCALE( wxT( "MinViaAnnulus" ),
680  Millimeter2iu( DEFAULT_VIASMINSIZE ), Millimeter2iu( 0.01 ), Millimeter2iu( 25.0 ),
681  nullptr, MM_PER_IU ) );
682 
683  aResult->push_back( new PARAM_CFG_INT_WITH_SCALE( wxT( "MinViaDiameter" ),
684  &m_ViasMinSize,
685  Millimeter2iu( DEFAULT_VIASMINSIZE ), Millimeter2iu( 0.01 ), Millimeter2iu( 25.0 ),
686  nullptr, MM_PER_IU ) );
687 
688  aResult->push_back( new PARAM_CFG_INT_WITH_SCALE( wxT( "MinThroughDrill" ),
690  Millimeter2iu( DEFAULT_MINTHROUGHDRILL ), Millimeter2iu( 0.01 ), Millimeter2iu( 25.0 ),
691  nullptr, MM_PER_IU, wxT( "MinViaDrill" ) ) );
692 
693  aResult->push_back( new PARAM_CFG_INT_WITH_SCALE( wxT( "MinMicroViaDiameter" ),
695  Millimeter2iu( DEFAULT_MICROVIASMINSIZE ), Millimeter2iu( 0.01 ), Millimeter2iu( 10.0 ),
696  nullptr, MM_PER_IU ) );
697 
698  aResult->push_back( new PARAM_CFG_INT_WITH_SCALE( wxT( "MinMicroViaDrill" ),
700  Millimeter2iu( DEFAULT_MICROVIASMINDRILL ), Millimeter2iu( 0.01 ), Millimeter2iu( 10.0 ),
701  nullptr, MM_PER_IU ) );
702 
703  aResult->push_back( new PARAM_CFG_INT_WITH_SCALE( wxT( "MinHoleToHole" ),
705  Millimeter2iu( DEFAULT_HOLETOHOLEMIN ), Millimeter2iu( 0.0 ), Millimeter2iu( 10.0 ),
706  nullptr, MM_PER_IU ) );
707 
708  aResult->push_back( new PARAM_CFG_SEVERITIES( aBoard ) );
709 
710  // Note: a clearance of -0.01 is a flag indicating we should use the legacy (pre-6.0) method
711  // based on the edge cut thicknesses.
712  aResult->push_back( new PARAM_CFG_INT_WITH_SCALE( wxT( "CopperEdgeClearance" ),
714  Millimeter2iu( LEGACY_COPPEREDGECLEARANCE ), Millimeter2iu( -0.01 ), Millimeter2iu( 25.0 ),
715  nullptr, MM_PER_IU ) );
716 
717  aResult->push_back( new PARAM_CFG_TRACKWIDTHS( &m_TrackWidthList ) );
718  aResult->push_back( new PARAM_CFG_VIADIMENSIONS( &m_ViasDimensionsList ) );
719  aResult->push_back( new PARAM_CFG_DIFFPAIRDIMENSIONS( &m_DiffPairDimensionsList ) );
720 
721  aResult->push_back( new PARAM_CFG_NETCLASSES( wxT( "Netclasses" ), &m_NetClasses ) );
722 
723  aResult->push_back( new PARAM_CFG_INT_WITH_SCALE( wxT( "SilkLineWidth" ),
725  Millimeter2iu( DEFAULT_SILK_LINE_WIDTH ), Millimeter2iu( 0.01 ), Millimeter2iu( 5.0 ),
726  nullptr, MM_PER_IU, wxT( "ModuleOutlineThickness" ) ) );
727 
728  aResult->push_back( new PARAM_CFG_INT_WITH_SCALE( wxT( "SilkTextSizeV" ),
731  nullptr, MM_PER_IU, wxT( "ModuleTextSizeV" ) ) );
732 
733  aResult->push_back( new PARAM_CFG_INT_WITH_SCALE( wxT( "SilkTextSizeH" ),
736  nullptr, MM_PER_IU, wxT( "ModuleTextSizeH" ) ) );
737 
738  aResult->push_back( new PARAM_CFG_INT_WITH_SCALE( wxT( "SilkTextSizeThickness" ),
740  Millimeter2iu( DEFAULT_SILK_TEXT_WIDTH ), 1, TEXTS_MAX_WIDTH,
741  nullptr, MM_PER_IU, wxT( "ModuleTextSizeThickness" ) ) );
742 
743  aResult->push_back( new PARAM_CFG_BOOL( wxT( "SilkTextItalic" ),
744  &m_TextItalic[ LAYER_CLASS_SILK ], false ) );
745 
746  aResult->push_back( new PARAM_CFG_BOOL( wxT( "SilkTextUpright" ),
747  &m_TextUpright[ LAYER_CLASS_SILK ], true ) );
748 
749  aResult->push_back( new PARAM_CFG_INT_WITH_SCALE( wxT( "CopperLineWidth" ),
751  Millimeter2iu( DEFAULT_SILK_LINE_WIDTH ), Millimeter2iu( 0.01 ), Millimeter2iu( 5.0 ),
752  nullptr, MM_PER_IU, wxT( "DrawSegmentWidth" ) ) );
753 
754  aResult->push_back( new PARAM_CFG_INT_WITH_SCALE( wxT( "CopperTextSizeV" ),
757  nullptr, MM_PER_IU, wxT( "PcbTextSizeV" ) ) );
758 
759  aResult->push_back( new PARAM_CFG_INT_WITH_SCALE( wxT( "CopperTextSizeH" ),
762  nullptr, MM_PER_IU, wxT( "PcbTextSizeH" ) ) );
763 
764  aResult->push_back( new PARAM_CFG_INT_WITH_SCALE( wxT( "CopperTextThickness" ),
766  Millimeter2iu( DEFAULT_COPPER_TEXT_WIDTH ), Millimeter2iu( 0.01 ), Millimeter2iu( 5.0 ),
767  nullptr, MM_PER_IU, wxT( "PcbTextThickness" ) ) );
768 
769  aResult->push_back( new PARAM_CFG_BOOL( wxT( "CopperTextItalic" ),
770  &m_TextItalic[ LAYER_CLASS_COPPER ], false ) );
771 
772  aResult->push_back( new PARAM_CFG_BOOL( wxT( "CopperTextUpright" ),
773  &m_TextUpright[ LAYER_CLASS_COPPER ], true ) );
774 
775  aResult->push_back( new PARAM_CFG_INT_WITH_SCALE( wxT( "EdgeCutLineWidth" ),
777  Millimeter2iu( DEFAULT_SILK_LINE_WIDTH ), Millimeter2iu( 0.01 ), Millimeter2iu( 5.0 ),
778  nullptr, MM_PER_IU, wxT( "BoardOutlineThickness" ) ) );
779 
780  aResult->push_back( new PARAM_CFG_INT_WITH_SCALE( wxT( "CourtyardLineWidth" ),
782  Millimeter2iu( DEFAULT_SILK_LINE_WIDTH ), Millimeter2iu( 0.01 ), Millimeter2iu( 5.0 ),
783  nullptr, MM_PER_IU ) );
784 
785  aResult->push_back( new PARAM_CFG_INT_WITH_SCALE( wxT( "FabLineWidth" ),
787  Millimeter2iu( DEFAULT_LINE_WIDTH ), Millimeter2iu( 0.01 ), Millimeter2iu( 5.0 ),
788  nullptr, MM_PER_IU ) );
789 
790  aResult->push_back( new PARAM_CFG_INT_WITH_SCALE( wxT( "FabTextSizeV" ),
793  nullptr, MM_PER_IU ) );
794 
795  aResult->push_back( new PARAM_CFG_INT_WITH_SCALE( wxT( "FabTextSizeH" ),
798  nullptr, MM_PER_IU ) );
799 
800  aResult->push_back( new PARAM_CFG_INT_WITH_SCALE( wxT( "FabTextSizeThickness" ),
802  Millimeter2iu( DEFAULT_TEXT_WIDTH ), 1, TEXTS_MAX_WIDTH,
803  nullptr, MM_PER_IU ) );
804 
805  aResult->push_back( new PARAM_CFG_BOOL( wxT( "FabTextItalic" ),
806  &m_TextItalic[ LAYER_CLASS_FAB ], false ) );
807 
808  aResult->push_back( new PARAM_CFG_BOOL( wxT( "FabTextUpright" ),
809  &m_TextUpright[ LAYER_CLASS_FAB ], true ) );
810 
811  aResult->push_back( new PARAM_CFG_INT_WITH_SCALE( wxT( "OthersLineWidth" ),
813  Millimeter2iu( DEFAULT_SILK_LINE_WIDTH ), Millimeter2iu( 0.01 ), Millimeter2iu( 5.0 ),
814  nullptr, MM_PER_IU, wxT( "ModuleOutlineThickness" ) ) );
815 
816  aResult->push_back( new PARAM_CFG_INT_WITH_SCALE( wxT( "OthersTextSizeV" ),
819  nullptr, MM_PER_IU ) );
820 
821  aResult->push_back( new PARAM_CFG_INT_WITH_SCALE( wxT( "OthersTextSizeH" ),
824  nullptr, MM_PER_IU ) );
825 
826  aResult->push_back( new PARAM_CFG_INT_WITH_SCALE( wxT( "OthersTextSizeThickness" ),
828  Millimeter2iu( DEFAULT_TEXT_WIDTH ), 1, TEXTS_MAX_WIDTH,
829  nullptr, MM_PER_IU ) );
830 
831  aResult->push_back( new PARAM_CFG_BOOL( wxT( "OthersTextItalic" ),
832  &m_TextItalic[ LAYER_CLASS_OTHERS ], false ) );
833 
834  aResult->push_back( new PARAM_CFG_BOOL( wxT( "OthersTextUpright" ),
835  &m_TextUpright[ LAYER_CLASS_OTHERS ], true ) );
836 
837  aResult->push_back( new PARAM_CFG_INT( wxT( "DimensionUnits" ),
838  &m_DimensionUnits, 0, 0, 2 ) );
839  aResult->push_back( new PARAM_CFG_INT( wxT( "DimensionPrecision" ),
840  &m_DimensionPrecision, 1, 0, 2 ) );
841 
842  aResult->push_back( new PARAM_CFG_INT_WITH_SCALE( wxT( "SolderMaskClearance" ),
844  Millimeter2iu( DEFAULT_SOLDERMASK_CLEARANCE ), Millimeter2iu( -1.0 ), Millimeter2iu( 1.0 ),
845  nullptr, MM_PER_IU ) );
846 
847  aResult->push_back( new PARAM_CFG_INT_WITH_SCALE( wxT( "SolderMaskMinWidth" ),
849  Millimeter2iu( DEFAULT_SOLDERMASK_MIN_WIDTH ), 0, Millimeter2iu( 1.0 ),
850  nullptr, MM_PER_IU ) );
851 
852  aResult->push_back( new PARAM_CFG_INT_WITH_SCALE( wxT( "SolderPasteClearance" ),
854  Millimeter2iu( DEFAULT_SOLDERPASTE_CLEARANCE ), Millimeter2iu( -1.0 ), Millimeter2iu( 1.0 ),
855  nullptr, MM_PER_IU ) );
856 
857  aResult->push_back( new PARAM_CFG_DOUBLE( wxT( "SolderPasteRatio" ),
859  DEFAULT_SOLDERPASTE_RATIO, -0.5, 1.0 ) );
860 }
861 
862 
863 int BOARD_DESIGN_SETTINGS::GetSeverity( int aDRCErrorCode )
864 {
865  return m_DRCSeverities[ aDRCErrorCode ];
866 }
867 
868 
869 bool BOARD_DESIGN_SETTINGS::Ignore( int aDRCErrorCode )
870 {
871  return m_DRCSeverities[ aDRCErrorCode ] == RPT_SEVERITY_IGNORE;
872 }
873 
874 
875 bool BOARD_DESIGN_SETTINGS::SetCurrentNetClass( const wxString& aNetClassName )
876 {
877  NETCLASSPTR netClass = m_NetClasses.Find( aNetClassName );
878  bool lists_sizes_modified = false;
879 
880  // if not found (should not happen) use the default
881  if( !netClass )
882  netClass = m_NetClasses.GetDefault();
883 
884  m_currentNetClassName = netClass->GetName();
885 
886  // Initialize others values:
887  if( m_TrackWidthList.size() == 0 )
888  {
889  lists_sizes_modified = true;
890  m_TrackWidthList.push_back( 0 );
891  }
892 
893  if( m_ViasDimensionsList.size() == 0 )
894  {
895  lists_sizes_modified = true;
896  m_ViasDimensionsList.emplace_back( VIA_DIMENSION() );
897  }
898 
899  if( m_DiffPairDimensionsList.size() == 0 )
900  {
901  lists_sizes_modified = true;
903  }
904 
905  /* note the m_ViasDimensionsList[0] and m_TrackWidthList[0] values
906  * are always the Netclass values
907  */
908  if( m_TrackWidthList[0] != netClass->GetTrackWidth() )
909  {
910  lists_sizes_modified = true;
911  m_TrackWidthList[0] = netClass->GetTrackWidth();
912  }
913 
914  if( m_ViasDimensionsList[0].m_Diameter != netClass->GetViaDiameter() )
915  {
916  lists_sizes_modified = true;
917  m_ViasDimensionsList[0].m_Diameter = netClass->GetViaDiameter();
918  }
919 
920  if( m_ViasDimensionsList[0].m_Drill != netClass->GetViaDrill() )
921  {
922  lists_sizes_modified = true;
923  m_ViasDimensionsList[0].m_Drill = netClass->GetViaDrill();
924  }
925 
926  if( m_DiffPairDimensionsList[0].m_Width != netClass->GetDiffPairWidth() )
927  {
928  lists_sizes_modified = true;
929  m_DiffPairDimensionsList[0].m_Width = netClass->GetDiffPairWidth();
930  }
931 
932  if( m_DiffPairDimensionsList[0].m_Gap != netClass->GetDiffPairGap() )
933  {
934  lists_sizes_modified = true;
935  m_DiffPairDimensionsList[0].m_Gap = netClass->GetDiffPairGap();
936  }
937 
938  if( m_DiffPairDimensionsList[0].m_ViaGap != netClass->GetDiffPairViaGap() )
939  {
940  lists_sizes_modified = true;
941  m_DiffPairDimensionsList[0].m_ViaGap = netClass->GetDiffPairViaGap();
942  }
943 
944  if( GetViaSizeIndex() >= m_ViasDimensionsList.size() )
946 
947  if( GetTrackWidthIndex() >= m_TrackWidthList.size() )
949 
952 
953  return lists_sizes_modified;
954 }
955 
956 
958 {
959  int clearance = GetDefault()->GetClearance();
960 
961  for( const std::pair<const wxString, NETCLASSPTR>& netclass : m_NetClasses.NetClasses() )
962  clearance = std::max( clearance, netclass.second->GetClearance() );
963 
964  for( const DRC_RULE* rule : m_DRCRules )
965  clearance = std::max( clearance, rule->m_Clearance.Min );
966 
967  return clearance;
968 }
969 
970 
972 {
973  int clearance = GetDefault()->GetClearance();
974 
975  for( const std::pair<const wxString, NETCLASSPTR>& netclass : m_NetClasses.NetClasses() )
976  clearance = std::min( clearance, netclass.second->GetClearance() );
977 
978  return clearance;
979 }
980 
981 
983 {
984  NETCLASSPTR netclass = m_NetClasses.Find( m_currentNetClassName );
985 
986  return netclass->GetuViaDiameter();
987 }
988 
989 
991 {
992  NETCLASSPTR netclass = m_NetClasses.Find( m_currentNetClassName );
993 
994  return netclass->GetuViaDrill();
995 }
996 
997 
999 {
1000  m_viaSizeIndex = std::min( aIndex, (unsigned) m_ViasDimensionsList.size() );
1001  m_useCustomTrackVia = false;
1002 }
1003 
1004 
1006 {
1007  int drill;
1008 
1009  if( m_useCustomTrackVia )
1010  drill = m_customViaSize.m_Drill;
1011  else
1012  drill = m_ViasDimensionsList[m_viaSizeIndex].m_Drill;
1013 
1014  return drill > 0 ? drill : -1;
1015 }
1016 
1017 
1019 {
1020  m_trackWidthIndex = std::min( aIndex, (unsigned) m_TrackWidthList.size() );
1021  m_useCustomTrackVia = false;
1022 }
1023 
1024 
1026 {
1027  m_diffPairIndex = std::min( aIndex, (unsigned) 8 );
1028  m_useCustomDiffPair = false;
1029 }
1030 
1031 
1033 {
1034  m_HoleToHoleMin = aDistance;
1035 }
1036 
1037 
1039 {
1040  m_CopperEdgeClearance = aDistance;
1041 }
1042 
1043 
1045 {
1046  SetVisibleLayers( LSET().set() );
1047  m_visibleElements = -1;
1048 }
1049 
1050 
1052 {
1053  m_visibleLayers.set( aLayer, aNewState && IsLayerEnabled( aLayer ));
1054 }
1055 
1056 
1057 void BOARD_DESIGN_SETTINGS::SetElementVisibility( GAL_LAYER_ID aElementCategory, bool aNewState )
1058 {
1059  if( aNewState )
1060  m_visibleElements |= 1 << GAL_LAYER_INDEX( aElementCategory );
1061  else
1062  m_visibleElements &= ~( 1 << GAL_LAYER_INDEX( aElementCategory ) );
1063 }
1064 
1065 
1067 {
1068  m_copperLayerCount = aNewLayerCount;
1069 
1070  // Update only enabled copper layers mask
1071  m_enabledLayers &= ~LSET::AllCuMask();
1072  m_enabledLayers |= LSET::AllCuMask( aNewLayerCount );
1073 }
1074 
1075 
1077 {
1078  // Back and front layers are always enabled.
1079  aMask.set( B_Cu ).set( F_Cu );
1080 
1081  m_enabledLayers = aMask;
1082 
1083  // A disabled layer cannot be visible
1084  m_visibleLayers &= aMask;
1085 
1086  // update m_CopperLayerCount to ensure its consistency with m_EnabledLayers
1087  m_copperLayerCount = ( aMask & LSET::AllCuMask() ).count();
1088 }
1089 
1090 
1091 // Return the layer class index { silk, copper, edges & courtyards, fab, others } of the
1092 // given layer.
1094 {
1095  if( aLayer == F_SilkS || aLayer == B_SilkS )
1096  return LAYER_CLASS_SILK;
1097  else if( IsCopperLayer( aLayer ) )
1098  return LAYER_CLASS_COPPER;
1099  else if( aLayer == Edge_Cuts )
1100  return LAYER_CLASS_EDGES;
1101  else if( aLayer == F_CrtYd || aLayer == B_CrtYd )
1102  return LAYER_CLASS_COURTYARD;
1103  else if( aLayer == F_Fab || aLayer == B_Fab )
1104  return LAYER_CLASS_FAB;
1105  else
1106  return LAYER_CLASS_OTHERS;
1107 }
1108 
1109 
1111 {
1112  return m_LineThickness[ GetLayerClass( aLayer ) ];
1113 }
1114 
1115 
1117 {
1118  return m_TextSize[ GetLayerClass( aLayer ) ];
1119 }
1120 
1121 
1123 {
1124  return m_TextThickness[ GetLayerClass( aLayer ) ];
1125 }
1126 
1127 
1129 {
1130  return m_TextItalic[ GetLayerClass( aLayer ) ];
1131 }
1132 
1133 
1135 {
1136  return m_TextUpright[ GetLayerClass( aLayer ) ];
1137 }
1138 
1139 
int GetCurrentMicroViaSize()
Function GetCurrentMicroViaSize.
static LSET AllCuMask(int aCuLayerCount=MAX_CU_LAYERS)
Function AllCuMask returns a mask holding the requested number of Cu PCB_LAYER_IDs.
Definition: lset.cpp:712
#define DEFAULT_EDGE_WIDTH
#define DEFAULT_SILK_TEXT_WIDTH
int m_SolderMaskMargin
Solder mask margin.
void SetCopperLayerCount(int aNewLayerCount)
Function SetCopperLayerCount do what its name says...
#define DEFAULT_TRACKMINWIDTH
Struct VIA_DIMENSION is a small helper container to handle a stock of specific vias each with unique ...
void ReadParam(wxConfigBase *aConfig) const override
Function ReadParam reads the value of the parameter stored in aConfig.
void SetEnabledLayers(LSET aMask)
Function SetEnabledLayers changes the bit-mask of enabled layers.
#define TrackWidthKey
#define LayerTypeKey
void SetCopperEdgeClearance(int aDistance)
Function SetCopperEdgeClearance.
#define DEFAULT_COURTYARD_WIDTH
#define uViaDrillKey
#define WRITE_MM(aKey, aValue)
void SetTrackWidthIndex(unsigned aIndex)
Function SetTrackWidthIndex sets the current track width list index to aIndex.
wxString m_currentNetClassName
Current net class name used to display netclass info.
std::vector< TEXT_ITEM_INFO > m_DefaultFPTextItems
#define NetclassNameKey
#define DEFAULT_SOLDERPASTE_RATIO
NETCLASSPTR Find(const wxString &aName) const
Function Find searches this container for a NETCLASS given by aName.
Definition: netclass.cpp:141
const wxString GetLayerName(PCB_LAYER_ID aLayer) const
Function GetLayerName returns the name of a layer.
std::vector< VIA_DIMENSION > * m_Pt_param
Pointer to the parameter value.
int GetCurrentViaDrill() const
Function GetCurrentViaDrill.
int m_SolderPasteMargin
Solder paste margin absolute value.
#define DEFAULT_VIASMINSIZE
#define TEXTS_MAX_WIDTH
Maximum text width in internal units (10 inches)
Definition: pcbnew.h:40
void ReadParam(wxConfigBase *aConfig) const override
Function ReadParam reads the value of the parameter stored in aConfig.
std::vector< int > m_TrackWidthList
int GetSmallestClearanceValue()
Function GetSmallestClearanceValue.
int GetBiggestClearanceValue()
Function GetBiggestClearanceValue.
bool IsLayerEnabled(PCB_LAYER_ID aLayerId) const
Function IsLayerEnabled tests whether a given layer is enabled.
int GetCurrentMicroViaDrill()
Function GetCurrentMicroViaDrill.
BOARD * m_Pt_param
Pointer to the parameter value.
std::vector< DIFF_PAIR_DIMENSION > m_DiffPairDimensionsList
footprint not found for netlist item
Definition: drc.h:103
std::map< int, int > m_DRCSeverities
NETCLASS_MAP & NetClasses()
Provide public access to m_NetClasses so it gets swigged.
Definition: netclass.h:311
wxString m_Ident
Keyword in config data.
void SetLayerVisibility(PCB_LAYER_ID aLayerId, bool aNewState)
Function SetLayerVisibility changes the visibility of a given layer.
more than one footprints found for netlist item
Definition: drc.h:104
bool Ignore(int aDRCErrorCode)
returns true if the DRC error code's severity is SEVERITY_IGNORE
Configuration parameter - Double Precision Class.
#define LEGACY_COPPEREDGECLEARANCE
#define DEFAULT_BOARD_THICKNESS_MM
void SaveParam(wxConfigBase *aConfig) const override
Function SaveParam saves the value of the parameter stored in aConfig.
GAL_LAYER_ID
GAL layers are "virtual" layers, i.e.
#define DEFAULT_LINE_WIDTH
#define DEFAULT_COPPER_LINE_WIDTH
#define DEFAULT_HOLETOHOLEMIN
BOARD_DESIGN_SETTINGS & GetDesignSettings() const
Function GetDesignSettings.
Definition: class_board.h:542
#define CopperLayerCountKey
void ReadParam(wxConfigBase *aConfig) const override
Function ReadParam reads the value of the parameter stored in aConfig.
void SetVisibleAlls()
Function SetVisibleAlls Set the bit-mask of all visible elements categories, including enabled layers...
bool SetLayerType(PCB_LAYER_ID aLayer, LAYER_T aLayerType)
Function SetLayerType changes the type of the layer given by aLayer.
int GetClearance(wxString *aSource=nullptr) const
Definition: netclass.h:162
DIFF_PAIR_DIMENSION m_customDiffPair
#define DEFAULT_CUSTOMDPAIRGAP
PARAM_CFG_VIADIMENSIONS(std::vector< VIA_DIMENSION > *ptparam, const wxChar *group=nullptr)
int GetTextThickness(PCB_LAYER_ID aLayer) const
Function GetTextThickness Returns the default text thickness from the layer class for the given layer...
bool IsLayerEnabled(PCB_LAYER_ID aLayer) const
Function IsLayerEnabled is a proxy function that calls the correspondent function in m_BoardSettings ...
Definition: class_board.h:449
void SetBoardThickness(int aThickness)
VIATYPE m_CurrentViaType
(VIA_BLIND_BURIED, VIA_THROUGH, VIA_MICROVIA)
LSEQ Seq(const PCB_LAYER_ID *aWishListSequence, unsigned aCount) const
Function Seq returns an LSEQ from the union of this LSET and a desired sequence.
Definition: lset.cpp:377
ERC_SETTINGS * m_Pt_param
Pointer to the parameter value.
Configuration parameter - Integer Class with unit conversion.
NETCLASS_MAP::const_iterator const_iterator
Definition: netclass.h:258
Struct DIFF_PAIR_DIMENSION is a small helper container to handle a stock of specific differential pai...
#define DEFAULT_MINCLEARANCE
#define DEFAULT_MINTHROUGHDRILL
A single base class (TRACK) represents both tracks and vias, with subclasses for curved tracks (ARC) ...
#define DEFAULT_CUSTOMDPAIRVIAGAP
int GetLayerClass(PCB_LAYER_ID aLayer) const
void SetVisibleLayers(LSET aMask)
Function SetVisibleLayers changes the bit-mask of visible layers.
bool GetTextUpright(PCB_LAYER_ID aLayer) const
#define DEFAULT_SOLDERPASTE_CLEARANCE
bool GetTextItalic(PCB_LAYER_ID aLayer) const
int GetLineThickness(PCB_LAYER_ID aLayer) const
Function GetLineThickness Returns the default graphic segment thickness from the layer class for the ...
#define DEFAULT_TEXT_WIDTH
netlist item not found for footprint
Definition: drc.h:105
wxSize m_TextSize[LAYER_CLASS_COUNT]
void SetViaSizeIndex(unsigned aIndex)
Function SetViaSizeIndex sets the current via size list index to aIndex.
PARAM_CFG_LAYERS(BOARD *ptparam, const wxChar *group=nullptr)
#define DEFAULT_CUSTOMDPAIRWIDTH
void SaveParam(wxConfigBase *aConfig) const override
Function SaveParam saves the value of the parameter stored in aConfig.
PCB_LAYER_ID
A quick note on layer IDs:
BOARD * m_Pt_param
Pointer to the parameter value.
#define DEFAULT_SILK_TEXT_SIZE
int m_TextThickness[LAYER_CLASS_COUNT]
LSET is a set of PCB_LAYER_IDs.
#define DEFAULT_SILK_LINE_WIDTH
iterator begin()
Definition: netclass.h:255
NETCLASSES is a container for NETCLASS instances.
Definition: netclass.h:231
void ReadParam(wxConfigBase *aConfig) const override
Function ReadParam reads the value of the parameter stored in aConfig.
#define ViaDiameterKey
#define NULL
NETCLASSES * m_Pt_param
Pointer to the parameter value.
PARAM_CFG_SEVERITIES(BOARD *ptparam, const wxChar *group=nullptr)
#define GAL_LAYER_INDEX(x)
Use this macro to convert a GAL layer to a 0-indexed offset from LAYER_VIAS.
unsigned GetViaSizeIndex() const
Function GetViaSizeIndex.
Definition: drc.h:109
void SetMinHoleSeparation(int aDistance)
Function SetMinHoleSeparation.
track with at least one end not connected to anything
Definition: drc.h:63
LAYER_T
Enum LAYER_T gives the allowed types of layers, same as Specctra DSN spec.
Definition: class_board.h:67
Configuration parameter - Integer Class.
bool SetLayerName(PCB_LAYER_ID aLayer, const wxString &aLayerName)
Function SetLayerName changes the name of the layer given by aLayer.
unsigned GetTrackWidthIndex() const
Function GetTrackWidthIndex.
bool m_TextItalic[LAYER_CLASS_COUNT]
#define LayerKeyPrefix
Functions to provide common constants and other functions to assist in making a consistent UI.
static LSET AllLayersMask()
Definition: lset.cpp:749
Configuration parameter - Boolean Class.
bool m_BlindBuriedViaAllowed
true to allow blind/buried vias
void SaveParam(wxConfigBase *aConfig) const override
Function SaveParam saves the value of the parameter stored in aConfig.
void ReadParam(wxConfigBase *aConfig) const override
Function ReadParam reads the value of the parameter stored in aConfig.
#define TEXTS_MAX_SIZE
Maximum text size in internal units (10 inches)
Definition: pcbnew.h:39
void SetDiffPairIndex(unsigned aIndex)
Function SetDiffPairIndex.
#define DEFAULT_MICROVIASMINSIZE
#define DEFAULT_MICROVIASMINDRILL
#define DEFAULT_SOLDERMASK_MIN_WIDTH
int m_LineThickness[LAYER_CLASS_COUNT]
LSEQ is a sequence (and therefore also a set) of PCB_LAYER_IDs.
#define READ_MM(aKey, aDefault)
#define TEXTS_MIN_SIZE
Minimum text size in internal units (1 mil)
Definition: pcbnew.h:38
#define DEFAULT_COPPEREDGECLEARANCE
LSET m_visibleLayers
Bit-mask for layer visibility.
#define LayerNameKey
LAYER_T GetLayerType(PCB_LAYER_ID aLayer) const
Function GetLayerType returns the type of the copper layer given by aLayer.
int m_visibleElements
Bit-mask for element category visibility.
bool Add(const NETCLASSPTR &aNetclass)
Function Add takes aNetclass and puts it into this NETCLASSES container.
Definition: netclass.cpp:99
wxString GetErrorText(int aErrorCode=-1, bool aTranslate=true) const override
Function GetErrorText returns the string form of a drc error code.
Definition: drc_item.cpp:54
std::vector< int > * m_Pt_param
Pointer to the parameter value.
void ReadParam(wxConfigBase *aConfig) const override
Function ReadParam reads the value of the parameter stored in aConfig.
bool SetCurrentNetClass(const wxString &aNetClassName)
Function SetCurrentNetClass Must be called after a netclass selection (or after a netclass parameter ...
void Clear()
Function Clear destroys any contained NETCLASS instances except the Default one.
Definition: netclass.h:249
Board layer functions and definitions.
const char * name
Definition: DXF_plotter.cpp:60
#define dPairGapKey
BOARD holds information pertinent to a Pcbnew printed circuit board.
Definition: class_board.h:181
PARAM_CFG is a base class which establishes the interface functions ReadParam and SaveParam,...
Definition: config_params.h:99
LSET GetEnabledLayers() const
Function GetEnabledLayers returns a bit-mask of all the layers that are enabled.
void SaveParam(wxConfigBase *aConfig) const override
Function SaveParam saves the value of the parameter stored in aConfig.
bool m_ZoneUseNoOutlineInFill
Option to handle filled polygons in zones: the "legacy" option is using thick outlines around filled ...
PARAM_CFG_NETCLASSES(const wxChar *ident, NETCLASSES *ptparam, const wxChar *group=nullptr)
#define dPairWidthKey
footprint has no courtyard defined
Definition: drc.h:96
#define uViaDiameterKey
int GetCopperLayerCount() const
Function GetCopperLayerCount.
NETCLASS * GetDefault() const
Function GetDefault.
The common library.
footprint courtyards overlap
Definition: drc.h:95
void SetElementVisibility(GAL_LAYER_ID aElementCategory, bool aNewState)
Function SetElementVisibility changes the visibility of an element category.
unsigned GetCount() const
Function GetCount.
Definition: netclass.h:266
#define DEFAULT_COPPER_TEXT_WIDTH
std::vector< VIA_DIMENSION > m_ViasDimensionsList
#define DEFAULT_CUSTOMTRACKWIDTH
bool IsCopperLayer(LAYER_NUM aLayerId)
Function IsCopperLayer tests whether a layer is a copper layer.
NETCLASSPTR GetDefault() const
Function GetDefault.
Definition: netclass.h:275
PARAM_CFG_DIFFPAIRDIMENSIONS(std::vector< DIFF_PAIR_DIMENSION > *ptparam, const wxChar *group=nullptr)
#define DEFAULT_TEXT_SIZE
unsigned GetDiffPairIndex() const
Function GetDiffPairIndex.
#define DEFAULT_SOLDERMASK_CLEARANCE
#define dPairViaGapKey
PARAM_CFG_TRACKWIDTHS(std::vector< int > *ptparam, const wxChar *group=nullptr)
int m_copperLayerCount
Number of copper layers for this design.
#define DEFAULT_COPPER_TEXT_SIZE
bool m_MicroViasAllowed
true to allow micro vias
via which isn't connected to anything
Definition: drc.h:62
Definition: drc.h:41
bool m_HasStackup
Set to true if the board has a stackup management.
double m_SolderPasteMarginRatio
Solder pask margin ratio value of pad size The final margin is the sum of these 2 values.
int GetSeverity(int aDRCErrorCode)
#define ViaDrillKey
void SaveParam(wxConfigBase *aConfig) const override
Function SaveParam saves the value of the parameter stored in aConfig.
#define ClearanceKey
LSET m_enabledLayers
Bit-mask for layer enabling.
std::vector< DRC_RULE * > m_DRCRules
std::vector< DIFF_PAIR_DIMENSION > * m_Pt_param
Pointer to the parameter value.
void SetEnabledLayers(LSET aLayerMask)
Function SetEnabledLayers is a proxy function that calls the correspondent function in m_BoardSetting...
wxSize GetTextSize(PCB_LAYER_ID aLayer) const
Function GetTextSize Returns the default text size from the layer class for the given layer.
int m_boardThickness
Board thickness for 3D viewer.
void SaveParam(wxConfigBase *aConfig) const override
Function SaveParam saves the value of the parameter stored in aConfig.
bool m_TextUpright[LAYER_CLASS_COUNT]
#define LayerEnabledKey
int m_SolderMaskMinWidth
Solder mask min width.
void AppendConfigs(BOARD *aBoard, std::vector< PARAM_CFG * > *aResult)
Function AppendConfigs appends to aResult the configuration setting accessors which will later allow ...
static wxString GetStandardLayerName(PCB_LAYER_ID aLayerId)
Function GetStandardLayerName returns an "English Standard" name of a PCB layer when given aLayerNumb...
Definition: class_board.h:640
BOARD_DESIGN_SETTINGS contains design settings for a BOARD object.
#define BoardThicknessKey