KiCad PCB EDA Suite
Loading...
Searching...
No Matches
drc_item.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 (C) 2007 Dick Hollenbeck, [email protected]
5 * Copyright (C) 2018-2022 KiCad Developers, see AUTHORS.txt for contributors.
6 *
7 * This program is free software; you can redistribute it and/or
8 * modify it under the terms of the GNU General Public License
9 * as published by the Free Software Foundation; either version 2
10 * of the License, or (at your option) any later version.
11 *
12 * This program is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 * GNU General Public License for more details.
16 *
17 * You should have received a copy of the GNU General Public License
18 * along with this program; if not, you may find one here:
19 * http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
20 * or you may search the http://www.gnu.org website for the version 2 license,
21 * or you may write to the Free Software Foundation, Inc.,
22 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
23 */
24
25#ifndef DRC_ITEM_H
26#define DRC_ITEM_H
27
28#include <rc_item.h>
29#include <marker_base.h>
30
31class PCB_BASE_FRAME;
32class DRC_RULE;
34class PCB_MARKER;
35class BOARD;
36
39 DRCE_UNCONNECTED_ITEMS = DRCE_FIRST, // items are unconnected
40 DRCE_SHORTING_ITEMS, // items short two nets but are not a net-tie
41 DRCE_ALLOWED_ITEMS, // a disallowed item has been used
42 DRCE_TEXT_ON_EDGECUTS, // text or dimension on Edge.Cuts layer
43 DRCE_CLEARANCE, // items are too close together
44 DRCE_TRACKS_CROSSING, // tracks are crossing
45 DRCE_EDGE_CLEARANCE, // a copper item is too close to the board edge
46 DRCE_ZONES_INTERSECT, // copper zone outlines intersect
47 DRCE_ISOLATED_COPPER, // copper fill with no electrical connections
48 DRCE_STARVED_THERMAL, // insufficient number of thermal spokes connected to zone
49 DRCE_DANGLING_VIA, // via which isn't connected to anything
50 DRCE_DANGLING_TRACK, // track with at least one end not connected to anything
51 DRCE_DRILLED_HOLES_TOO_CLOSE, // overlapping drilled holes break drill bits
52 DRCE_DRILLED_HOLES_COLOCATED, // two holes at the same location
54 DRCE_TRACK_WIDTH, // Track width is too small or too large
55 DRCE_ANNULAR_WIDTH, // Via size and drill leave annular ring too small
56 DRCE_CONNECTION_WIDTH, // Net connection too small
57 DRCE_DRILL_OUT_OF_RANGE, // Too small via or pad drill
58 DRCE_VIA_DIAMETER, // Via diameter checks (min/max)
59 DRCE_PADSTACK, // something is wrong with a pad or via stackup
60 DRCE_MICROVIA_DRILL_OUT_OF_RANGE, // Too small micro via drill
61 DRCE_OVERLAPPING_FOOTPRINTS, // footprint courtyards overlap
62 DRCE_MISSING_COURTYARD, // footprint has no courtyard defined
63 DRCE_MALFORMED_COURTYARD, // footprint has a courtyard but malformed
64 // (not convertible to a closed polygon with holes)
67 DRCE_DISABLED_LAYER_ITEM, // item on a disabled layer
68 DRCE_INVALID_OUTLINE, // invalid board outline
69
70 DRCE_MISSING_FOOTPRINT, // footprint not found for netlist item
71 DRCE_DUPLICATE_FOOTPRINT, // more than one footprints found for netlist item
72 DRCE_EXTRA_FOOTPRINT, // netlist item not found for footprint
73 DRCE_NET_CONFLICT, // pad net doesn't match netlist
74 DRCE_SCHEMATIC_PARITY_ISSUES, // footprint attributes don't match symbol attributes
75
76 DRCE_FOOTPRINT_TYPE_MISMATCH, // footprint attribute does not match actual pads
77 DRCE_LIB_FOOTPRINT_ISSUES, // footprint not found in active libraries
78 DRCE_LIB_FOOTPRINT_MISMATCH, // footprint does not match the current library
79 DRCE_PAD_TH_WITH_NO_HOLE, // footprint has Plated Through-Hole with no hole
80 DRCE_FOOTPRINT, // error in footprint definition
81
83 DRCE_ASSERTION_FAILURE, // user-defined (custom rule) assertion
84
86 DRCE_SOLDERMASK_BRIDGE, // failure to maintain min soldermask web thickness
87 // between copper items with different nets
88
89 DRCE_SILK_CLEARANCE, // silkscreen clipped by mask (potentially leaving it
90 // over pads, exposed copper, etc.)
94 DRCE_OVERLAPPING_SILK, // silk to silk clearance error
95
101
104
105
106class DRC_ITEM : public RC_ITEM
107{
108public:
113 static std::shared_ptr<DRC_ITEM> Create( int aErrorCode );
114
121 static std::shared_ptr<DRC_ITEM> Create( const wxString& aErrorKey );
122
123 static std::vector<std::reference_wrapper<RC_ITEM>> GetItemsWithSeverities()
124 {
125 return allItemTypes;
126 }
127
128 void SetViolatingRule ( DRC_RULE *aRule ) { m_violatingRule = aRule; }
130
131 wxString GetViolatingRuleDesc() const override;
132
133 void SetViolatingTest( DRC_TEST_PROVIDER *aProvider ) { m_violatingTest = aProvider; }
135
136 KIID GetAuxItem2ID() const override;
137 KIID GetAuxItem3ID() const override;
138
139private:
140 DRC_ITEM( int aErrorCode = 0, const wxString& aTitle = "", const wxString& aSettingsKey = "" )
141 {
142 m_errorCode = aErrorCode;
143 m_errorTitle = aTitle;
144 m_settingsKey = aSettingsKey;
145 m_parent = nullptr;
146 }
147
149 static std::vector<std::reference_wrapper<RC_ITEM>> allItemTypes;
150
157
211
212private:
215};
216
217
219{
220public:
223 m_board( aBoard ),
224 m_severities( 0 )
225 {
226 m_markerTypes.push_back( aMarkerType );
227
228 if( otherMarkerType != MARKER_BASE::MARKER_UNSPEC )
229 m_markerTypes.push_back( otherMarkerType );
230 }
231
232 void SetSeverities( int aSeverities ) override;
233
234 int GetCount( int aSeverity = -1 ) const override;
235
236 std::shared_ptr<RC_ITEM> GetItem( int aIndex ) const override;
237
238 void DeleteItem( int aIndex, bool aDeep ) override;
239
240private:
242 std::vector<MARKER_BASE::MARKER_T> m_markerTypes;
243
245 std::vector<PCB_MARKER*> m_filteredMarkers;
246};
247
248
249#endif // DRC_ITEM_H
Information pertinent to a Pcbnew printed circuit board.
Definition: board.h:282
DRC_ITEMS_PROVIDER(BOARD *aBoard, MARKER_BASE::MARKER_T aMarkerType, MARKER_BASE::MARKER_T otherMarkerType=MARKER_BASE::MARKER_UNSPEC)
Definition: drc_item.h:221
void SetSeverities(int aSeverities) override
Definition: drc_item.cpp:441
std::vector< MARKER_BASE::MARKER_T > m_markerTypes
Definition: drc_item.h:242
void DeleteItem(int aIndex, bool aDeep) override
Remove (and optionally deletes) the indexed item from the list.
Definition: drc_item.cpp:486
int GetCount(int aSeverity=-1) const override
Definition: drc_item.cpp:458
std::vector< PCB_MARKER * > m_filteredMarkers
Definition: drc_item.h:245
std::shared_ptr< RC_ITEM > GetItem(int aIndex) const override
Retrieve a RC_ITEM by index.
Definition: drc_item.cpp:478
static DRC_ITEM lengthOutOfRange
Definition: drc_item.h:203
KIID GetAuxItem3ID() const override
Definition: drc_item.cpp:420
static DRC_ITEM viaDiameter
Definition: drc_item.h:177
static DRC_ITEM silkEdgeClearance
Definition: drc_item.h:198
static DRC_ITEM trackWidth
Definition: drc_item.h:174
static DRC_ITEM heading_DFM
Definition: drc_item.h:152
static DRC_ITEM annularWidth
Definition: drc_item.h:175
static DRC_ITEM pthInsideCourtyard
Definition: drc_item.h:183
void SetViolatingRule(DRC_RULE *aRule)
Definition: drc_item.h:128
wxString GetViolatingRuleDesc() const override
Definition: drc_item.cpp:432
static std::vector< std::reference_wrapper< RC_ITEM > > GetItemsWithSeverities()
Definition: drc_item.h:123
static DRC_ITEM netConflict
Definition: drc_item.h:190
static DRC_ITEM copperSliver
Definition: drc_item.h:196
DRC_RULE * GetViolatingRule() const
Definition: drc_item.h:129
static DRC_ITEM holeNearHole
Definition: drc_item.h:170
static DRC_ITEM heading_signal_integrity
Definition: drc_item.h:154
static DRC_ITEM courtyardsOverlap
Definition: drc_item.h:180
static DRC_ITEM textThicknessOutOfRange
Definition: drc_item.h:202
static DRC_ITEM connectionWidth
Definition: drc_item.h:173
static DRC_ITEM footprint
Definition: drc_item.h:208
static DRC_ITEM unresolvedVariable
Definition: drc_item.h:194
static DRC_ITEM assertionFailure
Definition: drc_item.h:195
static DRC_ITEM npthInsideCourtyard
Definition: drc_item.h:184
static std::shared_ptr< DRC_ITEM > Create(int aErrorCode)
Constructs a DRC_ITEM for the given error code.
Definition: drc_item.cpp:331
static DRC_ITEM textOnEdgeCuts
Definition: drc_item.h:161
static std::vector< std::reference_wrapper< RC_ITEM > > allItemTypes
A list of all DRC_ITEM types which are valid error codes.
Definition: drc_item.h:149
static DRC_ITEM zonesIntersect
Definition: drc_item.h:165
static DRC_ITEM starvedThermal
Definition: drc_item.h:167
static DRC_ITEM shortingItems
Definition: drc_item.h:159
static DRC_ITEM tracksCrossing
Definition: drc_item.h:163
static DRC_ITEM missingCourtyard
Definition: drc_item.h:181
static DRC_ITEM skewOutOfRange
Definition: drc_item.h:204
static DRC_ITEM trackDangling
Definition: drc_item.h:169
static DRC_ITEM viaDangling
Definition: drc_item.h:168
static DRC_ITEM drillTooSmall
Definition: drc_item.h:176
static DRC_ITEM holesCoLocated
Definition: drc_item.h:171
static DRC_ITEM missingFootprint
Definition: drc_item.h:188
static DRC_ITEM textHeightOutOfRange
Definition: drc_item.h:201
void SetViolatingTest(DRC_TEST_PROVIDER *aProvider)
Definition: drc_item.h:133
static DRC_ITEM diffPairGapOutOfRange
Definition: drc_item.h:206
static DRC_ITEM schematicParityIssues
Definition: drc_item.h:191
static DRC_ITEM heading_electrical
Definition: drc_item.h:151
static DRC_ITEM padstack
Definition: drc_item.h:178
static DRC_ITEM itemOnDisabledLayer
Definition: drc_item.h:185
static DRC_ITEM heading_readability
Definition: drc_item.h:155
static DRC_ITEM itemsNotAllowed
Definition: drc_item.h:160
DRC_ITEM(int aErrorCode=0, const wxString &aTitle="", const wxString &aSettingsKey="")
Definition: drc_item.h:140
DRC_TEST_PROVIDER * GetViolatingTest() const
Definition: drc_item.h:134
static DRC_ITEM extraFootprint
Definition: drc_item.h:189
static DRC_ITEM diffPairUncoupledLengthTooLong
Definition: drc_item.h:207
KIID GetAuxItem2ID() const override
Definition: drc_item.cpp:408
static DRC_ITEM unconnectedItems
Definition: drc_item.h:158
static DRC_ITEM clearance
Definition: drc_item.h:162
DRC_RULE * m_violatingRule
Definition: drc_item.h:213
static DRC_ITEM libFootprintMismatch
Definition: drc_item.h:193
DRC_TEST_PROVIDER * m_violatingTest
Definition: drc_item.h:214
static DRC_ITEM viaCountOutOfRange
Definition: drc_item.h:205
static DRC_ITEM edgeClearance
Definition: drc_item.h:164
static DRC_ITEM invalidOutline
Definition: drc_item.h:186
static DRC_ITEM silkOverlaps
Definition: drc_item.h:200
static DRC_ITEM isolatedCopper
Definition: drc_item.h:166
static DRC_ITEM malformedCourtyard
Definition: drc_item.h:182
static DRC_ITEM holeClearance
Definition: drc_item.h:172
static DRC_ITEM libFootprintIssues
Definition: drc_item.h:192
static DRC_ITEM heading_schematic_parity
Definition: drc_item.h:153
static DRC_ITEM microviaDrillTooSmall
Definition: drc_item.h:179
static DRC_ITEM solderMaskBridge
Definition: drc_item.h:199
static DRC_ITEM heading_misc
Definition: drc_item.h:156
static DRC_ITEM footprintTypeMismatch
Definition: drc_item.h:209
static DRC_ITEM footprintTHPadhasNoHole
Definition: drc_item.h:210
static DRC_ITEM silkClearance
Definition: drc_item.h:197
static DRC_ITEM duplicateFootprints
Definition: drc_item.h:187
Represent a DRC "provider" which runs some DRC functions over a BOARD and spits out DRC_ITEM and posi...
Definition: kiid.h:49
Base PCB main window class for Pcbnew, Gerbview, and CvPcb footprint viewer.
Provide an abstract interface of a RC_ITEM* list manager.
Definition: rc_item.h:52
A holder for a rule check item, DRC in Pcbnew or ERC in Eeschema.
Definition: rc_item.h:79
wxString m_settingsKey
The key used to describe this type of error in settings.
Definition: rc_item.h:187
int m_errorCode
The error code's numeric value.
Definition: rc_item.h:184
MARKER_BASE * m_parent
The marker this item belongs to, if any.
Definition: rc_item.h:188
wxString m_errorTitle
The string describing the type of error.
Definition: rc_item.h:186
PCB_DRC_CODE
Definition: drc_item.h:37
@ DRCE_DISABLED_LAYER_ITEM
Definition: drc_item.h:67
@ DRCE_SKEW_OUT_OF_RANGE
Definition: drc_item.h:97
@ DRCE_DIFF_PAIR_GAP_OUT_OF_RANGE
Definition: drc_item.h:99
@ DRCE_HOLE_CLEARANCE
Definition: drc_item.h:53
@ DRCE_SILK_EDGE_CLEARANCE
Definition: drc_item.h:91
@ DRCE_ZONES_INTERSECT
Definition: drc_item.h:46
@ DRCE_VIA_DIAMETER
Definition: drc_item.h:58
@ DRCE_UNCONNECTED_ITEMS
Definition: drc_item.h:39
@ DRCE_TRACK_WIDTH
Definition: drc_item.h:54
@ DRCE_PADSTACK
Definition: drc_item.h:59
@ DRCE_LIB_FOOTPRINT_ISSUES
Definition: drc_item.h:77
@ DRCE_OVERLAPPING_FOOTPRINTS
Definition: drc_item.h:61
@ DRCE_INVALID_OUTLINE
Definition: drc_item.h:68
@ DRCE_TEXT_ON_EDGECUTS
Definition: drc_item.h:42
@ DRCE_OVERLAPPING_SILK
Definition: drc_item.h:94
@ DRCE_DRILL_OUT_OF_RANGE
Definition: drc_item.h:57
@ DRCE_EDGE_CLEARANCE
Definition: drc_item.h:45
@ DRCE_STARVED_THERMAL
Definition: drc_item.h:48
@ DRCE_MISSING_COURTYARD
Definition: drc_item.h:62
@ DRCE_CLEARANCE
Definition: drc_item.h:43
@ DRCE_ISOLATED_COPPER
Definition: drc_item.h:47
@ DRCE_DRILLED_HOLES_TOO_CLOSE
Definition: drc_item.h:51
@ DRCE_ALLOWED_ITEMS
Definition: drc_item.h:41
@ DRCE_COPPER_SLIVER
Definition: drc_item.h:85
@ DRCE_PTH_IN_COURTYARD
Definition: drc_item.h:65
@ DRCE_DIFF_PAIR_UNCOUPLED_LENGTH_TOO_LONG
Definition: drc_item.h:100
@ DRCE_MICROVIA_DRILL_OUT_OF_RANGE
Definition: drc_item.h:60
@ DRCE_SHORTING_ITEMS
Definition: drc_item.h:40
@ DRCE_MALFORMED_COURTYARD
Definition: drc_item.h:63
@ DRCE_FIRST
Definition: drc_item.h:38
@ DRCE_DANGLING_VIA
Definition: drc_item.h:49
@ DRCE_UNRESOLVED_VARIABLE
Definition: drc_item.h:82
@ DRCE_FOOTPRINT_TYPE_MISMATCH
Definition: drc_item.h:76
@ DRCE_DUPLICATE_FOOTPRINT
Definition: drc_item.h:71
@ DRCE_DANGLING_TRACK
Definition: drc_item.h:50
@ DRCE_TEXT_HEIGHT
Definition: drc_item.h:92
@ DRCE_ASSERTION_FAILURE
Definition: drc_item.h:83
@ DRCE_SOLDERMASK_BRIDGE
Definition: drc_item.h:86
@ DRCE_DRILLED_HOLES_COLOCATED
Definition: drc_item.h:52
@ DRCE_EXTRA_FOOTPRINT
Definition: drc_item.h:72
@ DRCE_SILK_CLEARANCE
Definition: drc_item.h:89
@ DRCE_LENGTH_OUT_OF_RANGE
Definition: drc_item.h:96
@ DRCE_LAST
Definition: drc_item.h:102
@ DRCE_LIB_FOOTPRINT_MISMATCH
Definition: drc_item.h:78
@ DRCE_NET_CONFLICT
Definition: drc_item.h:73
@ DRCE_MISSING_FOOTPRINT
Definition: drc_item.h:70
@ DRCE_PAD_TH_WITH_NO_HOLE
Definition: drc_item.h:79
@ DRCE_FOOTPRINT
Definition: drc_item.h:80
@ DRCE_TEXT_THICKNESS
Definition: drc_item.h:93
@ DRCE_NPTH_IN_COURTYARD
Definition: drc_item.h:66
@ DRCE_CONNECTION_WIDTH
Definition: drc_item.h:56
@ DRCE_TRACKS_CROSSING
Definition: drc_item.h:44
@ DRCE_VIA_COUNT_OUT_OF_RANGE
Definition: drc_item.h:98
@ DRCE_ANNULAR_WIDTH
Definition: drc_item.h:55
@ DRCE_SCHEMATIC_PARITY_ISSUES
Definition: drc_item.h:74