KiCad PCB EDA Suite
class_drc_item.cpp
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) 2015 KiCad Developers, see change_log.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 
26 /*************************************************/
27 /* class_drc_item.cpp - DRC_ITEM class functions */
28 /*************************************************/
29 #include <fctsys.h>
30 #include <common.h>
31 
32 #include <pcbnew.h>
33 #include <drc_stuff.h>
34 #include <class_drc_item.h>
35 #include <base_units.h>
36 
37 
38 wxString DRC_ITEM::GetErrorText() const
39 {
40  switch( m_ErrorCode )
41  {
43  return wxString( _( "Unconnected pads" ) );
45  return wxString( _( "Track near thru-hole" ) );
47  return wxString( _( "Track near pad" ) );
49  return wxString( _( "Track near via" ) );
50  case DRCE_VIA_NEAR_VIA:
51  return wxString( _( "Via near via" ) );
53  return wxString( _( "Via near track" ) );
54  case DRCE_TRACK_ENDS1:
55  case DRCE_TRACK_ENDS2:
56  case DRCE_TRACK_ENDS3:
57  case DRCE_TRACK_ENDS4:
58  case DRCE_ENDS_PROBLEM1:
59  case DRCE_ENDS_PROBLEM2:
60  case DRCE_ENDS_PROBLEM3:
61  case DRCE_ENDS_PROBLEM4:
62  case DRCE_ENDS_PROBLEM5:
63  return wxString( _( "Two track ends too close" ) );
65  return wxString( _( "Two parallel track segments too close" ) );
67  return wxString( _( "Tracks crossing" ) );
68  case DRCE_PAD_NEAR_PAD1:
69  return wxString( _( "Pad near pad" ) );
71  return wxString( _( "Via hole > diameter" ) );
73  return wxString( _( "Micro Via: incorrect layer pairs (not adjacent)" ) );
75  return wxString( _( "Copper area inside copper area" ) );
77  return wxString( _( "Copper areas intersect or are too close" ) );
78 
80  return wxString( _( "Copper area belongs a net which has no pads. This is strange" ) );
81 
82  case DRCE_HOLE_NEAR_PAD:
83  return wxString( _( "Hole near pad" ) );
85  return wxString( _( "Hole near track" ) );
87  return wxString( _( "Too small track width" ) );
88  case DRCE_TOO_SMALL_VIA:
89  return wxString( _( "Too small via size" ) );
91  return wxString( _( "Too small micro via size" ) );
93  return wxString( _( "Too small via drill" ) );
95  return wxString( _( "Too small micro via drill" ) );
96 
97  // use &lt; since this is text ultimately embedded in HTML
99  return wxString( _( "NetClass Track Width &lt; global limit" ) );
101  return wxString( _( "NetClass Clearance &lt; global limit" ) );
103  return wxString( _( "NetClass Via Dia &lt; global limit" ) );
105  return wxString( _( "NetClass Via Drill &lt; global limit" ) );
107  return wxString( _( "NetClass uVia Dia &lt; global limit" ) );
109  return wxString( _( "NetClass uVia Drill &lt; global limit" ) );
110 
112  return wxString( _( "Via inside a keepout area" ) );
113 
115  return wxString( _( "Track inside a keepout area" ) );
116 
118  return wxString( _( "Pad inside a keepout area" ) );
119 
121  return wxString( _( "Via inside a text" ) );
122 
124  return wxString( _( "Track inside a text" ) );
125 
127  return wxString( _( "Pad inside a text" ) );
128 
130  return wxString( _( "Courtyards overlap" ) );
131 
133  return wxString( _( "Footprint has no courtyard defined" ) );
134 
136  return wxString( _( "Footprint has incorrect courtyard (not a closed shape)" ) );
137 
138  default:
139  return wxString::Format( wxT( "Unknown DRC error code %d" ), m_ErrorCode );
140  }
141 }
142 
143 
144 wxString DRC_ITEM::ShowCoord( const wxPoint& aPos )
145 {
146  wxString ret;
147 
148  ret << aPos;
149  return ret;
150 }
#define DRCE_HOLE_NEAR_TRACK
hole too close to track
Definition: drc_stuff.h:65
#define DRCE_SUSPICIOUS_NET_FOR_ZONE_OUTLINE
copper area has a net but no pads in nets, which is suspicious
Definition: drc_stuff.h:63
#define DRCE_NETCLASS_CLEARANCE
netclass has Clearance < board.m_designSettings->m_TrackClearance
Definition: drc_stuff.h:72
#define DRCE_TRACK_SEGMENTS_TOO_CLOSE
2 parallel track segments too close: segm ends between segref ends
Definition: drc_stuff.h:51
Implementation of conversion functions that require both schematic and board internal units...
#define DRCE_PAD_NEAR_PAD1
pad too close to pad
Definition: drc_stuff.h:58
#define DRCE_ENDS_PROBLEM1
track ends are too close
Definition: drc_stuff.h:53
wxString GetErrorText() const
Function GetErrorText returns the string form of a drc error code.
#define DRCE_TRACK_ENDS1
2 parallel track segments too close: fine start point test
Definition: drc_stuff.h:47
#define DRCE_TOO_SMALL_MICROVIA_DRILL
Too small micro via drill.
Definition: drc_stuff.h:70
#define DRCE_TRACK_NEAR_VIA
track too close to via
Definition: drc_stuff.h:44
#define COPPERAREA_CLOSE_TO_COPPERAREA
copper area outlines are too close
Definition: drc_stuff.h:62
#define DRCE_MISSING_COURTYARD_IN_FOOTPRINT
footprint has no courtyard defined
Definition: drc_stuff.h:84
#define DRCE_VIA_INSIDE_TEXT
Via in inside a text area.
Definition: drc_stuff.h:80
#define DRCE_TRACKS_CROSSING
tracks are crossing
Definition: drc_stuff.h:52
#define DRCE_PAD_INSIDE_TEXT
Pad in inside a text area.
Definition: drc_stuff.h:82
#define DRCE_ENDS_PROBLEM2
track ends are too close
Definition: drc_stuff.h:54
#define DRCE_TOO_SMALL_MICROVIA
Too small micro via size.
Definition: drc_stuff.h:68
#define DRCE_TRACK_INSIDE_KEEPOUT
Track in inside a keepout area.
Definition: drc_stuff.h:78
#define DRCE_ENDS_PROBLEM5
track ends are too close
Definition: drc_stuff.h:57
#define DRCE_TRACK_INSIDE_TEXT
Track in inside a text area.
Definition: drc_stuff.h:81
#define DRCE_NETCLASS_uVIADRILLSIZE
netclass has ViaSize < board.m_designSettings->m_MicroViasMinDrill
Definition: drc_stuff.h:76
#define DRCE_VIA_INSIDE_KEEPOUT
Via in inside a keepout area.
Definition: drc_stuff.h:77
#define DRCE_VIA_NEAR_TRACK
via too close to track
Definition: drc_stuff.h:46
#define DRCE_TRACK_NEAR_PAD
pad too close to track
Definition: drc_stuff.h:43
#define DRCE_TOO_SMALL_TRACK_WIDTH
Too small track width.
Definition: drc_stuff.h:66
#define DRCE_UNCONNECTED_PADS
pads are unconnected
Definition: drc_stuff.h:41
#define DRCE_NETCLASS_uVIASIZE
netclass has ViaSize < board.m_designSettings->m_MicroViasMinSize
Definition: drc_stuff.h:75
#define DRCE_OVERLAPPING_FOOTPRINTS
footprint courtyards overlap
Definition: drc_stuff.h:83
void Format(OUTPUTFORMATTER *out, int aNestLevel, int aCtl, CPTREE &aTree)
Function Format outputs a PTREE into s-expression format via an OUTPUTFORMATTER derivative.
Definition: ptree.cpp:205
#define DRCE_MALFORMED_COURTYARD_IN_FOOTPRINT
footprint has a courtyard but malformed
Definition: drc_stuff.h:85
#define DRCE_ENDS_PROBLEM3
track ends are too close
Definition: drc_stuff.h:55
#define DRCE_TRACK_ENDS4
2 parallel track segments too close: fine end point test
Definition: drc_stuff.h:50
#define DRCE_NETCLASS_TRACKWIDTH
netclass has TrackWidth < board.m_designSettings->m_TrackMinWidth
Definition: drc_stuff.h:71
#define DRCE_VIA_NEAR_VIA
via too close to via
Definition: drc_stuff.h:45
The common library.
#define DRCE_NETCLASS_VIASIZE
netclass has ViaSize < board.m_designSettings->m_ViasMinSize
Definition: drc_stuff.h:73
#define DRCE_PAD_INSIDE_KEEPOUT
Pad in inside a keepout area.
Definition: drc_stuff.h:79
#define DRCE_TRACK_ENDS2
2 parallel track segments too close: fine start point test
Definition: drc_stuff.h:48
#define DRCE_TRACK_ENDS3
2 parallel track segments too close: fine end point test
Definition: drc_stuff.h:49
#define DRCE_ENDS_PROBLEM4
track ends are too close
Definition: drc_stuff.h:56
#define DRCE_MICRO_VIA_INCORRECT_LAYER_PAIR
micro via's layer pair incorrect (layers must be adjacent)
Definition: drc_stuff.h:60
static wxString ShowCoord(const wxPoint &aPos)
Function ShowCoord formats a coordinate or position to text.
int m_ErrorCode
the error code's numeric value
#define DRCE_TRACK_NEAR_THROUGH_HOLE
thru hole is too close to track
Definition: drc_stuff.h:42
#define COPPERAREA_INSIDE_COPPERAREA
copper area outlines intersect
Definition: drc_stuff.h:61
#define DRCE_HOLE_NEAR_PAD
hole too close to pad
Definition: drc_stuff.h:64
#define DRCE_VIA_HOLE_BIGGER
via's hole is bigger than its diameter
Definition: drc_stuff.h:59
#define DRCE_TOO_SMALL_VIA_DRILL
Too small via drill.
Definition: drc_stuff.h:69
#define DRCE_TOO_SMALL_VIA
Too small via size.
Definition: drc_stuff.h:67
#define DRCE_NETCLASS_VIADRILLSIZE
netclass has ViaDrillSize < board.m_designSettings->m_ViasMinDrill
Definition: drc_stuff.h:74