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_CREEPAGE, // items are too close together ( creepage )
45 DRCE_TRACKS_CROSSING, // tracks are crossing
46 DRCE_EDGE_CLEARANCE, // a copper item is too close to the board edge
47 DRCE_ZONES_INTERSECT, // copper zone outlines intersect
48 DRCE_ISOLATED_COPPER, // copper fill with no electrical connections
49 DRCE_STARVED_THERMAL, // insufficient number of thermal spokes connected to zone
50 DRCE_DANGLING_VIA, // via which isn't connected to anything
51 DRCE_DANGLING_TRACK, // track with at least one end not connected to anything
52 DRCE_DRILLED_HOLES_TOO_CLOSE, // overlapping drilled holes break drill bits
53 DRCE_DRILLED_HOLES_COLOCATED, // two holes at the same location
55 DRCE_TRACK_WIDTH, // Track width is too small or too large
56 DRCE_TRACK_ANGLE, // Angle between two connected tracks is too small or too large
57 DRCE_TRACK_SEGMENT_LENGTH, // Track segment is too short or too long
58 DRCE_ANNULAR_WIDTH, // Via size and drill leave annular ring too small
59 DRCE_CONNECTION_WIDTH, // Net connection too small
60 DRCE_DRILL_OUT_OF_RANGE, // Too small via or pad drill
61 DRCE_VIA_DIAMETER, // Via diameter checks (min/max)
62 DRCE_PADSTACK, // something is questionable with a pad or via stackup
63 DRCE_PADSTACK_INVALID, // something is invalid with a pad or via stackup
64 DRCE_MICROVIA_DRILL_OUT_OF_RANGE, // Too small micro via drill
65 DRCE_OVERLAPPING_FOOTPRINTS, // footprint courtyards overlap
66 DRCE_MISSING_COURTYARD, // footprint has no courtyard defined
67 DRCE_MALFORMED_COURTYARD, // footprint has a courtyard but malformed
68 // (not convertible to a closed polygon with holes)
71 DRCE_DISABLED_LAYER_ITEM, // item on a disabled layer
72 DRCE_INVALID_OUTLINE, // invalid board outline
73
74 DRCE_MISSING_FOOTPRINT, // footprint not found for netlist item
75 DRCE_DUPLICATE_FOOTPRINT, // more than one footprints found for netlist item
76 DRCE_EXTRA_FOOTPRINT, // netlist item not found for footprint
77 DRCE_NET_CONFLICT, // pad net doesn't match netlist
78 DRCE_SCHEMATIC_PARITY, // footprint attributes don't match symbol attributes
79 DRCE_FOOTPRINT_FILTERS, // footprint doesn't match symbol's footprint filters
80
81 DRCE_FOOTPRINT_TYPE_MISMATCH, // footprint attribute does not match actual pads
82 DRCE_LIB_FOOTPRINT_ISSUES, // footprint not found in active libraries
83 DRCE_LIB_FOOTPRINT_MISMATCH, // footprint does not match the current library
84 DRCE_PAD_TH_WITH_NO_HOLE, // footprint has Plated Through-Hole with no hole
85 DRCE_FOOTPRINT, // error in footprint definition
86
88 DRCE_ASSERTION_FAILURE, // user-defined (custom rule) assertion
89 DRCE_GENERIC_WARNING, // generic warning
90 DRCE_GENERIC_ERROR, // generic error
91
93 DRCE_SOLDERMASK_BRIDGE, // failure to maintain min soldermask web thickness
94 // between copper items with different nets
95
96 DRCE_SILK_CLEARANCE, // silkscreen clipped by mask (potentially leaving it
97 // over pads, exposed copper, etc.)
101 DRCE_OVERLAPPING_SILK, // silk to silk clearance error
102
108
111
114
115
116class DRC_ITEM : public RC_ITEM
117{
118public:
123 static std::shared_ptr<DRC_ITEM> Create( int aErrorCode );
124
131 static std::shared_ptr<DRC_ITEM> Create( const wxString& aErrorKey );
132
133 static std::vector<std::reference_wrapper<RC_ITEM>> GetItemsWithSeverities()
134 {
135 static std::vector<std::reference_wrapper<RC_ITEM>> itemsWithSeverities;
136
137 if( itemsWithSeverities.empty() )
138 {
139 for( RC_ITEM& item : allItemTypes )
140 {
141 if( &item == &heading_internal )
142 break;
143
144 itemsWithSeverities.push_back( item );
145 }
146 }
147
148 return itemsWithSeverities;
149 }
150
151 void SetViolatingRule ( DRC_RULE *aRule ) { m_violatingRule = aRule; }
153
154 wxString GetViolatingRuleDesc() const override;
155
156 void SetViolatingTest( DRC_TEST_PROVIDER *aProvider ) { m_violatingTest = aProvider; }
158
159 KIID GetAuxItem2ID() const override;
160 KIID GetAuxItem3ID() const override;
161
162private:
163 DRC_ITEM( int aErrorCode = 0, const wxString& aTitle = "", const wxString& aSettingsKey = "" )
164 {
165 m_errorCode = aErrorCode;
166 m_errorTitle = aTitle;
167 m_settingsKey = aSettingsKey;
168 m_parent = nullptr;
169 }
170
172 static std::vector<std::reference_wrapper<RC_ITEM>> allItemTypes;
173
181
244
245private:
248};
249
250
252{
253public:
256 m_board( aBoard ),
257 m_severities( 0 )
258 {
259 m_markerTypes.push_back( aMarkerType );
260
261 if( otherMarkerType != MARKER_BASE::MARKER_UNSPEC )
262 m_markerTypes.push_back( otherMarkerType );
263 }
264
265 void SetSeverities( int aSeverities ) override;
266
267 int GetCount( int aSeverity = -1 ) const override;
268
269 std::shared_ptr<RC_ITEM> GetItem( int aIndex ) const override;
270
271 void DeleteItem( int aIndex, bool aDeep ) override;
272
273private:
275 std::vector<MARKER_BASE::MARKER_T> m_markerTypes;
276
278 std::vector<PCB_MARKER*> m_filteredMarkers;
279};
280
281
282#endif // DRC_ITEM_H
Information pertinent to a Pcbnew printed circuit board.
Definition: board.h:290
DRC_ITEMS_PROVIDER(BOARD *aBoard, MARKER_BASE::MARKER_T aMarkerType, MARKER_BASE::MARKER_T otherMarkerType=MARKER_BASE::MARKER_UNSPEC)
Definition: drc_item.h:254
void SetSeverities(int aSeverities) override
Definition: drc_item.cpp:501
std::vector< MARKER_BASE::MARKER_T > m_markerTypes
Definition: drc_item.h:275
void DeleteItem(int aIndex, bool aDeep) override
Remove (and optionally deletes) the indexed item from the list.
Definition: drc_item.cpp:546
int GetCount(int aSeverity=-1) const override
Definition: drc_item.cpp:518
std::vector< PCB_MARKER * > m_filteredMarkers
Definition: drc_item.h:278
std::shared_ptr< RC_ITEM > GetItem(int aIndex) const override
Retrieve a RC_ITEM by index.
Definition: drc_item.cpp:538
static DRC_ITEM nonMirroredTextOnBackLayer
Definition: drc_item.h:243
static DRC_ITEM lengthOutOfRange
Definition: drc_item.h:234
KIID GetAuxItem3ID() const override
Definition: drc_item.cpp:480
static DRC_ITEM viaDiameter
Definition: drc_item.h:204
static DRC_ITEM silkEdgeClearance
Definition: drc_item.h:229
static DRC_ITEM trackWidth
Definition: drc_item.h:199
static DRC_ITEM heading_DFM
Definition: drc_item.h:175
static DRC_ITEM annularWidth
Definition: drc_item.h:202
static DRC_ITEM pthInsideCourtyard
Definition: drc_item.h:211
static DRC_ITEM trackSegmentLength
Definition: drc_item.h:201
void SetViolatingRule(DRC_RULE *aRule)
Definition: drc_item.h:151
static DRC_ITEM schematicParity
Definition: drc_item.h:219
wxString GetViolatingRuleDesc() const override
Definition: drc_item.cpp:492
static std::vector< std::reference_wrapper< RC_ITEM > > GetItemsWithSeverities()
Definition: drc_item.h:133
static DRC_ITEM netConflict
Definition: drc_item.h:218
static DRC_ITEM copperSliver
Definition: drc_item.h:227
DRC_RULE * GetViolatingRule() const
Definition: drc_item.h:152
static DRC_ITEM holeNearHole
Definition: drc_item.h:195
static DRC_ITEM heading_signal_integrity
Definition: drc_item.h:177
static DRC_ITEM courtyardsOverlap
Definition: drc_item.h:208
static DRC_ITEM textThicknessOutOfRange
Definition: drc_item.h:233
static DRC_ITEM connectionWidth
Definition: drc_item.h:198
static DRC_ITEM footprint
Definition: drc_item.h:239
static DRC_ITEM unresolvedVariable
Definition: drc_item.h:223
static DRC_ITEM assertionFailure
Definition: drc_item.h:224
static DRC_ITEM npthInsideCourtyard
Definition: drc_item.h:212
static DRC_ITEM footprintFilters
Definition: drc_item.h:220
static std::shared_ptr< DRC_ITEM > Create(int aErrorCode)
Constructs a DRC_ITEM for the given error code.
Definition: drc_item.cpp:382
static DRC_ITEM textOnEdgeCuts
Definition: drc_item.h:185
static DRC_ITEM creepage
Definition: drc_item.h:187
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:172
static DRC_ITEM zonesIntersect
Definition: drc_item.h:190
static DRC_ITEM starvedThermal
Definition: drc_item.h:192
static DRC_ITEM shortingItems
Definition: drc_item.h:183
static DRC_ITEM tracksCrossing
Definition: drc_item.h:188
static DRC_ITEM missingCourtyard
Definition: drc_item.h:209
static DRC_ITEM skewOutOfRange
Definition: drc_item.h:235
static DRC_ITEM trackDangling
Definition: drc_item.h:194
static DRC_ITEM viaDangling
Definition: drc_item.h:193
static DRC_ITEM genericError
Definition: drc_item.h:226
static DRC_ITEM drillTooSmall
Definition: drc_item.h:203
static DRC_ITEM holesCoLocated
Definition: drc_item.h:196
static DRC_ITEM missingFootprint
Definition: drc_item.h:216
static DRC_ITEM textHeightOutOfRange
Definition: drc_item.h:232
void SetViolatingTest(DRC_TEST_PROVIDER *aProvider)
Definition: drc_item.h:156
static DRC_ITEM diffPairGapOutOfRange
Definition: drc_item.h:237
static DRC_ITEM heading_electrical
Definition: drc_item.h:174
static DRC_ITEM padstack
Definition: drc_item.h:205
static DRC_ITEM itemOnDisabledLayer
Definition: drc_item.h:213
static DRC_ITEM mirroredTextOnFrontLayer
Definition: drc_item.h:242
static DRC_ITEM heading_readability
Definition: drc_item.h:178
static DRC_ITEM itemsNotAllowed
Definition: drc_item.h:184
DRC_ITEM(int aErrorCode=0, const wxString &aTitle="", const wxString &aSettingsKey="")
Definition: drc_item.h:163
DRC_TEST_PROVIDER * GetViolatingTest() const
Definition: drc_item.h:157
static DRC_ITEM extraFootprint
Definition: drc_item.h:217
static DRC_ITEM diffPairUncoupledLengthTooLong
Definition: drc_item.h:238
KIID GetAuxItem2ID() const override
Definition: drc_item.cpp:468
static DRC_ITEM unconnectedItems
Definition: drc_item.h:182
static DRC_ITEM clearance
Definition: drc_item.h:186
DRC_RULE * m_violatingRule
Definition: drc_item.h:246
static DRC_ITEM libFootprintMismatch
Definition: drc_item.h:222
DRC_TEST_PROVIDER * m_violatingTest
Definition: drc_item.h:247
static DRC_ITEM viaCountOutOfRange
Definition: drc_item.h:236
static DRC_ITEM edgeClearance
Definition: drc_item.h:189
static DRC_ITEM genericWarning
Definition: drc_item.h:225
static DRC_ITEM invalidOutline
Definition: drc_item.h:214
static DRC_ITEM silkOverlaps
Definition: drc_item.h:231
static DRC_ITEM isolatedCopper
Definition: drc_item.h:191
static DRC_ITEM malformedCourtyard
Definition: drc_item.h:210
static DRC_ITEM heading_internal
Definition: drc_item.h:180
static DRC_ITEM holeClearance
Definition: drc_item.h:197
static DRC_ITEM libFootprintIssues
Definition: drc_item.h:221
static DRC_ITEM padstackInvalid
Definition: drc_item.h:206
static DRC_ITEM trackAngle
Definition: drc_item.h:200
static DRC_ITEM heading_schematic_parity
Definition: drc_item.h:176
static DRC_ITEM microviaDrillTooSmall
Definition: drc_item.h:207
static DRC_ITEM solderMaskBridge
Definition: drc_item.h:230
static DRC_ITEM heading_misc
Definition: drc_item.h:179
static DRC_ITEM footprintTypeMismatch
Definition: drc_item.h:240
static DRC_ITEM footprintTHPadhasNoHole
Definition: drc_item.h:241
static DRC_ITEM silkClearance
Definition: drc_item.h:228
static DRC_ITEM duplicateFootprints
Definition: drc_item.h:215
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:71
@ DRCE_SKEW_OUT_OF_RANGE
Definition: drc_item.h:104
@ DRCE_DIFF_PAIR_GAP_OUT_OF_RANGE
Definition: drc_item.h:106
@ DRCE_CREEPAGE
Definition: drc_item.h:44
@ DRCE_HOLE_CLEARANCE
Definition: drc_item.h:54
@ DRCE_SILK_EDGE_CLEARANCE
Definition: drc_item.h:98
@ DRCE_ZONES_INTERSECT
Definition: drc_item.h:47
@ DRCE_FOOTPRINT_FILTERS
Definition: drc_item.h:79
@ DRCE_VIA_DIAMETER
Definition: drc_item.h:61
@ DRCE_UNCONNECTED_ITEMS
Definition: drc_item.h:39
@ DRCE_TRACK_WIDTH
Definition: drc_item.h:55
@ DRCE_PADSTACK
Definition: drc_item.h:62
@ DRCE_MIRRORED_TEXT_ON_FRONT_LAYER
Definition: drc_item.h:109
@ DRCE_LIB_FOOTPRINT_ISSUES
Definition: drc_item.h:82
@ DRCE_OVERLAPPING_FOOTPRINTS
Definition: drc_item.h:65
@ DRCE_INVALID_OUTLINE
Definition: drc_item.h:72
@ DRCE_TEXT_ON_EDGECUTS
Definition: drc_item.h:42
@ DRCE_OVERLAPPING_SILK
Definition: drc_item.h:101
@ DRCE_DRILL_OUT_OF_RANGE
Definition: drc_item.h:60
@ DRCE_EDGE_CLEARANCE
Definition: drc_item.h:46
@ DRCE_STARVED_THERMAL
Definition: drc_item.h:49
@ DRCE_TRACK_SEGMENT_LENGTH
Definition: drc_item.h:57
@ DRCE_MISSING_COURTYARD
Definition: drc_item.h:66
@ DRCE_TRACK_ANGLE
Definition: drc_item.h:56
@ DRCE_CLEARANCE
Definition: drc_item.h:43
@ DRCE_ISOLATED_COPPER
Definition: drc_item.h:48
@ DRCE_GENERIC_ERROR
Definition: drc_item.h:90
@ DRCE_DRILLED_HOLES_TOO_CLOSE
Definition: drc_item.h:52
@ DRCE_ALLOWED_ITEMS
Definition: drc_item.h:41
@ DRCE_COPPER_SLIVER
Definition: drc_item.h:92
@ DRCE_PTH_IN_COURTYARD
Definition: drc_item.h:69
@ DRCE_DIFF_PAIR_UNCOUPLED_LENGTH_TOO_LONG
Definition: drc_item.h:107
@ DRCE_MICROVIA_DRILL_OUT_OF_RANGE
Definition: drc_item.h:64
@ DRCE_SHORTING_ITEMS
Definition: drc_item.h:40
@ DRCE_MALFORMED_COURTYARD
Definition: drc_item.h:67
@ DRCE_FIRST
Definition: drc_item.h:38
@ DRCE_DANGLING_VIA
Definition: drc_item.h:50
@ DRCE_PADSTACK_INVALID
Definition: drc_item.h:63
@ DRCE_UNRESOLVED_VARIABLE
Definition: drc_item.h:87
@ DRCE_FOOTPRINT_TYPE_MISMATCH
Definition: drc_item.h:81
@ DRCE_NONMIRRORED_TEXT_ON_BACK_LAYER
Definition: drc_item.h:110
@ DRCE_DUPLICATE_FOOTPRINT
Definition: drc_item.h:75
@ DRCE_DANGLING_TRACK
Definition: drc_item.h:51
@ DRCE_TEXT_HEIGHT
Definition: drc_item.h:99
@ DRCE_ASSERTION_FAILURE
Definition: drc_item.h:88
@ DRCE_SOLDERMASK_BRIDGE
Definition: drc_item.h:93
@ DRCE_DRILLED_HOLES_COLOCATED
Definition: drc_item.h:53
@ DRCE_EXTRA_FOOTPRINT
Definition: drc_item.h:76
@ DRCE_SILK_CLEARANCE
Definition: drc_item.h:96
@ DRCE_LENGTH_OUT_OF_RANGE
Definition: drc_item.h:103
@ DRCE_LAST
Definition: drc_item.h:112
@ DRCE_LIB_FOOTPRINT_MISMATCH
Definition: drc_item.h:83
@ DRCE_NET_CONFLICT
Definition: drc_item.h:77
@ DRCE_MISSING_FOOTPRINT
Definition: drc_item.h:74
@ DRCE_PAD_TH_WITH_NO_HOLE
Definition: drc_item.h:84
@ DRCE_FOOTPRINT
Definition: drc_item.h:85
@ DRCE_GENERIC_WARNING
Definition: drc_item.h:89
@ DRCE_TEXT_THICKNESS
Definition: drc_item.h:100
@ DRCE_NPTH_IN_COURTYARD
Definition: drc_item.h:70
@ DRCE_CONNECTION_WIDTH
Definition: drc_item.h:59
@ DRCE_SCHEMATIC_PARITY
Definition: drc_item.h:78
@ DRCE_TRACKS_CROSSING
Definition: drc_item.h:45
@ DRCE_VIA_COUNT_OUT_OF_RANGE
Definition: drc_item.h:105
@ DRCE_ANNULAR_WIDTH
Definition: drc_item.h:58