136 wxASSERT( aDielectricSubLayer >= 0 && aDielectricSubLayer <
GetSublayersCount() );
144 wxASSERT( aDielectricSubLayer >= 0 && aDielectricSubLayer <
GetSublayersCount() );
152 wxASSERT( aDielectricSubLayer >= 0 && aDielectricSubLayer <
GetSublayersCount() );
160 wxASSERT( aDielectricSubLayer >= 0 && aDielectricSubLayer <
GetSublayersCount() );
168 wxASSERT( aDielectricSubLayer >= 0 && aDielectricSubLayer <
GetSublayersCount() );
177 wxASSERT( aDielectricSubLayer >= 0 && aDielectricSubLayer <
GetSublayersCount() );
186 wxASSERT( aDielectricSubLayer >= 0 && aDielectricSubLayer <
GetSublayersCount() );
195 wxASSERT( aDielectricSubLayer >= 0 && aDielectricSubLayer <
GetSublayersCount() );
204 wxASSERT( aDielectricSubLayer >= 0 && aDielectricSubLayer <
GetSublayersCount() );
213 wxASSERT( aDielectricSubLayer >= 0 && aDielectricSubLayer <
GetSublayersCount() );
336 for(
auto item : aOther.
m_list )
357 for(
auto item : aOther.
m_list )
378 if( aIndex < 0 || aIndex >=
GetCount() )
392 if( item->IsThicknessEditable() && item->IsEnabled() )
394 thickness += item->GetThickness();
398 for(
int idx = 1; idx < item->GetSublayersCount(); idx++ )
400 thickness += item->GetThickness( idx );
425 if( item->GetBrdLayerId() == curr_item->GetBrdLayerId() )
436 if( item->GetDielectricLayerId() == curr_item->GetDielectricLayerId() )
460 if( item->GetBrdLayerId() == initial_item->GetBrdLayerId() )
462 *item = *initial_item;
473 if( item->GetDielectricLayerId() == initial_item->GetDielectricLayerId() )
475 *item = *initial_item;
504 int aActiveCopperLayersCount )
517 int activeCuLayerCount = copperLayerCount;
519 if( aSettings ==
nullptr && aActiveCopperLayersCount > 0 )
520 activeCuLayerCount = aActiveCopperLayersCount;
523 int diel_thickness = brd__thickness -
529 diel_thickness /= std::max( 1, activeCuLayerCount - 1 );
531 int dielectric_idx = 0;
550 if( enabledLayer[
F_Mask] )
559 for(
int ii = 0; ii < copperLayerCount; ii++ )
566 if( ii == copperLayerCount-1 )
578 if( (dielectric_idx & 1) == 0 )
594 if( enabledLayer[
B_Mask] )
631 const BOARD* aBoard,
int aNestLevel )
const 638 aFormatter->
Print( aNestLevel,
"(stackup\n" );
639 int nest_level = aNestLevel+1;
648 layer_name.Printf( wxT(
"dielectric %d" ), item->GetDielectricLayerId() );
650 layer_name =
LSET::Name( item->GetBrdLayerId() );
652 aFormatter->
Print( nest_level,
"(layer %s (type %s)",
653 aFormatter->
Quotew( layer_name ).c_str(),
654 aFormatter->
Quotew( item->GetTypeName() ).c_str() );
656 if( item->IsColorEditable() &&
IsPrmSpecified( item->GetColor() ) )
657 aFormatter->
Print( 0,
" (color %s)",
658 aFormatter->
Quotew( item->GetColor() ).c_str() );
660 for(
int idx = 0; idx < item->GetSublayersCount(); idx++ )
664 aFormatter->
Print( 0,
"\n" );
665 aFormatter->
Print( nest_level+1,
"addsublayer" );
668 if( item->IsThicknessEditable() )
671 aFormatter->
Print( 0,
" (thickness %s locked)",
674 aFormatter->
Print( 0,
" (thickness %s)",
678 if( item->HasMaterialValue( idx ) )
679 aFormatter->
Print( 0,
" (material %s)",
680 aFormatter->
Quotew( item->GetMaterial( idx ) ).c_str() );
682 if( item->HasEpsilonRValue() && item->HasMaterialValue( idx ) )
683 aFormatter->
Print( 0,
" (epsilon_r %g)", item->GetEpsilonR( idx ) );
685 if( item->HasLossTangentValue() && item->HasMaterialValue( idx ) )
686 aFormatter->
Print( 0,
" (loss_tangent %s)",
687 Double2Str(item->GetLossTangent( idx ) ).c_str() );
690 aFormatter->
Print( 0,
")\n" );
695 aFormatter->
Print( nest_level,
"(copper_finish %s)\n",
698 aFormatter->
Print( nest_level,
"(dielectric_constraints %s)\n",
702 aFormatter->
Print( nest_level,
"(edge_connector %s)\n",
706 aFormatter->
Print( nest_level,
"(castellated_pads yes)\n" );
709 aFormatter->
Print( nest_level,
"(edge_plating yes)\n" );
711 aFormatter->
Print( aNestLevel,
")\n" );
719 if( aFirstLayer == aSecondLayer )
722 if( aSecondLayer < aFirstLayer )
723 std::swap( aFirstLayer, aSecondLayer );
750 for(
int sublayer = 0; sublayer < item->GetSublayersCount(); sublayer++ )
752 int subThickness = item->GetThickness( sublayer );
753 total += half ? ( subThickness / 2 ) : subThickness;
770 if( !aPrmValue.IsEmpty()
#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)
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.
int GetBoardThickness() const
wxString GetColor() const
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.
static LSET StackupAllowedBrdLayers()
static const wxChar * Name(PCB_LAYER_ID aLayerId)
Return the fixed name association with aLayerId.
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.
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
wxString FormatLossTangent(int aDielectricSubLayer=0) const
void SetMaterial(const wxString &aName, int aDielectricSubLayer=0)
std::vector< BOARD_STACKUP_ITEM * > m_list
bool m_HasThicknessConstrains
True if some layers (copper and/or dielectric) have specific thickness.
Manage one layer needed to make a physical board.
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.
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.
LSET GetEnabledLayers() const
Return a bit-mask of all the layers that are enabled.
PCB_LAYER_ID
A quick note on layer IDs:
std::string Double2Str(double aValue)
Print a float number without using scientific notation and no trailing 0 We want to avoid scientific ...
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)
int GetCopperLayerCount() const
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 ...
wxString FormatDielectricLayerName() const
Container for design settings for a BOARD object.
void SetEnabled(bool aEnable)
void RemoveDielectricPrms(int aDielectricPrmsIdx)
Remove a DIELECTRIC_PRMS item from m_DielectricPrmsList.