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, dick@softplc.com
5  * Copyright (C) 2018-2020 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 
30 class PCB_BASE_FRAME;
31 class DRC_RULE;
32 class DRC_TEST_PROVIDER;
33 
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_TRACKS_CROSSING, // tracks are crossing
42  DRCE_EDGE_CLEARANCE, // a copper item is too close to the board edge
43  DRCE_ZONES_INTERSECT, // copper area outlines intersect
44  DRCE_ZONE_HAS_EMPTY_NET, // copper area has a net but no pads in nets, which is suspicious
45  DRCE_DANGLING_VIA, // via which isn't connected to anything
46  DRCE_DANGLING_TRACK, // track with at least one end not connected to anything
47  DRCE_DRILLED_HOLES_TOO_CLOSE, // overlapping drilled holes break drill bits
48  DRCE_DRILLED_HOLES_COLOCATED, // two holes at the same location
50  DRCE_TRACK_WIDTH, // Track width is too small or too large
51  DRCE_ANNULAR_WIDTH, // Via size and drill leave annular ring too small
52  DRCE_DRILL_OUT_OF_RANGE, // Too small via or pad drill
53  DRCE_VIA_DIAMETER, // Via diameter checks (min/max)
54  DRCE_PADSTACK, // something is wrong with a pad or via stackup
55  DRCE_MICROVIA_DRILL_OUT_OF_RANGE, // Too small micro via drill
56  DRCE_OVERLAPPING_FOOTPRINTS, // footprint courtyards overlap
57  DRCE_MISSING_COURTYARD, // footprint has no courtyard defined
58  DRCE_MALFORMED_COURTYARD, // footprint has a courtyard but malformed
59  // (not convertible to a closed polygon with holes)
62  DRCE_DISABLED_LAYER_ITEM, // item on a disabled layer
63  DRCE_INVALID_OUTLINE, // invalid board outline
64 
65  DRCE_MISSING_FOOTPRINT, // footprint not found for netlist item
66  DRCE_DUPLICATE_FOOTPRINT, // more than one footprints found for netlist item
67  DRCE_EXTRA_FOOTPRINT, // netlist item not found for footprint
68  DRCE_NET_CONFLICT, // pad net doesn't match netlist
69 
70  DRCE_FOOTPRINT_TYPE_MISMATCH, // footprint attribute does not match actual pads
71  DRCE_PAD_TH_WITH_NO_HOLE, // footprint has Plated Through-Hole with no hole
72 
74  DRCE_SILK_MASK_CLEARANCE, // silkscreen clipped by mask (potentially leaving it
75  // over pads, exposed copper, etc.)
76  DRCE_OVERLAPPING_SILK, // silk to silk clearance error
80 
83 
85 };
86 
87 
88 class DRC_ITEM : public RC_ITEM
89 {
90 public:
95  static std::shared_ptr<DRC_ITEM> Create( int aErrorCode );
96 
103  static std::shared_ptr<DRC_ITEM> Create( const wxString& aErrorKey );
104 
105  static std::vector<std::reference_wrapper<RC_ITEM>> GetItemsWithSeverities()
106  {
107  return allItemTypes;
108  }
109 
110  void SetViolatingRule ( DRC_RULE *aRule ) { m_violatingRule = aRule; }
112 
113  wxString GetViolatingRuleDesc() const override;
114 
115  void SetViolatingTest( DRC_TEST_PROVIDER *aProvider ) { m_violatingTest = aProvider; }
117 
118 private:
119  DRC_ITEM( int aErrorCode = 0, const wxString& aTitle = "", const wxString& aSettingsKey = "" )
120  {
121  m_errorCode = aErrorCode;
122  m_errorTitle = aTitle;
123  m_settingsKey = aSettingsKey;
124  m_parent = nullptr;
125  }
126 
128  static std::vector<std::reference_wrapper<RC_ITEM>> allItemTypes;
129 
135 
177 
178 private:
181 };
182 
183 #endif // DRC_ITEM_H
static DRC_ITEM extraFootprint
Definition: drc_item.h:165
DRC_TEST_PROVIDER * m_violatingTest
Definition: drc_item.h:180
static DRC_ITEM heading_signal_integrity
Definition: drc_item.h:133
void SetViolatingTest(DRC_TEST_PROVIDER *aProvider)
Definition: drc_item.h:115
static DRC_ITEM itemOnDisabledLayer
Definition: drc_item.h:161
static std::shared_ptr< DRC_ITEM > Create(int aErrorCode)
Constructs a DRC_ITEM for the given error code.
Definition: drc_item.cpp:266
static DRC_ITEM heading_electrical
Definition: drc_item.h:130
wxString m_settingsKey
The key used to describe this type of error in settings.
Definition: rc_item.h:169
static DRC_ITEM missingCourtyard
Definition: drc_item.h:157
void SetViolatingRule(DRC_RULE *aRule)
Definition: drc_item.h:110
static DRC_ITEM holesCoLocated
Definition: drc_item.h:148
A holder for a rule check item, DRC in Pcbnew or ERC in Eeschema.
Definition: rc_item.h:74
static DRC_ITEM invalidOutline
Definition: drc_item.h:162
static DRC_ITEM holeNearHole
Definition: drc_item.h:147
static DRC_ITEM silkMaskClearance
Definition: drc_item.h:168
static DRC_ITEM clearance
Definition: drc_item.h:140
static DRC_ITEM heading_schematic_parity
Definition: drc_item.h:132
static DRC_ITEM unconnectedItems
Definition: drc_item.h:136
static DRC_ITEM missingFootprint
Definition: drc_item.h:164
DRC_TEST_PROVIDER * GetViolatingTest() const
Definition: drc_item.h:116
static DRC_ITEM footprintTHPadhasNoHole
Definition: drc_item.h:176
static DRC_ITEM itemsNotAllowed
Definition: drc_item.h:138
PCB_DRC_CODE
Definition: drc_item.h:34
static DRC_ITEM heading_misc
Definition: drc_item.h:134
static DRC_ITEM microviaDrillTooSmall
Definition: drc_item.h:155
wxString GetViolatingRuleDesc() const override
Definition: drc_item.cpp:331
static DRC_ITEM diffPairUncoupledLengthTooLong
Definition: drc_item.h:174
static DRC_ITEM heading_DFM
Definition: drc_item.h:131
int m_errorCode
The error code's numeric value.
Definition: rc_item.h:166
static DRC_ITEM tracksCrossing
Definition: drc_item.h:141
static DRC_ITEM npthInsideCourtyard
Definition: drc_item.h:160
static DRC_ITEM malformedCourtyard
Definition: drc_item.h:158
static DRC_ITEM footprintTypeMismatch
Definition: drc_item.h:175
static DRC_ITEM edgeClearance
Definition: drc_item.h:142
static DRC_ITEM courtyardsOverlap
Definition: drc_item.h:156
static DRC_ITEM shortingItems
Definition: drc_item.h:137
static DRC_ITEM diffPairGapOutOfRange
Definition: drc_item.h:173
static DRC_ITEM drillTooSmall
Definition: drc_item.h:152
static DRC_ITEM duplicateFootprints
Definition: drc_item.h:163
DRC_RULE * m_violatingRule
Definition: drc_item.h:179
static DRC_ITEM textOnEdgeCuts
Definition: drc_item.h:139
static DRC_ITEM zoneHasEmptyNet
Definition: drc_item.h:144
static DRC_ITEM zonesIntersect
Definition: drc_item.h:143
DRC_ITEM(int aErrorCode=0, const wxString &aTitle="", const wxString &aSettingsKey="")
Definition: drc_item.h:119
static DRC_ITEM viaDangling
Definition: drc_item.h:145
Represent a DRC "provider" which runs some DRC functions over a BOARD and spits out #DRC_ITEMs and po...
static DRC_ITEM trackWidth
Definition: drc_item.h:150
MARKER_BASE * m_parent
The marker this item belongs to, if any.
Definition: rc_item.h:170
static DRC_ITEM annularWidth
Definition: drc_item.h:151
DRC_RULE * GetViolatingRule() const
Definition: drc_item.h:111
static DRC_ITEM silkOverlaps
Definition: drc_item.h:169
static DRC_ITEM holeClearance
Definition: drc_item.h:149
static std::vector< std::reference_wrapper< RC_ITEM > > GetItemsWithSeverities()
Definition: drc_item.h:105
static DRC_ITEM trackDangling
Definition: drc_item.h:146
static DRC_ITEM lengthOutOfRange
Definition: drc_item.h:170
static DRC_ITEM tooManyVias
Definition: drc_item.h:172
static DRC_ITEM unresolvedVariable
Definition: drc_item.h:167
static DRC_ITEM viaDiameter
Definition: drc_item.h:153
static DRC_ITEM skewOutOfRange
Definition: drc_item.h:171
Base PCB main window class for Pcbnew, Gerbview, and CvPcb footprint viewer.
static DRC_ITEM netConflict
Definition: drc_item.h:166
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:128
static DRC_ITEM pthInsideCourtyard
Definition: drc_item.h:159
static DRC_ITEM padstack
Definition: drc_item.h:154
wxString m_errorTitle
The string describing the type of error.
Definition: rc_item.h:168