KiCad PCB EDA Suite
Loading...
Searching...
No Matches
fab_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 The 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, see <https://www.gnu.org/licenses/>.
18 */
19
21
22#include <board.h>
25
26
28 m_stackup( aBoard.GetDesignSettings().GetStackupDescriptor() )
29{
30 m_stackup.SynchronizeWithBoard( &aBoard.GetDesignSettings() );
31}
32
33
35{
36 if( aLayer == UNDEFINED_LAYER )
37 return nullptr;
38
39 for( const BOARD_STACKUP_ITEM* item : m_stackup.GetList() )
40 {
41 if( item->GetBrdLayerId() == aLayer )
42 return item;
43 }
44
45 return nullptr;
46}
47
48
49wxString FAB_STACKUP::NamedColor( PCB_LAYER_ID aLayer ) const
50{
51 const BOARD_STACKUP_ITEM* item = ItemForLayer( aLayer );
52
53 if( !item )
54 return wxString();
55
56 wxString color = item->GetColor();
57
58 if( !IsPrmSpecified( color ) || color.StartsWith( wxS( "#" ) ) )
59 return wxString();
60
61 return color.Lower();
62}
bool IsPrmSpecified(const wxString &aPrmValue)
Manage one layer needed to make a physical board.
wxString GetColor(int aDielectricSubLayer=0) const
Information pertinent to a Pcbnew printed circuit board.
Definition board.h:410
BOARD_DESIGN_SETTINGS & GetDesignSettings() const
Definition board.cpp:1301
BOARD_STACKUP m_stackup
Definition fab_stackup.h:45
FAB_STACKUP(const BOARD &aBoard)
const BOARD_STACKUP_ITEM * ItemForLayer(PCB_LAYER_ID aLayer) const
wxString NamedColor(PCB_LAYER_ID aLayer) const
Lower case color name of the layer, empty for an unset or hex color.
PCB_LAYER_ID
A quick note on layer IDs:
Definition layer_ids.h:56
@ UNDEFINED_LAYER
Definition layer_ids.h:57