KiCad PCB EDA Suite
Loading...
Searching...
No Matches
pns_sizes_settings.h
Go to the documentation of this file.
1/*
2 * KiRouter - a push-and-(sometimes-)shove PCB router
3 *
4 * Copyright (C) 2014 CERN
5 * Copyright The KiCad Developers, see AUTHORS.txt for contributors.
6 * Author: Tomasz Wlostowski <[email protected]>
7 *
8 * This program is free software: you can redistribute it and/or modify it
9 * under the terms of the GNU General Public License as published by the
10 * Free Software Foundation, either version 3 of the License, or (at your
11 * option) any later version.
12 *
13 * This program is distributed in the hope that it will be useful, but
14 * WITHOUT ANY WARRANTY; without even the implied warranty of
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
16 * General Public License for more details.
17 *
18 * You should have received a copy of the GNU General Public License
19 * along with this program. If not, see <https://www.gnu.org/licenses/>.
20 */
21
22#ifndef __PNS_SIZES_SETTINGS_H
23#define __PNS_SIZES_SETTINGS_H
24
25#include <algorithm>
26#include <map>
27#include <optional>
28
29#include <wx/string.h>
30
31#include <pcb_track_types.h> // for VIATYPE_T
32
33class BOARD;
35
36namespace PNS {
37
38class ITEM;
39
41{
42public:
44 m_clearance( 0 ),
45 m_minClearance( 0 ),
46 m_trackWidth( 155000 ),
50 m_viaDiameter( 600000 ),
51 m_viaDrill( 250000 ),
52 m_diffPairWidth( 125000 ),
53 m_diffPairGap( 180000 ),
54 m_diffPairViaGap( 180000 ),
56 m_holeToHole( 0 ),
59 {};
60
62
63 void ClearLayerPairs();
64 void AddLayerPair( int aL1, int aL2 );
65
66 // The working clearance, from the current net to anything else (without knowing the net of the
67 // other object). Specific clearance to another object may be resolved differently.
68 int Clearance() const { return m_clearance; }
69 void SetClearance( int aClearance ) { m_clearance = aClearance; }
70
71 // The absolute minimum clearance from the board
72 int MinClearance() const { return m_minClearance; }
73 void SetMinClearance( int aClearance ) { m_minClearance = aClearance; }
74
75 int TrackWidth() const { return m_trackWidth; }
76 void SetTrackWidth( int aWidth ) { m_trackWidth = aWidth; }
77
79 void SetTrackWidthIsExplicit( bool aIsExplicit ) { m_trackWidthIsExplicit = aIsExplicit; }
80
82 void SetBoardMinTrackWidth( int aWidth ) { m_boardMinTrackWidth = aWidth; }
83
84 int DiffPairWidth() const { return m_diffPairWidth; }
85 int DiffPairGap() const { return m_diffPairGap; }
86
91
93
94 void SetDiffPairWidth( int aWidth ) { m_diffPairWidth = aWidth; }
95 void SetDiffPairGap( int aGap ) { m_diffPairGap = aGap; }
96 void SetDiffPairViaGapSameAsTraceGap ( bool aEnable )
97 {
99 }
100
101 void SetDiffPairViaGap( int aGap ) { m_diffPairViaGap = aGap; }
102
103 int ViaDiameter() const { return m_viaDiameter; }
104 void SetViaDiameter( int aDiameter ) { m_viaDiameter = aDiameter; }
105
106 int ViaDrill() const { return m_viaDrill; }
107 void SetViaDrill( int aDrill ) { m_viaDrill = aDrill; }
108
109 std::optional<int> PairedLayer( int aLayerId )
110 {
111 if( m_layerPairs.find(aLayerId) == m_layerPairs.end() )
112 return std::optional<int>();
113
114 return m_layerPairs[aLayerId];
115 }
116
117 int GetLayerTop() const;
118 int GetLayerBottom() const;
119
120 void SetHoleToHole( int aHoleToHole ) { m_holeToHole = aHoleToHole; }
121 int GetHoleToHole() const { return m_holeToHole; }
122
123 void SetViaType( VIATYPE aViaType ) { m_viaType = aViaType; }
124 VIATYPE ViaType() const { return m_viaType; }
125
126 wxString GetClearanceSource() const { return m_clearanceSource; }
127 void SetClearanceSource( const wxString& aSource ) { m_clearanceSource = aSource; }
128
129 wxString GetWidthSource() const { return m_widthSource; }
130 void SetWidthSource( const wxString& aSource ) { m_widthSource = aSource; }
131
133 void SetDiffPairWidthSource( const wxString& aSource ) { m_diffPairWidthSource = aSource; }
134
135 wxString GetDiffPairGapSource() const { return m_diffPairGapSource; }
136 void SetDiffPairGapSource( const wxString& aSource ) { m_diffPairGapSource = aSource; }
137
138 void SetDiffPairHoleToHole( int aHoleToHole ) { m_diffPairHoleToHole = aHoleToHole; }
140
141 void SetDiffPairCopperToHole( int aCopperToHole ) { m_diffPairCopperToHole = aCopperToHole; }
143
144 // Copper-edge-to-copper-edge gap between diff pair vias, accounting for hole-to-hole and
145 // copper-to-hole clearance in addition to the plain copper-to-copper gap.
147 {
148 int annularRing = ( ViaDiameter() - ViaDrill() ) / 2;
149
150 return std::max( { DiffPairViaGap(),
151 GetDiffPairHoleToHole() - 2 * annularRing,
152 GetDiffPairCopperToHole() - annularRing } );
153 }
154
155private:
161
165
170
174
175 std::map<int, int> m_layerPairs;
176
181};
182
183}
184
185#endif // __PNS_SIZES_SETTINGS_H
Container for design settings for a BOARD object.
Information pertinent to a Pcbnew printed circuit board.
Definition board.h:373
Base class for PNS router board items.
Definition pns_item.h:98
void SetViaType(VIATYPE aViaType)
void SetTrackWidth(int aWidth)
void SetBoardMinTrackWidth(int aWidth)
void SetDiffPairViaGapSameAsTraceGap(bool aEnable)
bool DiffPairViaGapSameAsTraceGap() const
void SetDiffPairWidth(int aWidth)
void SetDiffPairCopperToHole(int aCopperToHole)
void SetDiffPairWidthSource(const wxString &aSource)
int GetDiffPairCopperToHole() const
void SetDiffPairGapSource(const wxString &aSource)
std::map< int, int > m_layerPairs
void SetDiffPairGap(int aGap)
void SetHoleToHole(int aHoleToHole)
void SetViaDrill(int aDrill)
wxString GetClearanceSource() const
void SetDiffPairViaGap(int aGap)
wxString GetDiffPairGapSource() const
void SetDiffPairHoleToHole(int aHoleToHole)
void SetMinClearance(int aClearance)
wxString GetDiffPairWidthSource() const
void AddLayerPair(int aL1, int aL2)
void SetClearance(int aClearance)
std::optional< int > PairedLayer(int aLayerId)
bool TrackWidthIsExplicit() const
void SetViaDiameter(int aDiameter)
int GetDiffPairHoleToHole() const
int EffectiveDiffPairViaGap() const
void SetClearanceSource(const wxString &aSource)
wxString GetWidthSource() const
void SetWidthSource(const wxString &aSource)
void SetTrackWidthIsExplicit(bool aIsExplicit)
Push and Shove diff pair dimensions (gap) settings dialog.
Declarations of types for tracks and vias.
VIATYPE