KiCad PCB EDA Suite
Loading...
Searching...
No Matches
pads_layer_mapper.h
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 modify it
7 * under the terms of the GNU General Public License as published by the
8 * Free Software Foundation, either version 3 of the License, or (at your
9 * option) any later version.
10 *
11 * This program is distributed in the hope that it will be useful, but
12 * WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14 * General Public License for more details.
15 *
16 * You should have received a copy of the GNU General Public License along
17 * with this program. If not, see <http://www.gnu.org/licenses/>.
18 */
19
20#ifndef PADS_LAYER_MAPPER_H
21#define PADS_LAYER_MAPPER_H
22
23#include <string>
24#include <map>
25#include <vector>
26
27#include <layer_ids.h>
28#include <lset.h>
30
31
54
55
66
67
82{
83public:
85
91 void SetCopperLayerCount( int aLayerCount );
92
97
104 PADS_LAYER_TYPE GetLayerType( int aPadsLayer ) const;
105
115 PADS_LAYER_TYPE ParseLayerName( const std::string& aLayerName ) const;
116
124 PCB_LAYER_ID GetAutoMapLayer( int aPadsLayer,
126
134
143 std::vector<INPUT_LAYER_DESC> BuildInputLayerDescriptions(
144 const std::vector<PADS_LAYER_INFO>& aLayerInfos ) const;
145
152 void AddLayerNameMapping( const std::string& aName, PADS_LAYER_TYPE aType );
153
157 static std::string LayerTypeToString( PADS_LAYER_TYPE aType );
158
159 // Well-known PADS layer numbers
160 static constexpr int LAYER_PAD_STACK_TOP = -2;
161 static constexpr int LAYER_PAD_STACK_BOTTOM = -1;
162 static constexpr int LAYER_PAD_STACK_INNER = 0;
163
164 // Common PADS layer number ranges
165 static constexpr int LAYER_DRILL_DRAWING = 18;
166 static constexpr int LAYER_DIMENSIONS = 19;
167 static constexpr int LAYER_PLACEMENT_OUTLINE = 20;
168 static constexpr int LAYER_ASSEMBLY_TOP = 21;
169 static constexpr int LAYER_ASSEMBLY_BOTTOM = 22;
170 static constexpr int LAYER_SOLDERMASK_TOP = 25;
171 static constexpr int LAYER_SILKSCREEN_TOP = 26;
172 static constexpr int LAYER_SILKSCREEN_BOTTOM = 27;
173 static constexpr int LAYER_SOLDERMASK_BOTTOM = 28;
174 static constexpr int LAYER_PASTE_TOP = 29;
175 static constexpr int LAYER_PASTE_BOTTOM = 30;
176 static constexpr int LAYER_BOARD_OUTLINE = 1;
177
178private:
180 std::map<std::string, PADS_LAYER_TYPE> m_layerNameMap;
181
182 PCB_LAYER_ID mapInnerCopperLayer( int aPadsLayer ) const;
183 std::string normalizeLayerName( const std::string& aName ) const;
184};
185
186#endif // PADS_LAYER_MAPPER_H
LSET is a set of PCB_LAYER_IDs.
Definition lset.h:37
LSET GetPermittedLayers(PADS_LAYER_TYPE aType) const
Get the permitted KiCad layers for a given PADS layer type.
PADS_LAYER_TYPE ParseLayerName(const std::string &aLayerName) const
Parse a PADS layer name and return its type.
static constexpr int LAYER_ASSEMBLY_TOP
static constexpr int LAYER_SILKSCREEN_BOTTOM
static constexpr int LAYER_PASTE_TOP
static constexpr int LAYER_SILKSCREEN_TOP
PADS_LAYER_TYPE GetLayerType(int aPadsLayer) const
Parse a PADS layer number and return its type.
static constexpr int LAYER_PLACEMENT_OUTLINE
static constexpr int LAYER_SOLDERMASK_TOP
static constexpr int LAYER_ASSEMBLY_BOTTOM
PCB_LAYER_ID mapInnerCopperLayer(int aPadsLayer) const
static constexpr int LAYER_DIMENSIONS
PCB_LAYER_ID GetAutoMapLayer(int aPadsLayer, PADS_LAYER_TYPE aType=PADS_LAYER_TYPE::UNKNOWN) const
Get the suggested KiCad layer for a PADS layer.
static constexpr int LAYER_PAD_STACK_BOTTOM
Pad stack: Bottom copper.
std::string normalizeLayerName(const std::string &aName) const
static constexpr int LAYER_PAD_STACK_TOP
Pad stack: Top copper.
static constexpr int LAYER_PASTE_BOTTOM
static std::string LayerTypeToString(PADS_LAYER_TYPE aType)
Convert a layer type to a human-readable string.
void SetCopperLayerCount(int aLayerCount)
Set the total number of copper layers in the PADS design.
static constexpr int LAYER_PAD_STACK_INNER
Pad stack: Inner copper.
std::map< std::string, PADS_LAYER_TYPE > m_layerNameMap
static constexpr int LAYER_BOARD_OUTLINE
int GetCopperLayerCount() const
Get the current copper layer count.
std::vector< INPUT_LAYER_DESC > BuildInputLayerDescriptions(const std::vector< PADS_LAYER_INFO > &aLayerInfos) const
Build a vector of INPUT_LAYER_DESC from parsed PADS layer information.
void AddLayerNameMapping(const std::string &aName, PADS_LAYER_TYPE aType)
Add or update a layer name to type mapping.
static constexpr int LAYER_DRILL_DRAWING
static constexpr int LAYER_SOLDERMASK_BOTTOM
PCB_LAYER_ID
A quick note on layer IDs:
Definition layer_ids.h:60
PADS_LAYER_TYPE
PADS layer types.
Information about a single PADS layer.
bool required
Whether this layer must be mapped.
PADS_LAYER_TYPE type
Categorized layer type.
std::string name
Layer name as it appears in PADS file.
int padsLayerNum
PADS layer number.