2007-12-10 05:42:42 +00:00
|
|
|
/*
|
2011-09-30 18:15:37 +00:00
|
|
|
* This program source code file is part of KiCad, a free EDA CAD application.
|
2007-12-10 05:42:42 +00:00
|
|
|
*
|
|
|
|
* Copyright (C) 2007 Dick Hollenbeck, dick@softplc.com
|
2018-04-10 10:52:12 +00:00
|
|
|
* Copyright (C) 2015-2018 KiCad Developers, see change_log.txt for contributors.
|
2007-12-10 05:42:42 +00:00
|
|
|
*
|
|
|
|
* This program is free software; you can redistribute it and/or
|
|
|
|
* modify it under the terms of the GNU General Public License
|
|
|
|
* as published by the Free Software Foundation; either version 2
|
|
|
|
* of the License, or (at your option) any later version.
|
|
|
|
*
|
|
|
|
* This program is distributed in the hope that it will be useful,
|
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
* GNU General Public License for more details.
|
|
|
|
*
|
|
|
|
* You should have received a copy of the GNU General Public License
|
|
|
|
* along with this program; if not, you may find one here:
|
|
|
|
* http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
|
|
|
|
* or you may search the http://www.gnu.org website for the version 2 license,
|
|
|
|
* or you may write to the Free Software Foundation, Inc.,
|
|
|
|
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
|
|
|
|
*/
|
|
|
|
|
2008-05-05 19:54:21 +00:00
|
|
|
|
2012-01-23 04:33:36 +00:00
|
|
|
#include <fctsys.h>
|
|
|
|
#include <common.h>
|
2007-12-09 12:59:06 +00:00
|
|
|
|
2012-01-23 04:33:36 +00:00
|
|
|
#include <pcbnew.h>
|
2019-06-03 13:49:17 +00:00
|
|
|
#include <tools/drc.h>
|
2018-01-28 21:02:31 +00:00
|
|
|
#include <drc_item.h>
|
2018-01-28 09:35:33 +00:00
|
|
|
#include <class_board.h>
|
2012-04-27 14:15:11 +00:00
|
|
|
#include <base_units.h>
|
2011-09-23 13:57:12 +00:00
|
|
|
|
2007-12-09 12:59:06 +00:00
|
|
|
|
|
|
|
wxString DRC_ITEM::GetErrorText() const
|
|
|
|
{
|
|
|
|
switch( m_ErrorCode )
|
|
|
|
{
|
2017-03-22 15:47:15 +00:00
|
|
|
case DRCE_UNCONNECTED_ITEMS:
|
|
|
|
return wxString( _( "Unconnected items" ) );
|
2007-12-09 12:59:06 +00:00
|
|
|
case DRCE_TRACK_NEAR_THROUGH_HOLE:
|
2018-08-23 22:41:57 +00:00
|
|
|
return wxString( _( "Track too close to thru-hole" ) );
|
2007-12-09 12:59:06 +00:00
|
|
|
case DRCE_TRACK_NEAR_PAD:
|
2018-08-23 22:41:57 +00:00
|
|
|
return wxString( _( "Track too close to pad" ) );
|
2007-12-09 12:59:06 +00:00
|
|
|
case DRCE_TRACK_NEAR_VIA:
|
2018-08-23 22:41:57 +00:00
|
|
|
return wxString( _( "Track too close to via" ) );
|
2007-12-09 12:59:06 +00:00
|
|
|
case DRCE_VIA_NEAR_VIA:
|
2018-08-23 22:41:57 +00:00
|
|
|
return wxString( _( "Via too close to via" ) );
|
2007-12-09 12:59:06 +00:00
|
|
|
case DRCE_VIA_NEAR_TRACK:
|
2018-08-23 22:41:57 +00:00
|
|
|
return wxString( _( "Via too close to track" ) );
|
2007-12-09 12:59:06 +00:00
|
|
|
case DRCE_TRACK_ENDS1:
|
|
|
|
case DRCE_TRACK_ENDS2:
|
|
|
|
case DRCE_TRACK_ENDS3:
|
|
|
|
case DRCE_TRACK_ENDS4:
|
2008-05-05 19:54:21 +00:00
|
|
|
case DRCE_ENDS_PROBLEM1:
|
2007-12-09 12:59:06 +00:00
|
|
|
case DRCE_ENDS_PROBLEM2:
|
|
|
|
case DRCE_ENDS_PROBLEM3:
|
|
|
|
case DRCE_ENDS_PROBLEM4:
|
|
|
|
case DRCE_ENDS_PROBLEM5:
|
2014-08-13 19:26:31 +00:00
|
|
|
return wxString( _( "Two track ends too close" ) );
|
2013-09-11 15:30:21 +00:00
|
|
|
case DRCE_TRACK_SEGMENTS_TOO_CLOSE:
|
2014-08-13 19:26:31 +00:00
|
|
|
return wxString( _( "Two parallel track segments too close" ) );
|
2007-12-09 12:59:06 +00:00
|
|
|
case DRCE_TRACKS_CROSSING:
|
2014-08-13 19:26:31 +00:00
|
|
|
return wxString( _( "Tracks crossing" ) );
|
2018-08-23 22:41:57 +00:00
|
|
|
case DRCE_TRACK_NEAR_ZONE:
|
|
|
|
return wxString( _( "Track too close to copper area" ) );
|
2007-12-09 12:59:06 +00:00
|
|
|
case DRCE_PAD_NEAR_PAD1:
|
2018-08-23 22:41:57 +00:00
|
|
|
return wxString( _( "Pad too close to pad" ) );
|
2007-12-09 12:59:06 +00:00
|
|
|
case DRCE_VIA_HOLE_BIGGER:
|
2014-08-13 19:26:31 +00:00
|
|
|
return wxString( _( "Via hole > diameter" ) );
|
2008-01-12 20:31:56 +00:00
|
|
|
case DRCE_MICRO_VIA_INCORRECT_LAYER_PAIR:
|
2014-08-13 19:26:31 +00:00
|
|
|
return wxString( _( "Micro Via: incorrect layer pairs (not adjacent)" ) );
|
2018-01-06 23:37:24 +00:00
|
|
|
case DRCE_MICRO_VIA_NOT_ALLOWED:
|
|
|
|
return wxString( _( "Micro Via: not allowed" ) );
|
|
|
|
case DRCE_BURIED_VIA_NOT_ALLOWED:
|
|
|
|
return wxString( _( "Buried Via: not allowed" ) );
|
2018-07-04 08:23:40 +00:00
|
|
|
case DRCE_DISABLED_LAYER_ITEM:
|
|
|
|
return wxString( _( "Item on a disabled layer" ) );
|
2018-08-27 17:34:28 +00:00
|
|
|
case DRCE_ZONES_INTERSECT:
|
2014-08-13 19:26:31 +00:00
|
|
|
return wxString( _( "Copper area inside copper area" ) );
|
2018-08-27 17:34:28 +00:00
|
|
|
case DRCE_ZONES_TOO_CLOSE:
|
2014-08-13 19:26:31 +00:00
|
|
|
return wxString( _( "Copper areas intersect or are too close" ) );
|
2015-01-22 12:06:34 +00:00
|
|
|
|
|
|
|
case DRCE_SUSPICIOUS_NET_FOR_ZONE_OUTLINE:
|
2018-08-23 22:41:57 +00:00
|
|
|
return wxString( _( "Copper area belongs to a net which has no pads" ) );
|
2015-01-22 12:06:34 +00:00
|
|
|
|
2009-03-23 19:54:15 +00:00
|
|
|
case DRCE_HOLE_NEAR_PAD:
|
2018-08-23 22:41:57 +00:00
|
|
|
return wxString( _( "Hole too close to pad" ) );
|
2009-03-23 19:54:15 +00:00
|
|
|
case DRCE_HOLE_NEAR_TRACK:
|
2018-08-23 22:41:57 +00:00
|
|
|
return wxString( _( "Hole too close to track" ) );
|
2009-06-18 13:30:52 +00:00
|
|
|
case DRCE_TOO_SMALL_TRACK_WIDTH:
|
2018-08-23 22:41:57 +00:00
|
|
|
return wxString( _( "Track width too small" ) );
|
2009-06-18 13:30:52 +00:00
|
|
|
case DRCE_TOO_SMALL_VIA:
|
2018-08-23 22:41:57 +00:00
|
|
|
return wxString( _( "Via size too small" ) );
|
2009-06-18 13:30:52 +00:00
|
|
|
case DRCE_TOO_SMALL_MICROVIA:
|
2018-08-23 22:41:57 +00:00
|
|
|
return wxString( _( "Micro via size too small" ) );
|
2016-08-25 01:16:27 +00:00
|
|
|
case DRCE_TOO_SMALL_VIA_DRILL:
|
2018-08-23 22:41:57 +00:00
|
|
|
return wxString( _( "Via drill too small" ) );
|
2016-08-25 01:16:27 +00:00
|
|
|
case DRCE_TOO_SMALL_MICROVIA_DRILL:
|
2018-08-23 22:41:57 +00:00
|
|
|
return wxString( _( "Micro via drill too small" ) );
|
2018-04-14 14:58:01 +00:00
|
|
|
case DRCE_DRILLED_HOLES_TOO_CLOSE:
|
|
|
|
return wxString( _( "Drilled holes too close together" ) );
|
2018-11-28 12:11:43 +00:00
|
|
|
case DRCE_TRACK_NEAR_EDGE:
|
|
|
|
return wxString( _( "Track too close to board edge" ) );
|
|
|
|
case DRCE_INVALID_OUTLINE:
|
|
|
|
return wxString( _( "Board outline does not form a closed polygon" ) );
|
2008-05-05 19:54:21 +00:00
|
|
|
|
2009-09-10 15:22:26 +00:00
|
|
|
// use < since this is text ultimately embedded in HTML
|
|
|
|
case DRCE_NETCLASS_TRACKWIDTH:
|
2014-08-13 19:26:31 +00:00
|
|
|
return wxString( _( "NetClass Track Width < global limit" ) );
|
2009-09-10 15:22:26 +00:00
|
|
|
case DRCE_NETCLASS_CLEARANCE:
|
2014-08-13 19:26:31 +00:00
|
|
|
return wxString( _( "NetClass Clearance < global limit" ) );
|
2009-09-10 15:22:26 +00:00
|
|
|
case DRCE_NETCLASS_VIASIZE:
|
2014-08-13 19:26:31 +00:00
|
|
|
return wxString( _( "NetClass Via Dia < global limit" ) );
|
2009-09-10 15:22:26 +00:00
|
|
|
case DRCE_NETCLASS_VIADRILLSIZE:
|
2014-08-13 19:26:31 +00:00
|
|
|
return wxString( _( "NetClass Via Drill < global limit" ) );
|
2009-09-10 15:22:26 +00:00
|
|
|
case DRCE_NETCLASS_uVIASIZE:
|
2014-08-13 19:26:31 +00:00
|
|
|
return wxString( _( "NetClass uVia Dia < global limit" ) );
|
2009-09-10 15:22:26 +00:00
|
|
|
case DRCE_NETCLASS_uVIADRILLSIZE:
|
2014-08-13 19:26:31 +00:00
|
|
|
return wxString( _( "NetClass uVia Drill < global limit" ) );
|
2008-05-05 19:54:21 +00:00
|
|
|
|
2012-07-13 18:55:29 +00:00
|
|
|
case DRCE_VIA_INSIDE_KEEPOUT:
|
2018-08-23 22:41:57 +00:00
|
|
|
return wxString( _( "Via inside keepout area" ) );
|
2012-07-13 18:55:29 +00:00
|
|
|
case DRCE_TRACK_INSIDE_KEEPOUT:
|
2018-08-23 22:41:57 +00:00
|
|
|
return wxString( _( "Track inside keepout area" ) );
|
2012-07-13 18:55:29 +00:00
|
|
|
case DRCE_PAD_INSIDE_KEEPOUT:
|
2018-08-23 22:41:57 +00:00
|
|
|
return wxString( _( "Pad inside keepout area" ) );
|
2012-07-13 18:55:29 +00:00
|
|
|
|
2018-08-27 13:50:50 +00:00
|
|
|
case DRCE_VIA_NEAR_COPPER:
|
|
|
|
return wxString( _( "Via too close to copper item" ) );
|
|
|
|
case DRCE_TRACK_NEAR_COPPER:
|
|
|
|
return wxString( _( "Track too close to copper item" ) );
|
|
|
|
case DRCE_PAD_NEAR_COPPER:
|
|
|
|
return wxString( _( "Pad too close to copper item" ) );
|
2014-08-13 15:47:02 +00:00
|
|
|
|
2017-03-16 17:09:33 +00:00
|
|
|
case DRCE_OVERLAPPING_FOOTPRINTS:
|
|
|
|
return wxString( _( "Courtyards overlap" ) );
|
|
|
|
|
|
|
|
case DRCE_MISSING_COURTYARD_IN_FOOTPRINT:
|
2017-03-19 15:38:30 +00:00
|
|
|
return wxString( _( "Footprint has no courtyard defined" ) );
|
|
|
|
|
|
|
|
case DRCE_MALFORMED_COURTYARD_IN_FOOTPRINT:
|
2017-03-21 13:49:05 +00:00
|
|
|
return wxString( _( "Footprint has incorrect courtyard (not a closed shape)" ) );
|
2019-03-31 09:37:57 +00:00
|
|
|
|
2019-03-28 19:30:51 +00:00
|
|
|
case DRCE_DUPLICATE_FOOTPRINT:
|
|
|
|
return wxString( _( "Duplicate footprints" ) );
|
|
|
|
case DRCE_MISSING_FOOTPRINT:
|
|
|
|
return wxString( _( "Missing footprint" ) );
|
|
|
|
case DRCE_EXTRA_FOOTPRINT:
|
|
|
|
return wxString( _( "Extra footprint" ) );
|
|
|
|
|
2019-03-31 09:37:57 +00:00
|
|
|
case DRCE_SHORT:
|
|
|
|
return wxString( _( "Remove track shorting two nets" ) );
|
|
|
|
case DRCE_REDUNDANT_VIA:
|
|
|
|
return wxString( _( "Remove redundant via" ) );
|
|
|
|
case DRCE_DUPLICATE_TRACK:
|
|
|
|
return wxString( _( "Remove duplicate track" ) );
|
|
|
|
case DRCE_MERGE_TRACKS:
|
|
|
|
return wxString( _( "Merge co-linear tracks" ) );
|
|
|
|
case DRCE_DANGLING_TRACK:
|
|
|
|
return wxString( _( "Remove dangling track" ) );
|
|
|
|
case DRCE_DANGLING_VIA:
|
|
|
|
return wxString( _( "Remove dangling via" ) );
|
|
|
|
case DRCE_ZERO_LENGTH_TRACK:
|
|
|
|
return wxString( _( "Remove zero-length track" ) );
|
2019-06-01 16:49:33 +00:00
|
|
|
case DRCE_TRACK_IN_PAD:
|
|
|
|
return wxString( _( "Remove track inside pad" ) );
|
2017-03-16 17:09:33 +00:00
|
|
|
|
2007-12-09 12:59:06 +00:00
|
|
|
default:
|
2018-04-10 10:52:12 +00:00
|
|
|
return wxString::Format( _( "Unknown DRC error code %d" ), m_ErrorCode );
|
2007-12-09 12:59:06 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2018-04-10 10:52:12 +00:00
|
|
|
wxString DRC_ITEM::ShowCoord( EDA_UNITS_T aUnits, const wxPoint& aPos )
|
2007-12-09 12:59:06 +00:00
|
|
|
{
|
2018-04-10 10:52:12 +00:00
|
|
|
return wxString::Format( wxT( "@(%s, %s)" ),
|
|
|
|
MessageTextFromValue( aUnits, aPos.x ),
|
|
|
|
MessageTextFromValue( aUnits, aPos.y ) );
|
2007-12-09 12:59:06 +00:00
|
|
|
}
|
2018-01-28 09:35:33 +00:00
|
|
|
|
2018-01-30 14:13:34 +00:00
|
|
|
|
2018-06-15 04:49:50 +00:00
|
|
|
wxString DRC_ITEM::ShowHtml( EDA_UNITS_T aUnits ) const
|
2018-01-30 14:13:34 +00:00
|
|
|
{
|
|
|
|
wxString mainText = m_MainText;
|
|
|
|
// a wxHtmlWindows does not like < and > in the text to display
|
|
|
|
// because these chars have a special meaning in html
|
|
|
|
mainText.Replace( wxT("<"), wxT("<") );
|
|
|
|
mainText.Replace( wxT(">"), wxT(">") );
|
|
|
|
|
|
|
|
wxString errText = GetErrorText();
|
|
|
|
errText.Replace( wxT("<"), wxT("<") );
|
|
|
|
errText.Replace( wxT(">"), wxT(">") );
|
|
|
|
|
|
|
|
|
|
|
|
if( m_noCoordinate )
|
|
|
|
{
|
|
|
|
// omit the coordinate, a NETCLASS has no location
|
2018-04-10 10:52:12 +00:00
|
|
|
return wxString::Format( wxT( "<b>%s</b><br> %s" ),
|
|
|
|
errText,
|
|
|
|
mainText );
|
2018-01-30 14:13:34 +00:00
|
|
|
}
|
|
|
|
else if( m_hasSecondItem )
|
|
|
|
{
|
|
|
|
wxString auxText = m_AuxiliaryText;
|
|
|
|
auxText.Replace( wxT("<"), wxT("<") );
|
|
|
|
auxText.Replace( wxT(">"), wxT(">") );
|
|
|
|
|
|
|
|
// an html fragment for the entire message in the listbox. feel free
|
|
|
|
// to add color if you want:
|
2018-04-10 10:52:12 +00:00
|
|
|
return wxString::Format( wxT( "<b>%s</b><br> %s: %s<br> %s: %s" ),
|
|
|
|
errText,
|
2018-06-15 04:49:50 +00:00
|
|
|
ShowCoord( aUnits, m_MainPosition ),
|
2018-04-10 10:52:12 +00:00
|
|
|
mainText,
|
2018-06-15 04:49:50 +00:00
|
|
|
ShowCoord( aUnits, m_AuxiliaryPosition ),
|
2018-04-10 10:52:12 +00:00
|
|
|
auxText );
|
2018-01-30 14:13:34 +00:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2018-04-10 10:52:12 +00:00
|
|
|
return wxString::Format( wxT( "<b>%s</b><br> %s: %s" ),
|
|
|
|
errText,
|
2018-06-15 04:49:50 +00:00
|
|
|
ShowCoord( aUnits, m_MainPosition ),
|
2018-04-10 10:52:12 +00:00
|
|
|
mainText );
|
2018-01-30 14:13:34 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2018-06-15 04:49:50 +00:00
|
|
|
wxString DRC_ITEM::ShowReport( EDA_UNITS_T aUnits ) const
|
2018-01-30 14:13:34 +00:00
|
|
|
{
|
|
|
|
if( m_hasSecondItem )
|
|
|
|
{
|
2018-04-10 10:52:12 +00:00
|
|
|
return wxString::Format( wxT( "ErrType(%d): %s\n %s: %s\n %s: %s\n" ),
|
|
|
|
m_ErrorCode,
|
|
|
|
GetErrorText(),
|
2018-06-15 04:49:50 +00:00
|
|
|
ShowCoord( aUnits, m_MainPosition ),
|
2018-04-10 10:52:12 +00:00
|
|
|
m_MainText,
|
2018-06-15 04:49:50 +00:00
|
|
|
ShowCoord( aUnits, m_AuxiliaryPosition ),
|
2018-04-10 10:52:12 +00:00
|
|
|
m_AuxiliaryText );
|
2018-01-30 14:13:34 +00:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2018-04-10 10:52:12 +00:00
|
|
|
return wxString::Format( wxT( "ErrType(%d): %s\n %s: %s\n" ),
|
|
|
|
m_ErrorCode,
|
|
|
|
GetErrorText(),
|
2018-06-15 04:49:50 +00:00
|
|
|
ShowCoord( aUnits, m_MainPosition ),
|
2018-04-10 10:52:12 +00:00
|
|
|
m_MainText );
|
2018-01-30 14:13:34 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2018-01-28 09:35:33 +00:00
|
|
|
BOARD_ITEM* DRC_ITEM::GetMainItem( BOARD* aBoard ) const
|
|
|
|
{
|
2018-08-23 22:41:57 +00:00
|
|
|
return aBoard->GetItem( m_mainItemWeakRef );
|
2018-01-28 09:35:33 +00:00
|
|
|
}
|
|
|
|
|
2018-01-30 14:13:34 +00:00
|
|
|
|
2018-01-28 09:35:33 +00:00
|
|
|
BOARD_ITEM* DRC_ITEM::GetAuxiliaryItem( BOARD* aBoard ) const
|
|
|
|
{
|
2018-08-23 22:41:57 +00:00
|
|
|
return aBoard->GetItem( m_auxItemWeakRef );
|
2018-01-28 09:35:33 +00:00
|
|
|
}
|
|
|
|
|