KiCad PCB EDA Suite
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
75 DRCE_FOOTPRINT_TYPE_MISMATCH, // footprint attribute does not match actual pads
76 DRCE_LIB_FOOTPRINT_ISSUES, // footprint not found in active libraries
77 DRCE_LIB_FOOTPRINT_MISMATCH, // footprint does not match the current library
78 DRCE_PAD_TH_WITH_NO_HOLE, // footprint has Plated Through-Hole with no hole
79 DRCE_FOOTPRINT, // error in footprint definition
80
82 DRCE_ASSERTION_FAILURE, // user-defined (custom rule) assertion
83
85 DRCE_SOLDERMASK_BRIDGE, // failure to maintain min soldermask web thickness
86 // between copper items with different nets
87
88 DRCE_SILK_CLEARANCE, // silkscreen clipped by mask (potentially leaving it
89 // over pads, exposed copper, etc.)
93 DRCE_OVERLAPPING_SILK, // silk to silk clearance error
94
100
103
104
105class DRC_ITEM : public RC_ITEM
106{
107public:
112 static std::shared_ptr<DRC_ITEM> Create( int aErrorCode );
113
120 static std::shared_ptr<DRC_ITEM> Create( const wxString& aErrorKey );
121
122 static std::vector<std::reference_wrapper<RC_ITEM>> GetItemsWithSeverities()
123 {
124 return allItemTypes;
125 }
126
127 void SetViolatingRule ( DRC_RULE *aRule ) { m_violatingRule = aRule; }
129
130 wxString GetViolatingRuleDesc() const override;
131
132 void SetViolatingTest( DRC_TEST_PROVIDER *aProvider ) { m_violatingTest = aProvider; }
134
135 KIID GetAuxItem2ID() const override;
136 KIID GetAuxItem3ID() const override;
137
138private:
139 DRC_ITEM( int aErrorCode = 0, const wxString& aTitle = "", const wxString& aSettingsKey = "" )
140 {
141 m_errorCode = aErrorCode;
142 m_errorTitle = aTitle;
143 m_settingsKey = aSettingsKey;
144 m_parent = nullptr;
145 }
146
148 static std::vector<std::reference_wrapper<RC_ITEM>> allItemTypes;
149
156
209
210private:
213};
214
215
217{
218public:
221 m_board( aBoard ),
222 m_severities( 0 )
223 {
224 m_markerTypes.push_back( aMarkerType );
225
226 if( otherMarkerType != MARKER_BASE::MARKER_UNSPEC )
227 m_markerTypes.push_back( otherMarkerType );
228 }
229
230 void SetSeverities( int aSeverities ) override;
231
232 int GetCount( int aSeverity = -1 ) const override;
233
234 std::shared_ptr<RC_ITEM> GetItem( int aIndex ) const override;
235
236 void DeleteItem( int aIndex, bool aDeep ) override;
237
238private:
240 std::vector<MARKER_BASE::TYPEMARKER> m_markerTypes;
241
243 std::vector<PCB_MARKER*> m_filteredMarkers;
244};
245
246
247#endif // DRC_ITEM_H
Information pertinent to a Pcbnew printed circuit board.
Definition: board.h:265
void SetSeverities(int aSeverities) override
Definition: drc_item.cpp:434
DRC_ITEMS_PROVIDER(BOARD *aBoard, MARKER_BASE::TYPEMARKER aMarkerType, MARKER_BASE::TYPEMARKER otherMarkerType=MARKER_BASE::MARKER_UNSPEC)
Definition: drc_item.h:219
void DeleteItem(int aIndex, bool aDeep) override
Remove (and optionally deletes) the indexed item from the list.
Definition: drc_item.cpp:479
int GetCount(int aSeverity=-1) const override
Definition: drc_item.cpp:451
std::vector< PCB_MARKER * > m_filteredMarkers
Definition: drc_item.h:243
std::vector< MARKER_BASE::TYPEMARKER > m_markerTypes
Definition: drc_item.h:240
std::shared_ptr< RC_ITEM > GetItem(int aIndex) const override
Retrieve a RC_ITEM by index.
Definition: drc_item.cpp:471
static DRC_ITEM lengthOutOfRange
Definition: drc_item.h:201
KIID GetAuxItem3ID() const override
Definition: drc_item.cpp:413
static DRC_ITEM viaDiameter
Definition: drc_item.h:176
static DRC_ITEM silkEdgeClearance
Definition: drc_item.h:196
static DRC_ITEM trackWidth
Definition: drc_item.h:173
static DRC_ITEM heading_DFM
Definition: drc_item.h:151
static DRC_ITEM annularWidth
Definition: drc_item.h:174
static DRC_ITEM pthInsideCourtyard
Definition: drc_item.h:182
void SetViolatingRule(DRC_RULE *aRule)
Definition: drc_item.h:127
wxString GetViolatingRuleDesc() const override
Definition: drc_item.cpp:425
static std::vector< std::reference_wrapper< RC_ITEM > > GetItemsWithSeverities()
Definition: drc_item.h:122
static DRC_ITEM netConflict
Definition: drc_item.h:189
static DRC_ITEM copperSliver
Definition: drc_item.h:194
DRC_RULE * GetViolatingRule() const
Definition: drc_item.h:128
static DRC_ITEM holeNearHole
Definition: drc_item.h:169
static DRC_ITEM heading_signal_integrity
Definition: drc_item.h:153
static DRC_ITEM courtyardsOverlap
Definition: drc_item.h:179
static DRC_ITEM textThicknessOutOfRange
Definition: drc_item.h:200
static DRC_ITEM tooManyVias
Definition: drc_item.h:203
static DRC_ITEM connectionWidth
Definition: drc_item.h:172
static DRC_ITEM footprint
Definition: drc_item.h:206
static DRC_ITEM unresolvedVariable
Definition: drc_item.h:192
static DRC_ITEM assertionFailure
Definition: drc_item.h:193
static DRC_ITEM npthInsideCourtyard
Definition: drc_item.h:183
static std::shared_ptr< DRC_ITEM > Create(int aErrorCode)
Constructs a DRC_ITEM for the given error code.
Definition: drc_item.cpp:325
static DRC_ITEM textOnEdgeCuts
Definition: drc_item.h:160
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:148
static DRC_ITEM zonesIntersect
Definition: drc_item.h:164
static DRC_ITEM starvedThermal
Definition: drc_item.h:166
static DRC_ITEM shortingItems
Definition: drc_item.h:158
static DRC_ITEM tracksCrossing
Definition: drc_item.h:162
static DRC_ITEM missingCourtyard
Definition: drc_item.h:180
static DRC_ITEM skewOutOfRange
Definition: drc_item.h:202
static DRC_ITEM trackDangling
Definition: drc_item.h:168
static DRC_ITEM viaDangling
Definition: drc_item.h:167
static DRC_ITEM drillTooSmall
Definition: drc_item.h:175
static DRC_ITEM holesCoLocated
Definition: drc_item.h:170
static DRC_ITEM missingFootprint
Definition: drc_item.h:187
static DRC_ITEM textHeightOutOfRange
Definition: drc_item.h:199
void SetViolatingTest(DRC_TEST_PROVIDER *aProvider)
Definition: drc_item.h:132
static DRC_ITEM diffPairGapOutOfRange
Definition: drc_item.h:204
static DRC_ITEM heading_electrical
Definition: drc_item.h:150
static DRC_ITEM padstack
Definition: drc_item.h:177
static DRC_ITEM itemOnDisabledLayer
Definition: drc_item.h:184
static DRC_ITEM heading_readability
Definition: drc_item.h:154
static DRC_ITEM itemsNotAllowed
Definition: drc_item.h:159
DRC_ITEM(int aErrorCode=0, const wxString &aTitle="", const wxString &aSettingsKey="")
Definition: drc_item.h:139
DRC_TEST_PROVIDER * GetViolatingTest() const
Definition: drc_item.h:133
static DRC_ITEM extraFootprint
Definition: drc_item.h:188
static DRC_ITEM diffPairUncoupledLengthTooLong
Definition: drc_item.h:205
KIID GetAuxItem2ID() const override
Definition: drc_item.cpp:401
static DRC_ITEM unconnectedItems
Definition: drc_item.h:157
static DRC_ITEM clearance
Definition: drc_item.h:161
DRC_RULE * m_violatingRule
Definition: drc_item.h:211
static DRC_ITEM libFootprintMismatch
Definition: drc_item.h:191
DRC_TEST_PROVIDER * m_violatingTest
Definition: drc_item.h:212
static DRC_ITEM edgeClearance
Definition: drc_item.h:163
static DRC_ITEM invalidOutline
Definition: drc_item.h:185
static DRC_ITEM silkOverlaps
Definition: drc_item.h:198
static DRC_ITEM isolatedCopper
Definition: drc_item.h:165
static DRC_ITEM malformedCourtyard
Definition: drc_item.h:181
static DRC_ITEM holeClearance
Definition: drc_item.h:171
static DRC_ITEM libFootprintIssues
Definition: drc_item.h:190
static DRC_ITEM heading_schematic_parity
Definition: drc_item.h:152
static DRC_ITEM microviaDrillTooSmall
Definition: drc_item.h:178
static DRC_ITEM solderMaskBridge
Definition: drc_item.h:197
static DRC_ITEM heading_misc
Definition: drc_item.h:155
static DRC_ITEM footprintTypeMismatch
Definition: drc_item.h:207
static DRC_ITEM footprintTHPadhasNoHole
Definition: drc_item.h:208
static DRC_ITEM silkClearance
Definition: drc_item.h:195
static DRC_ITEM duplicateFootprints
Definition: drc_item.h:186
Represent a DRC "provider" which runs some DRC functions over a BOARD and spits out #DRC_ITEMs and po...
Definition: kiid.h:47
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:48
A holder for a rule check item, DRC in Pcbnew or ERC in Eeschema.
Definition: rc_item.h:75
wxString m_settingsKey
The key used to describe this type of error in settings.
Definition: rc_item.h:168
int m_errorCode
The error code's numeric value.
Definition: rc_item.h:165
MARKER_BASE * m_parent
The marker this item belongs to, if any.
Definition: rc_item.h:169
wxString m_errorTitle
The string describing the type of error.
Definition: rc_item.h:167
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:96
@ DRCE_DIFF_PAIR_GAP_OUT_OF_RANGE
Definition: drc_item.h:98
@ DRCE_HOLE_CLEARANCE
Definition: drc_item.h:53
@ DRCE_SILK_EDGE_CLEARANCE
Definition: drc_item.h:90
@ DRCE_ZONES_INTERSECT
Definition: drc_item.h:46
@ DRCE_TOO_MANY_VIAS
Definition: drc_item.h:97
@ 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:76
@ 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:93
@ 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:84
@ DRCE_PTH_IN_COURTYARD
Definition: drc_item.h:65
@ DRCE_DIFF_PAIR_UNCOUPLED_LENGTH_TOO_LONG
Definition: drc_item.h:99
@ 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:81
@ DRCE_FOOTPRINT_TYPE_MISMATCH
Definition: drc_item.h:75
@ DRCE_DUPLICATE_FOOTPRINT
Definition: drc_item.h:71
@ DRCE_DANGLING_TRACK
Definition: drc_item.h:50
@ DRCE_TEXT_HEIGHT
Definition: drc_item.h:91
@ DRCE_ASSERTION_FAILURE
Definition: drc_item.h:82
@ DRCE_SOLDERMASK_BRIDGE
Definition: drc_item.h:85
@ DRCE_DRILLED_HOLES_COLOCATED
Definition: drc_item.h:52
@ DRCE_EXTRA_FOOTPRINT
Definition: drc_item.h:72
@ DRCE_SILK_CLEARANCE
Definition: drc_item.h:88
@ DRCE_LENGTH_OUT_OF_RANGE
Definition: drc_item.h:95
@ DRCE_LAST
Definition: drc_item.h:101
@ DRCE_LIB_FOOTPRINT_MISMATCH
Definition: drc_item.h:77
@ 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:78
@ DRCE_FOOTPRINT
Definition: drc_item.h:79
@ DRCE_TEXT_THICKNESS
Definition: drc_item.h:92
@ 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_ANNULAR_WIDTH
Definition: drc_item.h:55