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 The 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, see <https://www.gnu.org/licenses/>.
19 */
20
21#ifndef DRC_ITEM_H
22#define DRC_ITEM_H
23
24#include <rc_item.h>
25#include <marker_base.h>
26
27class PCB_BASE_FRAME;
28class DRC_RULE;
30class PCB_MARKER;
31class BOARD;
32
34{
36 DRCE_UNCONNECTED_ITEMS = DRCE_FIRST, // items are unconnected
37 DRCE_SHORTING_ITEMS, // items short two nets but are not a net-tie
38 DRCE_ALLOWED_ITEMS, // a disallowed item has been used
39 DRCE_TEXT_ON_EDGECUTS, // text or dimension on Edge.Cuts layer
40 DRCE_CLEARANCE, // items are too close together
41 DRCE_CREEPAGE, // items are too close together ( creepage )
42 DRCE_TRACKS_CROSSING, // tracks are crossing
43 DRCE_EDGE_CLEARANCE, // a copper item is too close to the board edge
44 DRCE_ZONES_INTERSECT, // copper zone outlines intersect
45 DRCE_ISOLATED_COPPER, // copper fill with no electrical connections
46 DRCE_STARVED_THERMAL, // insufficient number of thermal spokes connected to zone
47 DRCE_DANGLING_VIA, // via which isn't connected to anything
48 DRCE_DANGLING_TRACK, // track with at least one end not connected to anything
49 DRCE_DRILLED_HOLES_TOO_CLOSE, // overlapping drilled holes break drill bits
50 DRCE_DRILLED_HOLES_COLOCATED, // two holes at the same location
52 DRCE_TRACK_WIDTH, // Track width is too small or too large
53 DRCE_TRACK_ANGLE, // Angle between two connected tracks is too small or too large
54 DRCE_TRACK_SEGMENT_LENGTH, // Track segment is too short or too long
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 questionable with a pad or via stackup
60 DRCE_PADSTACK_INVALID, // something is invalid with a pad or via stackup
61 DRCE_MICROVIA_DRILL_OUT_OF_RANGE, // Too small micro via drill
62 DRCE_OVERLAPPING_FOOTPRINTS, // footprint courtyards overlap
63 DRCE_MISSING_COURTYARD, // footprint has no courtyard defined
64 DRCE_MALFORMED_COURTYARD, // footprint has a courtyard but malformed
65 // (not convertible to a closed polygon with holes)
68 DRCE_DISABLED_LAYER_ITEM, // item on a disabled layer
69 DRCE_INVALID_OUTLINE, // invalid board outline
70
71 DRCE_MISSING_FOOTPRINT, // footprint not found for netlist item
72 DRCE_DUPLICATE_FOOTPRINT, // more than one footprints found for netlist item
73 DRCE_EXTRA_FOOTPRINT, // netlist item not found for footprint
74 DRCE_NET_CONFLICT, // pad net doesn't match netlist
75 DRCE_SCHEMATIC_PARITY, // footprint attributes don't match symbol attributes
76 DRCE_FOOTPRINT_FILTERS, // footprint doesn't match symbol's footprint filters
77
78 DRCE_FOOTPRINT_TYPE_MISMATCH, // footprint attribute does not match actual pads
79 DRCE_LIB_FOOTPRINT_ISSUES, // footprint not found in active libraries
80 DRCE_LIB_FOOTPRINT_MISMATCH, // footprint does not match the current library
81 DRCE_PAD_TH_WITH_NO_HOLE, // footprint has Plated Through-Hole with no hole
82 DRCE_FOOTPRINT, // error in footprint definition
83 DRCE_FOOTPRINT_SCALED_WITH_PADS, // scale != 1 on a footprint that has pads
84
86 DRCE_ASSERTION_FAILURE, // user-defined (custom rule) assertion
87 DRCE_GENERIC_WARNING, // generic warning
88 DRCE_GENERIC_ERROR, // generic error
89
91 DRCE_SOLDERMASK_BRIDGE, // failure to maintain min soldermask web thickness
92 // between copper items with different nets
93
94 DRCE_SILK_MASK_CLEARANCE, // silkscreen clipped by mask (potentially leaving it
95 // over pads, exposed copper, etc.)
97 DRCE_SILK_CLEARANCE, // silk-to-silk or silk-to-other clearance error
100
102 DRCE_NET_CHAIN_STUB_TOO_LONG, // Routed stub on a net chain exceeds the (stub_length max) constraint
103 DRCE_NET_CHAIN_RETURN_PATH_BREAK, // Net chain routed without copper on the required reference layer
108
111
112 DRCE_MISSING_TUNING_PROFILE, // Tuning profile used in net class is not defined
113 DRCE_TUNING_PROFILE_IMPLICIT_RULES, // Pseudo-code for setting severities
114
115 DRCE_TRACK_ON_POST_MACHINED_LAYER, // Track connected to pad/via on post-machined/backdrilled layer
116
117 DRCE_TRACK_NOT_CENTERED_ON_VIA, // Track endpoint within via pad but not at via center
118
119 DRCE_SCHEMATIC_FIELDS_PARITY, // Mismatch with schematic fields
120
122};
123
124
125class DRC_ITEM : public RC_ITEM
126{
127public:
132 static std::shared_ptr<DRC_ITEM> Create( int aErrorCode );
133
140 static std::shared_ptr<DRC_ITEM> Create( const wxString& aErrorKey );
141
142 static std::vector<std::reference_wrapper<RC_ITEM>> GetItemsWithSeverities()
143 {
144 static std::vector<std::reference_wrapper<RC_ITEM>> itemsWithSeveritiesAll;
145
146 if( itemsWithSeveritiesAll.empty() )
147 {
148 for( RC_ITEM& item : allItemTypes )
149 {
150 if( &item == &heading_internal )
151 break;
152
153 itemsWithSeveritiesAll.push_back( item );
154 }
155 }
156
157 return itemsWithSeveritiesAll;
158 }
159
160 void SetViolatingRule ( DRC_RULE *aRule ) { m_violatingRule = aRule; }
162
163 wxString GetViolatingRuleDesc( bool aTranslate ) const override;
164
165 void SetViolatingTest( DRC_TEST_PROVIDER *aProvider ) { m_violatingTest = aProvider; }
167
168 KIID GetAuxItem2ID() const override;
169 KIID GetAuxItem3ID() const override;
170
171private:
172 DRC_ITEM( int aErrorCode = 0, const wxString& aTitle = "", const wxString& aSettingsKey = "" )
173 {
174 m_errorCode = aErrorCode;
175 m_errorTitle = aTitle;
176 m_settingsKey = aSettingsKey;
177 m_parent = nullptr;
178 }
179
181 static std::vector<std::reference_wrapper<RC_ITEM>> allItemTypes;
182
191
262
263private:
266};
267
268
270{
271public:
274 m_board( aBoard ),
275 m_severities( 0 )
276 {
277 m_markerTypes.push_back( aMarkerType );
278
279 if( otherMarkerType != MARKER_BASE::MARKER_UNSPEC )
280 m_markerTypes.push_back( otherMarkerType );
281 }
282
283 // We own at least one list of raw pointers. Don't let the compiler fill in copy c'tors that
284 // will only land us in trouble.
287
288 void SetSeverities( int aSeverities ) override;
289
290 int GetSeverities() const override;
291
292 int GetCount( int aSeverity = -1 ) const override;
293
294 std::shared_ptr<RC_ITEM> GetItem( int aIndex ) const override;
295
296 void DeleteItem( int aIndex, bool aDeep ) override;
297
298private:
300 std::vector<MARKER_BASE::MARKER_T> m_markerTypes;
301
303 std::vector<PCB_MARKER*> m_filteredMarkers;
304};
305
306
307#endif // DRC_ITEM_H
Information pertinent to a Pcbnew printed circuit board.
Definition board.h:372
DRC_ITEMS_PROVIDER(BOARD *aBoard, MARKER_BASE::MARKER_T aMarkerType, MARKER_BASE::MARKER_T otherMarkerType=MARKER_BASE::MARKER_UNSPEC)
Definition drc_item.h:272
void SetSeverities(int aSeverities) override
Definition drc_item.cpp:544
std::vector< MARKER_BASE::MARKER_T > m_markerTypes
Definition drc_item.h:300
void DeleteItem(int aIndex, bool aDeep) override
Remove (and optionally deletes) the indexed item from the list.
Definition drc_item.cpp:602
int GetSeverities() const override
Definition drc_item.cpp:568
int GetCount(int aSeverity=-1) const override
Definition drc_item.cpp:574
std::vector< PCB_MARKER * > m_filteredMarkers
Definition drc_item.h:303
DRC_ITEMS_PROVIDER(const DRC_ITEMS_PROVIDER &)=delete
DRC_ITEMS_PROVIDER & operator=(const DRC_ITEMS_PROVIDER &)=delete
std::shared_ptr< RC_ITEM > GetItem(int aIndex) const override
Retrieve a RC_ITEM by index.
Definition drc_item.cpp:594
static DRC_ITEM nonMirroredTextOnBackLayer
Definition drc_item.h:256
static DRC_ITEM lengthOutOfRange
Definition drc_item.h:244
KIID GetAuxItem3ID() const override
Definition drc_item.cpp:523
static DRC_ITEM viaDiameter
Definition drc_item.h:214
static DRC_ITEM silkEdgeClearance
Definition drc_item.h:239
static DRC_ITEM trackWidth
Definition drc_item.h:209
static DRC_ITEM heading_DFM
Definition drc_item.h:184
static DRC_ITEM annularWidth
Definition drc_item.h:212
static DRC_ITEM pthInsideCourtyard
Definition drc_item.h:221
static DRC_ITEM trackSegmentLength
Definition drc_item.h:211
void SetViolatingRule(DRC_RULE *aRule)
Definition drc_item.h:160
static DRC_ITEM schematicParity
Definition drc_item.h:229
static std::vector< std::reference_wrapper< RC_ITEM > > GetItemsWithSeverities()
Definition drc_item.h:142
static DRC_ITEM netConflict
Definition drc_item.h:228
static DRC_ITEM copperSliver
Definition drc_item.h:237
DRC_RULE * GetViolatingRule() const
Definition drc_item.h:161
static DRC_ITEM trackNotCenteredOnVia
Definition drc_item.h:260
static DRC_ITEM holeNearHole
Definition drc_item.h:205
static DRC_ITEM heading_signal_integrity
Definition drc_item.h:186
static DRC_ITEM courtyardsOverlap
Definition drc_item.h:218
static DRC_ITEM textThicknessOutOfRange
Definition drc_item.h:243
static DRC_ITEM trackOnPostMachinedLayer
Definition drc_item.h:259
static DRC_ITEM connectionWidth
Definition drc_item.h:208
static DRC_ITEM footprint
Definition drc_item.h:251
static DRC_ITEM unresolvedVariable
Definition drc_item.h:233
static DRC_ITEM assertionFailure
Definition drc_item.h:234
static DRC_ITEM npthInsideCourtyard
Definition drc_item.h:222
static DRC_ITEM footprintFilters
Definition drc_item.h:230
static std::shared_ptr< DRC_ITEM > Create(int aErrorCode)
Constructs a DRC_ITEM for the given error code.
Definition drc_item.cpp:417
static DRC_ITEM textOnEdgeCuts
Definition drc_item.h:195
static DRC_ITEM creepage
Definition drc_item.h:197
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:181
static DRC_ITEM zonesIntersect
Definition drc_item.h:200
static DRC_ITEM tuningProfileImplicitRules
Definition drc_item.h:258
static DRC_ITEM starvedThermal
Definition drc_item.h:202
static DRC_ITEM footprintScaledWithPads
Definition drc_item.h:254
static DRC_ITEM heading_deprecated
Definition drc_item.h:190
static DRC_ITEM shortingItems
Definition drc_item.h:193
static DRC_ITEM tracksCrossing
Definition drc_item.h:198
static DRC_ITEM missingCourtyard
Definition drc_item.h:219
static DRC_ITEM skewOutOfRange
Definition drc_item.h:247
static DRC_ITEM trackDangling
Definition drc_item.h:204
static DRC_ITEM netChainStubTooLong
Definition drc_item.h:245
static DRC_ITEM viaDangling
Definition drc_item.h:203
static DRC_ITEM genericError
Definition drc_item.h:236
static DRC_ITEM netChainReturnPathBreak
Definition drc_item.h:246
static DRC_ITEM drillTooSmall
Definition drc_item.h:213
static DRC_ITEM holesCoLocated
Definition drc_item.h:206
static DRC_ITEM missingFootprint
Definition drc_item.h:226
static DRC_ITEM textHeightOutOfRange
Definition drc_item.h:242
void SetViolatingTest(DRC_TEST_PROVIDER *aProvider)
Definition drc_item.h:165
static DRC_ITEM diffPairGapOutOfRange
Definition drc_item.h:249
static DRC_ITEM heading_electrical
Definition drc_item.h:183
static DRC_ITEM padstack
Definition drc_item.h:215
static DRC_ITEM itemOnDisabledLayer
Definition drc_item.h:223
static DRC_ITEM mirroredTextOnFrontLayer
Definition drc_item.h:255
static DRC_ITEM heading_readability
Definition drc_item.h:187
static DRC_ITEM itemsNotAllowed
Definition drc_item.h:194
DRC_ITEM(int aErrorCode=0, const wxString &aTitle="", const wxString &aSettingsKey="")
Definition drc_item.h:172
DRC_TEST_PROVIDER * GetViolatingTest() const
Definition drc_item.h:166
static DRC_ITEM extraFootprint
Definition drc_item.h:227
static DRC_ITEM diffPairUncoupledLengthTooLong
Definition drc_item.h:250
KIID GetAuxItem2ID() const override
Definition drc_item.cpp:511
static DRC_ITEM unconnectedItems
Definition drc_item.h:192
static DRC_ITEM clearance
Definition drc_item.h:196
DRC_RULE * m_violatingRule
Definition drc_item.h:264
static DRC_ITEM missingTuningProfile
Definition drc_item.h:257
static DRC_ITEM libFootprintMismatch
Definition drc_item.h:232
DRC_TEST_PROVIDER * m_violatingTest
Definition drc_item.h:265
static DRC_ITEM viaCountOutOfRange
Definition drc_item.h:248
static DRC_ITEM edgeClearance
Definition drc_item.h:199
static DRC_ITEM silkMaskClearance
Definition drc_item.h:238
static DRC_ITEM genericWarning
Definition drc_item.h:235
static DRC_ITEM schematicFieldsParity
Definition drc_item.h:261
static DRC_ITEM invalidOutline
Definition drc_item.h:224
static DRC_ITEM isolatedCopper
Definition drc_item.h:201
static DRC_ITEM malformedCourtyard
Definition drc_item.h:220
static DRC_ITEM heading_internal
Definition drc_item.h:189
static DRC_ITEM holeClearance
Definition drc_item.h:207
static DRC_ITEM libFootprintIssues
Definition drc_item.h:231
static DRC_ITEM padstackInvalid
Definition drc_item.h:216
static DRC_ITEM trackAngle
Definition drc_item.h:210
static DRC_ITEM heading_schematic_parity
Definition drc_item.h:185
static DRC_ITEM microviaDrillTooSmall
Definition drc_item.h:217
wxString GetViolatingRuleDesc(bool aTranslate) const override
Definition drc_item.cpp:535
static DRC_ITEM solderMaskBridge
Definition drc_item.h:240
static DRC_ITEM heading_misc
Definition drc_item.h:188
static DRC_ITEM footprintTypeMismatch
Definition drc_item.h:252
static DRC_ITEM footprintTHPadhasNoHole
Definition drc_item.h:253
static DRC_ITEM silkClearance
Definition drc_item.h:241
static DRC_ITEM duplicateFootprints
Definition drc_item.h:225
Represent a DRC "provider" which runs some DRC functions over a BOARD and spits out DRC_ITEM and posi...
Definition kiid.h:44
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:51
wxString m_settingsKey
The key used to describe this type of error in settings.
Definition rc_item.h:206
int m_errorCode
The error code's numeric value.
Definition rc_item.h:203
MARKER_BASE * m_parent
The marker this item belongs to, if any.
Definition rc_item.h:207
wxString m_errorTitle
The string describing the type of error.
Definition rc_item.h:205
RC_ITEM()
Definition rc_item.h:84
PCB_DRC_CODE
Definition drc_item.h:34
@ DRCE_DISABLED_LAYER_ITEM
Definition drc_item.h:68
@ DRCE_FOOTPRINT_SCALED_WITH_PADS
Definition drc_item.h:83
@ 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:41
@ DRCE_TUNING_PROFILE_IMPLICIT_RULES
Definition drc_item.h:113
@ DRCE_HOLE_CLEARANCE
Definition drc_item.h:51
@ DRCE_SILK_EDGE_CLEARANCE
Definition drc_item.h:96
@ DRCE_ZONES_INTERSECT
Definition drc_item.h:44
@ DRCE_FOOTPRINT_FILTERS
Definition drc_item.h:76
@ DRCE_SILK_MASK_CLEARANCE
Definition drc_item.h:94
@ DRCE_VIA_DIAMETER
Definition drc_item.h:58
@ DRCE_UNCONNECTED_ITEMS
Definition drc_item.h:36
@ DRCE_TRACK_WIDTH
Definition drc_item.h:52
@ DRCE_PADSTACK
Definition drc_item.h:59
@ DRCE_MIRRORED_TEXT_ON_FRONT_LAYER
Definition drc_item.h:109
@ DRCE_LIB_FOOTPRINT_ISSUES
Definition drc_item.h:79
@ DRCE_OVERLAPPING_FOOTPRINTS
Definition drc_item.h:62
@ DRCE_INVALID_OUTLINE
Definition drc_item.h:69
@ DRCE_TRACK_ON_POST_MACHINED_LAYER
Definition drc_item.h:115
@ DRCE_TEXT_ON_EDGECUTS
Definition drc_item.h:39
@ DRCE_NET_CHAIN_STUB_TOO_LONG
Definition drc_item.h:102
@ DRCE_DRILL_OUT_OF_RANGE
Definition drc_item.h:57
@ DRCE_EDGE_CLEARANCE
Definition drc_item.h:43
@ DRCE_NET_CHAIN_RETURN_PATH_BREAK
Definition drc_item.h:103
@ DRCE_STARVED_THERMAL
Definition drc_item.h:46
@ DRCE_TRACK_SEGMENT_LENGTH
Definition drc_item.h:54
@ DRCE_SCHEMATIC_FIELDS_PARITY
Definition drc_item.h:119
@ DRCE_MISSING_COURTYARD
Definition drc_item.h:63
@ DRCE_TRACK_ANGLE
Definition drc_item.h:53
@ DRCE_TRACK_NOT_CENTERED_ON_VIA
Definition drc_item.h:117
@ DRCE_CLEARANCE
Definition drc_item.h:40
@ DRCE_ISOLATED_COPPER
Definition drc_item.h:45
@ DRCE_GENERIC_ERROR
Definition drc_item.h:88
@ DRCE_MISSING_TUNING_PROFILE
Definition drc_item.h:112
@ DRCE_DRILLED_HOLES_TOO_CLOSE
Definition drc_item.h:49
@ DRCE_ALLOWED_ITEMS
Definition drc_item.h:38
@ DRCE_COPPER_SLIVER
Definition drc_item.h:90
@ DRCE_PTH_IN_COURTYARD
Definition drc_item.h:66
@ DRCE_DIFF_PAIR_UNCOUPLED_LENGTH_TOO_LONG
Definition drc_item.h:107
@ DRCE_MICROVIA_DRILL_OUT_OF_RANGE
Definition drc_item.h:61
@ DRCE_SHORTING_ITEMS
Definition drc_item.h:37
@ DRCE_MALFORMED_COURTYARD
Definition drc_item.h:64
@ DRCE_FIRST
Definition drc_item.h:35
@ DRCE_DANGLING_VIA
Definition drc_item.h:47
@ DRCE_PADSTACK_INVALID
Definition drc_item.h:60
@ DRCE_UNRESOLVED_VARIABLE
Definition drc_item.h:85
@ DRCE_FOOTPRINT_TYPE_MISMATCH
Definition drc_item.h:78
@ DRCE_NONMIRRORED_TEXT_ON_BACK_LAYER
Definition drc_item.h:110
@ DRCE_DUPLICATE_FOOTPRINT
Definition drc_item.h:72
@ DRCE_DANGLING_TRACK
Definition drc_item.h:48
@ DRCE_TEXT_HEIGHT
Definition drc_item.h:98
@ DRCE_ASSERTION_FAILURE
Definition drc_item.h:86
@ DRCE_SOLDERMASK_BRIDGE
Definition drc_item.h:91
@ DRCE_DRILLED_HOLES_COLOCATED
Definition drc_item.h:50
@ DRCE_EXTRA_FOOTPRINT
Definition drc_item.h:73
@ DRCE_SILK_CLEARANCE
Definition drc_item.h:97
@ DRCE_LENGTH_OUT_OF_RANGE
Definition drc_item.h:101
@ DRCE_LAST
Definition drc_item.h:121
@ DRCE_LIB_FOOTPRINT_MISMATCH
Definition drc_item.h:80
@ DRCE_NET_CONFLICT
Definition drc_item.h:74
@ DRCE_MISSING_FOOTPRINT
Definition drc_item.h:71
@ DRCE_PAD_TH_WITH_NO_HOLE
Definition drc_item.h:81
@ DRCE_FOOTPRINT
Definition drc_item.h:82
@ DRCE_GENERIC_WARNING
Definition drc_item.h:87
@ DRCE_TEXT_THICKNESS
Definition drc_item.h:99
@ DRCE_NPTH_IN_COURTYARD
Definition drc_item.h:67
@ DRCE_CONNECTION_WIDTH
Definition drc_item.h:56
@ DRCE_SCHEMATIC_PARITY
Definition drc_item.h:75
@ DRCE_TRACKS_CROSSING
Definition drc_item.h:42
@ DRCE_VIA_COUNT_OUT_OF_RANGE
Definition drc_item.h:105
@ DRCE_ANNULAR_WIDTH
Definition drc_item.h:55