KiCad PCB EDA Suite
Loading...
Searching...
No Matches
pth_hole_size.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
17 * along with this program. If not, see <https://www.gnu.org/licenses/>.
18 */
19
20#pragma once
21
22#include <vector>
23
24#include <wx/string.h>
25
26
27// Sizes used in this file are in nanometers (nm) unless otherwise specified.
28
35
36// How a recommended hole size is chosen from the allowable range: rounded to the nearest
37// multiple of the rounding step, or rounded up to the next multiple.
39{
42};
43
45{
46 PTH_LEAD_SHAPE m_shape = PTH_LEAD_SHAPE::ROUND; // Lead cross-section shape
47 int m_minX = 0; // Smallest X dimension of the lead
48 int m_maxX = 0; // Largest X dimension of the lead
49 int m_minY = 0; // Smallest Y dimension of the lead (rectangular leads only)
50 int m_maxY = 0; // Largest Y dimension of the lead (rectangular leads only)
51};
52
53// The allowable hole size range a standard computes for a given lead. The standard defines
54// the range; choosing a specific (recommended) hole within it is a design decision and is done
55// separately (see ComputeRecommendedPthHoleSize).
57{
58 int m_leadMin = 0; // Effective smallest lead size
59 int m_leadMax = 0; // Effective largest lead size
60 int m_holeMin = 0; // Smallest allowable finished hole
61 int m_holeMax = 0; // Largest allowable finished hole
62};
63
71{
72public:
73 virtual ~PTH_HOLE_SIZE_STANDARD() = default;
74
78 virtual const wxString& GetID() const = 0;
79
83 virtual const wxString& GetDisplayName() const = 0;
84
89 virtual int GetLevelCount() const = 0;
90
95 virtual wxString GetLevelName( int aLevel ) const = 0;
96
102 virtual int GetMinHoleAddend( int aLevel ) const = 0;
103
109 virtual int GetMaxHoleAddend( int aLevel ) const = 0;
110
121 virtual PTH_HOLE_SIZE_RESULT ComputeHoleSize( int aLevel, const PTH_LEAD_DEF& aLead ) const = 0;
122};
123
136int ComputeRecommendedPthHoleSize( const PTH_HOLE_SIZE_RESULT& aRange, int aRoundingStep, PTH_HOLE_ROUNDING aRounding );
137
146const PTH_HOLE_SIZE_STANDARD* FindPthHoleSizeStandard( const wxString& aId );
147
152const std::vector<const PTH_HOLE_SIZE_STANDARD*>& GetPthHoleSizeStandards();
A source of hole size rules for a plated through hole.
virtual const wxString & GetID() const =0
virtual ~PTH_HOLE_SIZE_STANDARD()=default
virtual int GetLevelCount() const =0
virtual const wxString & GetDisplayName() const =0
virtual int GetMaxHoleAddend(int aLevel) const =0
virtual wxString GetLevelName(int aLevel) const =0
virtual PTH_HOLE_SIZE_RESULT ComputeHoleSize(int aLevel, const PTH_LEAD_DEF &aLead) const =0
Compute the allowable hole size range for a lead.
virtual int GetMinHoleAddend(int aLevel) const =0
int ComputeRecommendedPthHoleSize(const PTH_HOLE_SIZE_RESULT &aRange, int aRoundingStep, PTH_HOLE_ROUNDING aRounding)
Choose a recommended hole within an allowable range.
const PTH_HOLE_SIZE_STANDARD * FindPthHoleSizeStandard(const wxString &aId)
Find a hole size standard in the registry by its ID (e.g.
PTH_LEAD_SHAPE
const std::vector< const PTH_HOLE_SIZE_STANDARD * > & GetPthHoleSizeStandards()
PTH_HOLE_ROUNDING
PTH_LEAD_SHAPE m_shape