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_CLEARANCE, // items are too close together
40  DRCE_TRACKS_CROSSING, // tracks are crossing
41  DRCE_COPPER_EDGE_CLEARANCE, // a copper item is too close to the board edge
42  DRCE_ZONES_INTERSECT, // copper area outlines intersect
43  DRCE_ZONE_HAS_EMPTY_NET, // copper area has a net but no pads in nets, which is suspicious
44  DRCE_DANGLING_VIA, // via which isn't connected to anything
45  DRCE_DANGLING_TRACK, // track with at least one end not connected to anything
46  DRCE_DRILLED_HOLES_TOO_CLOSE, // overlapping drilled holes break drill bits
48  DRCE_TRACK_WIDTH, // Track width is too small or too large
49  DRCE_ANNULAR_WIDTH, // Via size and drill leave annulus too small or too large
50  DRCE_DRILL_OUT_OF_RANGE, // Too small via or pad drill
51  DRCE_VIA_DIAMETER, // Via diameter checks (min/max)
52  DRCE_PADSTACK, // something is wrong with a pad or via stackup
53  DRCE_MICROVIA_DRILL_OUT_OF_RANGE, // Too small micro via drill
54  DRCE_OVERLAPPING_FOOTPRINTS, // footprint courtyards overlap
55  DRCE_MISSING_COURTYARD, // footprint has no courtyard defined
56  DRCE_MALFORMED_COURTYARD, // footprint has a courtyard but malformed
57  // (not convertible to a closed polygon with holes)
60  DRCE_DISABLED_LAYER_ITEM, // item on a disabled layer
61  DRCE_INVALID_OUTLINE, // invalid board outline
62 
63  DRCE_MISSING_FOOTPRINT, // footprint not found for netlist item
64  DRCE_DUPLICATE_FOOTPRINT, // more than one footprints found for netlist item
65  DRCE_EXTRA_FOOTPRINT, // netlist item not found for footprint
66  DRCE_NET_CONFLICT, // pad net doesn't match netlist
67 
69  DRCE_SILK_MASK_CLEARANCE, // silkscreen clipped by mask (potentially leaving it
70  // over pads, exposed copper, etc.)
71  DRCE_OVERLAPPING_SILK, // silk to silk clearance error
75 
78 
80 };
81 
82 
83 class DRC_ITEM : public RC_ITEM
84 {
85 public:
90  static std::shared_ptr<DRC_ITEM> Create( int aErrorCode );
91 
98  static std::shared_ptr<DRC_ITEM> Create( const wxString& aErrorKey );
99 
100  static std::vector<std::reference_wrapper<RC_ITEM>> GetItemsWithSeverities()
101  {
102  return allItemTypes;
103  }
104 
105  void SetViolatingRule ( DRC_RULE *aRule ) { m_violatingRule = aRule; }
107 
108  void SetViolatingTest( DRC_TEST_PROVIDER *aProvider ) { m_violatingTest = aProvider; }
110 
111 private:
112  DRC_ITEM( int aErrorCode = 0, const wxString& aTitle = "", const wxString& aSettingsKey = "" )
113  {
114  m_errorCode = aErrorCode;
115  m_errorTitle = aTitle;
116  m_settingsKey = aSettingsKey;
117  }
118 
120  static std::vector<std::reference_wrapper<RC_ITEM>> allItemTypes;
121 
127 
165 
166 private:
169 };
170 
171 #endif // DRC_ITEM_H
static DRC_ITEM extraFootprint
Definition: drc_item.h:155
DRC_TEST_PROVIDER * m_violatingTest
Definition: drc_item.h:168
static DRC_ITEM heading_signal_integrity
Definition: drc_item.h:125
void SetViolatingTest(DRC_TEST_PROVIDER *aProvider)
Definition: drc_item.h:108
static DRC_ITEM copperEdgeClearance
Definition: drc_item.h:133
static DRC_ITEM itemOnDisabledLayer
Definition: drc_item.h:151
static std::shared_ptr< DRC_ITEM > Create(int aErrorCode)
Constructs a DRC_ITEM for the given error code.
Definition: drc_item.cpp:245
static DRC_ITEM heading_electrical
Definition: drc_item.h:122
wxString m_settingsKey
The key used to describe this type of error in settings.
Definition: rc_item.h:179
static DRC_ITEM missingCourtyard
Definition: drc_item.h:147
void SetViolatingRule(DRC_RULE *aRule)
Definition: drc_item.h:105
A holder for a rule check item, DRC in Pcbnew or ERC in Eeschema.
Definition: rc_item.h:72
static DRC_ITEM invalidOutline
Definition: drc_item.h:152
static DRC_ITEM holeNearHole
Definition: drc_item.h:138
static DRC_ITEM silkMaskClearance
Definition: drc_item.h:158
static DRC_ITEM clearance
Definition: drc_item.h:131
static DRC_ITEM heading_schematic_parity
Definition: drc_item.h:124
static DRC_ITEM unconnectedItems
Definition: drc_item.h:128
static DRC_ITEM missingFootprint
Definition: drc_item.h:154
DRC_TEST_PROVIDER * GetViolatingTest() const
Definition: drc_item.h:109
static DRC_ITEM itemsNotAllowed
Definition: drc_item.h:130
PCB_DRC_CODE
Definition: drc_item.h:34
static DRC_ITEM heading_misc
Definition: drc_item.h:126
static DRC_ITEM microviaDrillTooSmall
Definition: drc_item.h:145
static DRC_ITEM diffPairUncoupledLengthTooLong
Definition: drc_item.h:164
static DRC_ITEM heading_DFM
Definition: drc_item.h:123
int m_errorCode
The error code's numeric value.
Definition: rc_item.h:176
static DRC_ITEM tracksCrossing
Definition: drc_item.h:132
static DRC_ITEM npthInsideCourtyard
Definition: drc_item.h:150
static DRC_ITEM malformedCourtyard
Definition: drc_item.h:148
static DRC_ITEM courtyardsOverlap
Definition: drc_item.h:146
static DRC_ITEM shortingItems
Definition: drc_item.h:129
static DRC_ITEM diffPairGapOutOfRange
Definition: drc_item.h:163
static DRC_ITEM drillTooSmall
Definition: drc_item.h:142
static DRC_ITEM duplicateFootprints
Definition: drc_item.h:153
DRC_RULE * m_violatingRule
Definition: drc_item.h:167
static DRC_ITEM zoneHasEmptyNet
Definition: drc_item.h:135
static DRC_ITEM zonesIntersect
Definition: drc_item.h:134
DRC_ITEM(int aErrorCode=0, const wxString &aTitle="", const wxString &aSettingsKey="")
Definition: drc_item.h:112
static DRC_ITEM viaDangling
Definition: drc_item.h:136
DRC_TEST_PROVIDER is a base class that represents a DRC "provider" which runs some DRC functions over...
static DRC_ITEM trackWidth
Definition: drc_item.h:140
static DRC_ITEM annularWidth
Definition: drc_item.h:141
DRC_RULE * GetViolatingRule() const
Definition: drc_item.h:106
static DRC_ITEM silkOverlaps
Definition: drc_item.h:159
static DRC_ITEM holeClearance
Definition: drc_item.h:139
static std::vector< std::reference_wrapper< RC_ITEM > > GetItemsWithSeverities()
Definition: drc_item.h:100
static DRC_ITEM trackDangling
Definition: drc_item.h:137
static DRC_ITEM lengthOutOfRange
Definition: drc_item.h:160
static DRC_ITEM tooManyVias
Definition: drc_item.h:162
static DRC_ITEM unresolvedVariable
Definition: drc_item.h:157
static DRC_ITEM viaDiameter
Definition: drc_item.h:143
static DRC_ITEM skewOutOfRange
Definition: drc_item.h:161
Base PCB main window class for Pcbnew, Gerbview, and CvPcb footprint viewer.
static DRC_ITEM netConflict
Definition: drc_item.h:156
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:120
static DRC_ITEM pthInsideCourtyard
Definition: drc_item.h:149
static DRC_ITEM padstack
Definition: drc_item.h:144
wxString m_errorTitle
The string describing the type of error.
Definition: rc_item.h:178