KiCad PCB EDA Suite
board_stackup.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) 2019 Jean-Pierre Charras, jp.charras at wanadoo.fr
5  * Copyright (C) 2009-2021 KiCad Developers, see AUTHORS.txt for contributors.
6  *
7  * This program is free software; you can redistribute it and/or
8  * modify it under the terms of the GNU General Public License
9  * as published by the Free Software Foundation; either version 3
10  * of the License, or (at your option) any later version.
11  *
12  * This program is distributed in the hope that it will be useful,
13  * but WITHOUT ANY WARRANTY; without even the implied warranty of
14  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15  * GNU General Public License for more details.
16  *
17  * You should have received a copy of the GNU General Public License along
18  * with this program. If not, see <http://www.gnu.org/licenses/>.
19  */
20 
21 
22 #include "board_stackup.h"
23 #include <convert_to_biu.h>
24 #include <base_units.h>
25 #include <string_utils.h>
26 #include <layer_ids.h>
27 #include <board_design_settings.h>
28 #include <board.h>
29 #include <i18n_utility.h> // For _HKI definition
31 
32 
34 {
35  DIELECTRIC_PRMS item_prms;
36  m_DielectricPrmsList.emplace_back( item_prms );
38  m_Type = aType;
40  SetEnabled( true );
41 
42  // Initialize parameters to a usual value for allowed types:
43  switch( m_Type )
44  {
48  break;
49 
51  m_TypeName = KEY_CORE; // or prepreg
52  SetMaterial( "FR4" ); // or other dielectric name
53  SetLossTangent( 0.02 ); // for FR4
54  SetEpsilonR( 4.5 ); // for FR4
55  break;
56 
58  m_TypeName = "solderpaste";
59  break;
60 
62  m_TypeName = "soldermask";
63  m_Color = "Green";
64  SetMaterial( NotSpecifiedPrm() ); // or other solder mask material name
67  break;
68 
70  m_TypeName = "silkscreen";
72  SetMaterial( NotSpecifiedPrm() ); // or other silkscreen material name
74  break;
75 
77  break;
78  }
79 }
80 
81 
83 {
84  m_LayerId = aOther.m_LayerId;
86  m_Type = aOther.m_Type;
87  m_enabled = aOther.m_enabled;
89  m_TypeName = aOther.m_TypeName;
90  m_LayerName = aOther.m_LayerName;
91  m_Color = aOther.GetColor();
92 }
93 
94 
95 void BOARD_STACKUP_ITEM::AddDielectricPrms( int aDielectricPrmsIdx )
96 {
97  // add a DIELECTRIC_PRMS item to m_DielectricPrmsList
98  DIELECTRIC_PRMS new_prms;
99 
100  m_DielectricPrmsList.emplace( m_DielectricPrmsList.begin() + aDielectricPrmsIdx,
101  new_prms );
102 }
103 
104 
105 void BOARD_STACKUP_ITEM::RemoveDielectricPrms( int aDielectricPrmsIdx )
106 {
107  // Remove a DIELECTRIC_PRMS item from m_DielectricPrmsList if possible
108 
109  if( GetSublayersCount() < 2 || aDielectricPrmsIdx < 0
110  || aDielectricPrmsIdx >= GetSublayersCount() )
111  return;
112 
113  m_DielectricPrmsList.erase( m_DielectricPrmsList.begin() + aDielectricPrmsIdx );
114 }
115 
116 
117 
119 {
120  // A reasonable thickness for copper layers:
121  return Millimeter2iu( 0.035 );
122 }
123 
124 
126 {
127  // A reasonable thickness for solder mask:
128  return Millimeter2iu( 0.01 );
129 }
130 
131 
132 // Getters:
133 int BOARD_STACKUP_ITEM::GetThickness( int aDielectricSubLayer ) const
134 {
135  wxASSERT( aDielectricSubLayer >= 0 && aDielectricSubLayer < GetSublayersCount() );
136 
137  return m_DielectricPrmsList[aDielectricSubLayer].m_Thickness;
138 }
139 
140 
141 double BOARD_STACKUP_ITEM::GetLossTangent( int aDielectricSubLayer ) const
142 {
143  wxASSERT( aDielectricSubLayer >= 0 && aDielectricSubLayer < GetSublayersCount() );
144 
145  return m_DielectricPrmsList[aDielectricSubLayer].m_LossTangent;
146 }
147 
148 
149 double BOARD_STACKUP_ITEM::GetEpsilonR( int aDielectricSubLayer ) const
150 {
151  wxASSERT( aDielectricSubLayer >= 0 && aDielectricSubLayer < GetSublayersCount() );
152 
153  return m_DielectricPrmsList[aDielectricSubLayer].m_EpsilonR;
154 }
155 
156 
157 bool BOARD_STACKUP_ITEM::IsThicknessLocked( int aDielectricSubLayer ) const
158 {
159  wxASSERT( aDielectricSubLayer >= 0 && aDielectricSubLayer < GetSublayersCount() );
160 
161  return m_DielectricPrmsList[aDielectricSubLayer].m_ThicknessLocked;
162 }
163 
164 
165 wxString BOARD_STACKUP_ITEM::GetMaterial( int aDielectricSubLayer ) const
166 {
167  wxASSERT( aDielectricSubLayer >= 0 && aDielectricSubLayer < GetSublayersCount() );
168 
169  return m_DielectricPrmsList[aDielectricSubLayer].m_Material;
170 }
171 
172 
173 // Setters:
174 void BOARD_STACKUP_ITEM::SetThickness( int aThickness, int aDielectricSubLayer )
175 {
176  wxASSERT( aDielectricSubLayer >= 0 && aDielectricSubLayer < GetSublayersCount() );
177 
178  if( aDielectricSubLayer >= 0 && aDielectricSubLayer < GetSublayersCount() )
179  m_DielectricPrmsList[aDielectricSubLayer].m_Thickness = aThickness;
180 }
181 
182 
183 void BOARD_STACKUP_ITEM::SetLossTangent( double aTg, int aDielectricSubLayer )
184 {
185  wxASSERT( aDielectricSubLayer >= 0 && aDielectricSubLayer < GetSublayersCount() );
186 
187  if( aDielectricSubLayer >= 0 && aDielectricSubLayer < GetSublayersCount() )
188  m_DielectricPrmsList[aDielectricSubLayer].m_LossTangent = aTg;
189 }
190 
191 
192 void BOARD_STACKUP_ITEM::SetEpsilonR( double aEpsilon, int aDielectricSubLayer )
193 {
194  wxASSERT( aDielectricSubLayer >= 0 && aDielectricSubLayer < GetSublayersCount() );
195 
196  if( aDielectricSubLayer >= 0 && aDielectricSubLayer < GetSublayersCount() )
197  m_DielectricPrmsList[aDielectricSubLayer].m_EpsilonR = aEpsilon;
198 }
199 
200 
201 void BOARD_STACKUP_ITEM::SetThicknessLocked( bool aLocked, int aDielectricSubLayer )
202 {
203  wxASSERT( aDielectricSubLayer >= 0 && aDielectricSubLayer < GetSublayersCount() );
204 
205  if( aDielectricSubLayer >= 0 && aDielectricSubLayer < GetSublayersCount() )
206  m_DielectricPrmsList[aDielectricSubLayer].m_ThicknessLocked = aLocked;
207 }
208 
209 
210 void BOARD_STACKUP_ITEM::SetMaterial( const wxString& aName, int aDielectricSubLayer )
211 {
212  wxASSERT( aDielectricSubLayer >= 0 && aDielectricSubLayer < GetSublayersCount() );
213 
214  if( aDielectricSubLayer >= 0 && aDielectricSubLayer < GetSublayersCount() )
215  m_DielectricPrmsList[aDielectricSubLayer].m_Material = aName;
216 }
217 
218 
220 {
223  //|| m_Type == BS_ITEM_TYPE_SILKSCREEN
224  ;
225 };
226 
227 
229 {
232 };
233 
234 
235 bool BOARD_STACKUP_ITEM::HasMaterialValue( int aDielectricSubLayer ) const
236 {
237  // return true if the material is specified
238  return IsMaterialEditable() && IsPrmSpecified( GetMaterial( aDielectricSubLayer ) );
239 }
240 
241 
243 {
244  // The material is editable only for dielectric
245  return m_Type == BS_ITEM_TYPE_DIELECTRIC ||
248 }
249 
250 
252 {
254 }
255 
256 
258 {
259  switch( m_Type )
260  {
261  case BS_ITEM_TYPE_COPPER:
262  return true;
263 
265  return true;
266 
268  return true;
269 
271  return false;
272 
274  return false;
275 
276  default:
277  break;
278  }
279 
280  return false;
281 }
282 
283 
284 wxString BOARD_STACKUP_ITEM::FormatEpsilonR( int aDielectricSubLayer ) const
285 {
286  // return a wxString to print/display Epsilon R
287  wxString txt;
288  txt.Printf( "%.2f", GetEpsilonR( aDielectricSubLayer ) );
289  return txt;
290 }
291 
292 
293 wxString BOARD_STACKUP_ITEM::FormatLossTangent( int aDielectricSubLayer ) const
294 {
295  // return a wxString to print/display Loss Tangent
296  wxString txt;
297  txt.Printf( "%g", GetLossTangent( aDielectricSubLayer ) );
298  return txt;
299 }
300 
301 
303 {
304  // return a wxString to print/display a dielectric name
305  wxString lname;
306  lname.Printf( _( "Dielectric %d" ), GetDielectricLayerId() );
307 
308  return lname;
309 }
310 
311 
313 {
314  m_HasDielectricConstrains = false; // True if some dielectric layers have constrains
315  // (Loss tg and Epison R)
316  m_HasThicknessConstrains = false; // True if some dielectric or copper layers have constrains
318  m_CastellatedPads = false; // True if some castellated pads exist
319  m_EdgePlating = false; // True if edge board is plated
320  m_FinishType = "None"; // undefined finish type
321 }
322 
323 
325 {
330  m_EdgePlating = aOther.m_EdgePlating;
331  m_FinishType = aOther.m_FinishType;
332 
333  // All items in aOther.m_list have to be duplicated, because aOther.m_list
334  // manage pointers to these items
335  for( auto item : aOther.m_list )
336  {
337  BOARD_STACKUP_ITEM* dup_item = new BOARD_STACKUP_ITEM( *item );
338  Add( dup_item );
339  }
340 }
341 
342 
344 {
349  m_EdgePlating = aOther.m_EdgePlating;
350  m_FinishType = aOther.m_FinishType;
351 
352  RemoveAll();
353 
354  // All items in aOther.m_list have to be duplicated, because aOther.m_list
355  // manage pointers to these items
356  for( auto item : aOther.m_list )
357  {
358  BOARD_STACKUP_ITEM* dup_item = new BOARD_STACKUP_ITEM( *item );
359  Add( dup_item );
360  }
361 
362  return *this;
363 }
364 
365 
367 {
368  for( auto item : m_list )
369  delete item;
370 
371  m_list.clear();
372 }
373 
374 
376 {
377  if( aIndex < 0 || aIndex >= GetCount() )
378  return nullptr;
379 
380  return GetList()[aIndex];
381 }
382 
383 
385 {
386  // return the board thickness from the thickness of BOARD_STACKUP_ITEM list
387  int thickness = 0;
388 
389  for( auto item : m_list )
390  {
391  if( item->IsThicknessEditable() && item->IsEnabled() )
392  thickness += item->GetThickness();
393  }
394 
395  return thickness;
396 }
397 
398 
400 {
401  bool change = false;
402  // Build the suitable stackup:
403  BOARD_STACKUP stackup;
404  stackup.BuildDefaultStackupList( aSettings );
405 
406  // First, find removed layers:
407  for( BOARD_STACKUP_ITEM* curr_item: m_list )
408  {
409  bool found = false;
410 
411  for( BOARD_STACKUP_ITEM* item: stackup.GetList() )
412  {
413  if( curr_item->GetBrdLayerId() != UNDEFINED_LAYER )
414  {
415  if( item->GetBrdLayerId() == curr_item->GetBrdLayerId() )
416  {
417  found = true;
418  break;
419  }
420  }
421  else // curr_item = dielectric layer
422  {
423  if( item->GetBrdLayerId() != UNDEFINED_LAYER )
424  continue;
425 
426  if( item->GetDielectricLayerId() == curr_item->GetDielectricLayerId() )
427  {
428  found = true;
429  break;
430  }
431  }
432  }
433 
434  if( !found ) // a layer was removed: a change is found
435  {
436  change = true;
437  break;
438  }
439  }
440 
441  // Now initialize all stackup items to the initial values, when exist
442  for( BOARD_STACKUP_ITEM* item : stackup.GetList() )
443  {
444  bool found = false;
445  // Search for initial settings:
446  for( const BOARD_STACKUP_ITEM* initial_item : m_list )
447  {
448  if( item->GetBrdLayerId() != UNDEFINED_LAYER )
449  {
450  if( item->GetBrdLayerId() == initial_item->GetBrdLayerId() )
451  {
452  *item = *initial_item;
453  found = true;
454  break;
455  }
456  }
457  else // dielectric layer: see m_DielectricLayerId for identification
458  {
459  // Compare dielectric layer with dielectric layer
460  if( initial_item->GetBrdLayerId() != UNDEFINED_LAYER )
461  continue;
462 
463  if( item->GetDielectricLayerId() == initial_item->GetDielectricLayerId() )
464  {
465  *item = *initial_item;
466  found = true;
467  break;
468  }
469  }
470  }
471 
472  if( !found )
473  {
474  change = true;
475  }
476  }
477 
478  // Transfer other stackup settings from aSettings
479  const BOARD_STACKUP& source_stackup = aSettings->GetStackupDescriptor();
482  m_CastellatedPads = source_stackup.m_CastellatedPads;
483  m_EdgePlating = source_stackup.m_EdgePlating;
484  m_FinishType = source_stackup.m_FinishType;
485 
486  *this = stackup;
487 
488  return change;
489 }
490 
491 
493  int aActiveCopperLayersCount )
494 {
495  // Creates a default stackup, according to the current BOARD_DESIGN_SETTINGS settings.
496  // Note: the m_TypeName string is made translatable using _HKI marker, but is not
497  // translated when building the stackup.
498  // It will be used as this in files, and can be translated only in dialog
499  // if aSettings == NULL, build a full stackup (with 32 copper layers)
500  LSET enabledLayer = aSettings ? aSettings->GetEnabledLayers() : StackupAllowedBrdLayers();
501  int copperLayerCount = aSettings ? aSettings->GetCopperLayerCount() : B_Cu+1;
502 
503  // We need to calculate a suitable dielectric layer thickness.
504  // If no settings, and if aActiveCopperLayersCount is given, use it
505  // (If no settings, and no aActiveCopperLayersCount, the full 32 layers are used)
506  int activeCuLayerCount = copperLayerCount;
507 
508  if( aSettings == nullptr && aActiveCopperLayersCount > 0 )
509  activeCuLayerCount = aActiveCopperLayersCount;
510 
511  int brd__thickness = aSettings ? aSettings->GetBoardThickness() : Millimeter2iu( 1.6 );
512  int diel_thickness = brd__thickness -
513  ( BOARD_STACKUP_ITEM::GetCopperDefaultThickness() * activeCuLayerCount );
514 
515  // Take in account the solder mask thickness:
516  int sm_count = ( enabledLayer & LSET( 2, F_Mask, B_Mask) ).count();
517  diel_thickness -= BOARD_STACKUP_ITEM::GetMaskDefaultThickness() * sm_count;
518 
519  int dielectric_idx = 0;
520 
521  // Add silk screen, solder mask and solder paste layers on top
522  if( enabledLayer[F_SilkS] )
523  {
525  item->SetBrdLayerId( F_SilkS );
526  item->SetTypeName( _HKI( "Top Silk Screen" ) );
527  Add( item );
528  }
529 
530  if( enabledLayer[F_Paste] )
531  {
533  item->SetBrdLayerId( F_Paste );
534  item->SetTypeName( _HKI( "Top Solder Paste" ) );
535  Add( item );
536  }
537 
538  if( enabledLayer[F_Mask] )
539  {
541  item->SetBrdLayerId( F_Mask );
542  item->SetTypeName( _HKI( "Top Solder Mask" ) );
543  Add( item );
544  }
545 
546  // Add copper and dielectric layers
547  for( int ii = 0; ii < copperLayerCount; ii++ )
548  {
550  item->SetBrdLayerId( ( PCB_LAYER_ID )ii );
551  item->SetTypeName( KEY_COPPER );
552  Add( item );
553 
554  if( ii == copperLayerCount-1 )
555  {
556  item->SetBrdLayerId( B_Cu );
557  break;
558  }
559 
560  // Add the dielectric layer:
562  item->SetThickness( diel_thickness );
563  item->SetDielectricLayerId( dielectric_idx + 1 );
564 
565  // Display a dielectric default layer name:
566  if( (dielectric_idx & 1) == 0 )
567  {
568  item->SetTypeName( KEY_CORE );
569  item->SetMaterial( "FR4" );
570  }
571  else
572  {
573  item->SetTypeName( KEY_PREPREG );
574  item->SetMaterial( "FR4" );
575  }
576 
577  Add( item );
578  dielectric_idx++;
579  }
580 
581  // Add silk screen, solder mask and solder paste layers on bottom
582  if( enabledLayer[B_Mask] )
583  {
585  item->SetBrdLayerId( B_Mask );
586  item->SetTypeName( _HKI( "Bottom Solder Mask" ) );
587  Add( item );
588  }
589 
590  if( enabledLayer[B_Paste] )
591  {
593  item->SetBrdLayerId( B_Paste );
594  item->SetTypeName( _HKI( "Bottom Solder Paste" ) );
595  Add( item );
596  }
597 
598  if( enabledLayer[B_SilkS] )
599  {
601  item->SetBrdLayerId( B_SilkS );
602  item->SetTypeName( _HKI( "Bottom Silk Screen" ) );
603  Add( item );
604  }
605 
606  // Transfer other stackup settings from aSettings
607  if( aSettings )
608  {
609  const BOARD_STACKUP& source_stackup = aSettings->GetStackupDescriptor();
611  m_CastellatedPads = source_stackup.m_CastellatedPads;
612  m_EdgePlating = source_stackup.m_EdgePlating;
613  m_FinishType = source_stackup.m_FinishType;
614  }
615 }
616 
617 
619  const BOARD* aBoard, int aNestLevel ) const
620 {
621  // Board stackup is the ordered list from top to bottom of
622  // physical layers and substrate used to build the board.
623  if( m_list.empty() )
624  return;
625 
626  aFormatter->Print( aNestLevel, "(stackup\n" );
627  int nest_level = aNestLevel+1;
628 
629  // Note:
630  // Unspecified parameters are not stored in file.
631  for( BOARD_STACKUP_ITEM* item: m_list )
632  {
633  wxString layer_name;
634 
635  if( item->GetBrdLayerId() == UNDEFINED_LAYER )
636  layer_name.Printf( "dielectric %d", item->GetDielectricLayerId() );
637  else
638  layer_name = LSET::Name( item->GetBrdLayerId() );
639 
640  aFormatter->Print( nest_level, "(layer %s (type %s)",
641  aFormatter->Quotew( layer_name ).c_str(),
642  aFormatter->Quotew( item->GetTypeName() ).c_str() );
643 
644  if( item->IsColorEditable() && IsPrmSpecified( item->GetColor() ) )
645  aFormatter->Print( 0, " (color %s)",
646  aFormatter->Quotew( item->GetColor() ).c_str() );
647 
648  for( int idx = 0; idx < item->GetSublayersCount(); idx++ )
649  {
650  if( idx ) // not for the main (first) layer.
651  {
652  aFormatter->Print( 0, "\n" );
653  aFormatter->Print( nest_level+1, "addsublayer" );
654  }
655 
656  if( item->IsThicknessEditable() )
657  {
658  if( item->GetType() == BS_ITEM_TYPE_DIELECTRIC && item->IsThicknessLocked( idx ) )
659  aFormatter->Print( 0, " (thickness %s locked)",
660  FormatInternalUnits( item->GetThickness( idx ) ).c_str() );
661  else
662  aFormatter->Print( 0, " (thickness %s)",
663  FormatInternalUnits( item->GetThickness( idx ) ).c_str() );
664  }
665 
666  if( item->HasMaterialValue( idx ) )
667  aFormatter->Print( 0, " (material %s)",
668  aFormatter->Quotew( item->GetMaterial( idx ) ).c_str() );
669 
670  if( item->HasEpsilonRValue() && item->HasMaterialValue( idx ) )
671  aFormatter->Print( 0, " (epsilon_r %g)", item->GetEpsilonR( idx ) );
672 
673  if( item->HasLossTangentValue() && item->HasMaterialValue( idx ) )
674  aFormatter->Print( 0, " (loss_tangent %s)",
675  Double2Str(item->GetLossTangent( idx ) ).c_str() );
676  }
677 
678  aFormatter->Print( 0, ")\n" );
679  }
680 
681  // Other infos about board, related to layers and other fabrication specifications
683  aFormatter->Print( nest_level, "(copper_finish %s)\n",
684  aFormatter->Quotew( m_FinishType ).c_str() );
685 
686  aFormatter->Print( nest_level, "(dielectric_constraints %s)\n",
687  m_HasDielectricConstrains ? "yes" : "no" );
688 
690  aFormatter->Print( nest_level, "(edge_connector %s)\n",
691  m_EdgeConnectorConstraints > 1 ? "bevelled": "yes" );
692 
693  if( m_CastellatedPads )
694  aFormatter->Print( nest_level, "(castellated_pads yes)\n" );
695 
696  if( m_EdgePlating )
697  aFormatter->Print( nest_level, "(edge_plating yes)\n" );
698 
699  aFormatter->Print( aNestLevel, ")\n" );
700 }
701 
702 
703 int BOARD_STACKUP::GetLayerDistance( PCB_LAYER_ID aFirstLayer, PCB_LAYER_ID aSecondLayer ) const
704 {
705  wxASSERT( IsCopperLayer( aFirstLayer ) && IsCopperLayer( aSecondLayer ) );
706 
707  if( aFirstLayer == aSecondLayer )
708  return 0;
709 
710  if( aSecondLayer < aFirstLayer )
711  std::swap( aFirstLayer, aSecondLayer );
712 
713  int total = 0;
714  bool start = false;
715  bool half = false;
716 
717  for( BOARD_STACKUP_ITEM* item : m_list )
718  {
719  // Will be UNDEFINED_LAYER for dielectrics
720  PCB_LAYER_ID layer = item->GetBrdLayerId();
721 
722  if( layer != UNDEFINED_LAYER && !IsCopperLayer( layer ) )
723  continue; // Silk/mask layer
724 
725  // Reached the start copper layer? Start counting the next dielectric after it
726  if( !start && ( layer != UNDEFINED_LAYER && layer >= aFirstLayer ) )
727  {
728  start = true;
729  half = true;
730  }
731  else if( !start )
732  continue;
733 
734  // Reached the stop copper layer? we're done
735  if( start && ( layer != UNDEFINED_LAYER && layer >= aSecondLayer ) )
736  half = true;
737 
738  for( int sublayer = 0; sublayer < item->GetSublayersCount(); sublayer++ )
739  {
740  int subThickness = item->GetThickness( sublayer );
741  total += half ? ( subThickness / 2 ) : subThickness;
742  }
743 
744  half = false;
745 
746  if( layer != UNDEFINED_LAYER && layer >= aSecondLayer )
747  break;
748  }
749 
750  return total;
751 }
752 
753 
754 bool IsPrmSpecified( const wxString& aPrmValue )
755 {
756  // return true if the param value is specified:
757 
758  if( !aPrmValue.IsEmpty()
759  && ( aPrmValue.CmpNoCase( NotSpecifiedPrm() ) != 0 )
760  && aPrmValue != wxGetTranslation( NotSpecifiedPrm() ) )
761  return true;
762 
763  return false;
764 }
#define DEFAULT_EPSILON_R_SOLDERMASK
bool HasEpsilonRValue() const
void SetBrdLayerId(PCB_LAYER_ID aBrdLayerId)
void SetTypeName(const wxString &aName)
BOARD_STACKUP_ITEM * GetStackupLayer(int aIndex)
BOARD_STACKUP_ITEM_TYPE
Definition: board_stackup.h:40
bool HasMaterialValue(int aDielectricSubLayer=0) const
Manage layers needed to make a physical board.
Implementation of conversion functions that require both schematic and board internal units.
int GetSublayersCount() const
wxString m_FinishType
The name of external copper finish.
bool m_EdgePlating
True if the edge board is plated.
bool IsThicknessLocked(int aDielectricSubLayer=0) const
int GetLayerDistance(PCB_LAYER_ID aFirstLayer, PCB_LAYER_ID aSecondLayer) const
Calculate the distance (height) between the two given copper layers.
BS_EDGE_CONNECTOR_CONSTRAINTS m_EdgeConnectorConstraints
If the board has edge connector cards, some constrains can be specified in job file: BS_EDGE_CONNECTO...
bool m_CastellatedPads
True if castellated pads exist.
#define KEY_COPPER
wxString GetColor() const
An interface used to output 8 bit text in a convenient way.
Definition: richio.h:309
wxString m_TypeName
name of layer as shown in layer manager. Useful to create reports
BOARD_STACKUP & operator=(const BOARD_STACKUP &aOther)
double GetLossTangent(int aDielectricSubLayer=0) const
static int GetCopperDefaultThickness()
bool SynchronizeWithBoard(BOARD_DESIGN_SETTINGS *aSettings)
Synchronize the BOARD_STACKUP_ITEM* list with the board.
int BuildBoardThicknessFromStackup() const
std::vector< DIELECTRIC_PRMS > m_DielectricPrmsList
the "layer" id for dielectric layers, from 1 (top) to 31 (bottom) (only 31 dielectric layers for 32 c...
bool m_HasDielectricConstrains
True if some layers have impedance controlled tracks or have specific constrains for micro-wave appli...
BOARD_STACKUP & GetStackupDescriptor()
bool IsThicknessEditable() const
LSET is a set of PCB_LAYER_IDs.
Definition: layer_ids.h:502
static LSET StackupAllowedBrdLayers()
static const wxChar * Name(PCB_LAYER_ID aLayerId)
Return the fixed name association with aLayerId.
Definition: lset.cpp:82
wxString NotSpecifiedPrm()
int GetThickness(int aDielectricSubLayer=0) const
bool IsColorEditable() const
void SetDielectricLayerId(int aLayerId)
bool HasLossTangentValue() const
A helper class to manage a dielectric layer set of parameters.
Definition: board_stackup.h:64
double GetEpsilonR(int aDielectricSubLayer=0) const
PCB_LAYER_ID m_LayerId
mainly for silkscreen and solder mask
wxString FormatEpsilonR(int aDielectricSubLayer=0) const
bool IsMaterialEditable() const
#define _(s)
wxString FormatLossTangent(int aDielectricSubLayer=0) const
void SetMaterial(const wxString &aName, int aDielectricSubLayer=0)
std::vector< BOARD_STACKUP_ITEM * > m_list
int GetCount() const
#define KEY_PREPREG
bool m_HasThicknessConstrains
True if some layers (copper and/or dielectric) have specific thickness.
Manage one layer needed to make a physical board.
Definition: board_stackup.h:89
void SetEpsilonR(double aEpsilon, int aDielectricSubLayer=0)
const std::vector< BOARD_STACKUP_ITEM * > & GetList() const
void FormatBoardStackup(OUTPUTFORMATTER *aFormatter, const BOARD *aBoard, int aNestLevel) const
Write the stackup info on board file.
bool IsCopperLayer(LAYER_NUM aLayerId)
Tests whether a layer is a copper layer.
Definition: layer_ids.h:787
void AddDielectricPrms(int aDielectricPrmsIdx)
Add (insert) a DIELECTRIC_PRMS item to m_DielectricPrmsList all values are set to default.
void SetThickness(int aThickness, int aDielectricSubLayer=0)
Some functions to handle hotkeys in KiCad.
static int GetMaskDefaultThickness()
#define DEFAULT_EPSILON_R_SILKSCREEN
void SetThicknessLocked(bool aLocked, int aDielectricSubLayer=0)
wxString m_Color
type name of layer (copper, silk screen, core, prepreg ...)
void RemoveAll()
Delete all items in list and clear the list.
BOARD_STACKUP_ITEM(BOARD_STACKUP_ITEM_TYPE aType)
bool IsPrmSpecified(const wxString &aPrmValue)
int GetDielectricLayerId() const
Information pertinent to a Pcbnew printed circuit board.
Definition: board.h:190
LSET GetEnabledLayers() const
Return a bit-mask of all the layers that are enabled.
PCB_LAYER_ID
A quick note on layer IDs:
Definition: layer_ids.h:64
std::string Double2Str(double aValue)
Print a float number without using scientific notation and no trailing 0 We want to avoid scientific ...
int PRINTF_FUNC Print(int nestLevel, const char *fmt,...)
Format and write text to the output stream.
Definition: richio.cpp:426
#define KEY_CORE
void Add(BOARD_STACKUP_ITEM *aItem)
Add a new item in stackup layer.
void BuildDefaultStackupList(const BOARD_DESIGN_SETTINGS *aSettings, int aActiveCopperLayersCount=0)
Create a default stackup, according to the current BOARD_DESIGN_SETTINGS settings.
BOARD_STACKUP_ITEM_TYPE m_Type
static constexpr int Millimeter2iu(double mm)
#define _HKI(x)
void SetLossTangent(double aTg, int aDielectricSubLayer=0)
wxString GetMaterial(int aDielectricSubLayer=0) const
int m_DielectricLayerId
the layer id (F.Cu to B.Cu, F.Silk, B.silk, F.Mask, B.Mask) and UNDEFINED_LAYER (-1) for dielectric l...
std::string FormatInternalUnits(int aValue)
Function FormatInternalUnits converts aValue from internal units to a string appropriate for writing ...
Definition: base_units.cpp:485
wxString FormatDielectricLayerName() const
std::string Quotew(const wxString &aWrapee) const
Definition: richio.cpp:494
Container for design settings for a BOARD object.
void SetEnabled(bool aEnable)
void RemoveDielectricPrms(int aDielectricPrmsIdx)
Remove a DIELECTRIC_PRMS item from m_DielectricPrmsList.