KiCad PCB EDA Suite
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-2020 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 #include <fctsys.h>
27 #include <common.h>
28 #include "wx/html/m_templ.h"
29 #include "wx/html/styleparams.h"
30 #include <drc/drc.h>
31 #include <drc/drc_item.h>
32 #include <class_board.h>
33 
34 
35 wxString DRC_ITEM::GetErrorText() const
36 {
37  switch( m_ErrorCode )
38  {
40  return wxString( _( "Unconnected items" ) );
42  return wxString( _( "Track too close to thru-hole" ) );
44  return wxString( _( "Track too close to pad" ) );
46  return wxString( _( "Track too close to via" ) );
47  case DRCE_VIA_NEAR_VIA:
48  return wxString( _( "Via too close to via" ) );
50  return wxString( _( "Via too close to track" ) );
51  case DRCE_TRACK_ENDS:
52  return wxString( _( "Two track ends too close" ) );
54  return wxString( _( "Two parallel track segments too close" ) );
56  return wxString( _( "Tracks crossing" ) );
58  return wxString( _( "Track too close to copper area" ) );
59  case DRCE_PAD_NEAR_PAD1:
60  return wxString( _( "Pad too close to pad" ) );
62  return wxString( _( "Via hole > diameter" ) );
64  return wxString( _( "Micro Via: incorrect layer pairs (not adjacent)" ) );
66  return wxString( _( "Micro Via: not allowed" ) );
68  return wxString( _( "Buried Via: not allowed" ) );
70  return wxString( _( "Item on a disabled layer" ) );
72  return wxString( _( "Copper area inside copper area" ) );
74  return wxString( _( "Copper areas intersect or are too close" ) );
75 
77  return wxString( _( "Copper area belongs to a net which has no pads" ) );
78 
79  case DRCE_HOLE_NEAR_PAD:
80  return wxString( _( "Hole too close to pad" ) );
82  return wxString( _( "Hole too close to track" ) );
84  return wxString( _( "Track width too small" ) );
85  case DRCE_TOO_SMALL_VIA:
86  return wxString( _( "Via size too small" ) );
88  return wxString( _( "Micro via size too small" ) );
90  return wxString( _( "Via drill too small" ) );
92  return wxString( _( "Micro via drill too small" ) );
94  return wxString( _( "Drilled holes too close together" ) );
96  return wxString( _( "Track too close to board edge" ) );
98  return wxString( _( "Board outline does not form a closed polygon" ) );
99 
100  // use &lt; since this is text ultimately embedded in HTML
102  return wxString( _( "NetClass Track Width < global limit" ) );
104  return wxString( _( "NetClass Clearance < global limit" ) );
106  return wxString( _( "NetClass Via Dia < global limit" ) );
108  return wxString( _( "NetClass Via Drill < global limit" ) );
110  return wxString( _( "NetClass uVia Dia < global limit" ) );
112  return wxString( _( "NetClass uVia Drill < global limit" ) );
113 
115  return wxString( _( "Via inside keepout area" ) );
117  return wxString( _( "Track inside keepout area" ) );
119  return wxString( _( "Pad inside keepout area" ) );
120 
122  return wxString( _( "Via too close to copper item" ) );
124  return wxString( _( "Track too close to copper item" ) );
126  return wxString( _( "Pad too close to copper item" ) );
127 
129  return wxString( _( "Courtyards overlap" ) );
130 
132  return wxString( _( "Footprint has no courtyard defined" ) );
133 
135  return wxString( _( "Footprint has incorrect courtyard (not a closed shape)" ) );
136 
138  return wxString( _( "Duplicate footprints" ) );
140  return wxString( _( "Missing footprint" ) );
142  return wxString( _( "Extra footprint" ) );
143 
144  case DRCE_SHORT:
145  return wxString( _( "Remove track shorting two nets" ) );
146  case DRCE_REDUNDANT_VIA:
147  return wxString( _( "Remove redundant via" ) );
149  return wxString( _( "Remove duplicate track" ) );
150  case DRCE_MERGE_TRACKS:
151  return wxString( _( "Merge co-linear tracks" ) );
152  case DRCE_DANGLING_TRACK:
153  return wxString( _( "Remove dangling track" ) );
154  case DRCE_DANGLING_VIA:
155  return wxString( _( "Remove dangling via" ) );
157  return wxString( _( "Remove zero-length track" ) );
158  case DRCE_TRACK_IN_PAD:
159  return wxString( _( "Remove track inside pad" ) );
160 
161  default:
162  return wxEmptyString;
163  }
164 }
165 
166 
167 wxString escapeHtml( wxString aString )
168 {
169  aString.Replace( wxT("<"), wxT("&lt;") );
170  aString.Replace( wxT(">"), wxT("&gt;") );
171  return aString;
172 }
173 
174 
175 wxString DRC_ITEM::ShowHtml( EDA_UNITS aUnits ) const
176 {
177  if( m_hasSecondItem )
178  {
179  // an html fragment for the entire message in the listbox. feel free
180  // to add color if you want:
181  return wxString::Format( wxT( "<b>%s</b><br>&nbsp;&nbsp; %s<br>&nbsp;&nbsp; %s" ),
184  escapeHtml( m_AuxText ) );
185  }
186  else
187  {
188  return wxString::Format( wxT( "<b>%s</b><br>&nbsp;&nbsp; %s" ),
190  escapeHtml( m_MainText ) );
191  }
192 }
193 
194 
Definition: drc.h:94
hole too close to track
Definition: drc.h:61
EDA_UNITS
Definition: common.h:184
copper area outlines intersect
Definition: drc.h:57
Too small via size.
Definition: drc.h:63
wxString m_AuxText
Definition: rc_item.h:87
micro vias are not allowed
Definition: drc.h:84
bool m_hasSecondItem
Definition: rc_item.h:90
overlapping drilled holes break drill bits
Definition: drc.h:87
track too close to via
Definition: drc.h:48
Via in inside a keepout area.
Definition: drc.h:73
footprint not found for netlist item
Definition: drc.h:90
more than one footprints found for netlist item
Definition: drc.h:91
wxString escapeHtml(wxString aString)
Definition: drc_item.cpp:167
copper area has a net but no pads in nets, which is suspicious
Definition: drc.h:59
Too small micro via size.
Definition: drc.h:64
via and copper graphic collide or are too close
Definition: drc.h:77
track ends are too close
Definition: drc.h:51
tracks are crossing
Definition: drc.h:53
netclass has Clearance < board.m_designSettings->m_TrackClearance
Definition: drc.h:68
via too close to via
Definition: drc.h:49
wxString GetErrorText() const override
Function GetErrorText returns the string form of a drc error code.
Definition: drc_item.cpp:35
2 parallel track segments too close: segm ends between segref ends
Definition: drc.h:52
footprint has no courtyard defined
Definition: drc.h:81
netlist item not found for footprint
Definition: drc.h:92
track too close to board edge
Definition: drc.h:88
Too small track width.
Definition: drc.h:62
Pad in inside a keepout area.
Definition: drc.h:75
item on a disabled layer
Definition: drc.h:86
pad too close to track
Definition: drc.h:47
invalid board outline
Definition: drc.h:89
netclass has TrackWidth < board.m_designSettings->m_TrackMinWidth
Definition: drc.h:67
thru hole is too close to track
Definition: drc.h:46
wxString m_MainText
Definition: rc_item.h:86
Too small micro via drill.
Definition: drc.h:66
via's hole is bigger than its diameter
Definition: drc.h:55
micro via's layer pair incorrect (layers must be adjacent)
Definition: drc.h:56
wxString ShowHtml(EDA_UNITS aUnits) const
Function ShowHtml translates this object into a fragment of HTML suitable for the wxHtmlListBox class...
Definition: drc_item.cpp:175
Too small via drill.
Definition: drc.h:65
pad and copper graphic collide or are too close
Definition: drc.h:78
netclass has ViaDrillSize < board.m_designSettings->m_ViasMinDrill
Definition: drc.h:70
track & copper graphic collide or are too close
Definition: drc.h:76
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 _(s)
Definition: 3d_actions.cpp:33
Track in inside a keepout area.
Definition: drc.h:74
track & zone collide or are too close together
Definition: drc.h:79
via too close to track
Definition: drc.h:50
items are unconnected
Definition: drc.h:45
The common library.
hole too close to pad
Definition: drc.h:60
footprint courtyards overlap
Definition: drc.h:80
netclass has ViaSize < board.m_designSettings->m_MicroViasMinDrill
Definition: drc.h:72
int m_ErrorCode
Definition: rc_item.h:85
copper area outlines are too close
Definition: drc.h:58
footprint has a courtyard but malformed
Definition: drc.h:82
buried vias are not allowed
Definition: drc.h:85
pad too close to pad
Definition: drc.h:54
netclass has ViaSize < board.m_designSettings->m_ViasMinSize
Definition: drc.h:69
netclass has ViaSize < board.m_designSettings->m_MicroViasMinSize
Definition: drc.h:71