2020-02-24 23:17:30 +00:00
|
|
|
/*
|
|
|
|
* This program source code file is part of KiCad, a free EDA CAD application.
|
|
|
|
*
|
2020-03-16 11:05:01 +00:00
|
|
|
* Copyright (C) 2007 Dick Hollenbeck, dick@softplc.com
|
2021-12-01 14:42:44 +00:00
|
|
|
* Copyright (C) 2018-2021 KiCad Developers, see AUTHORS.txt for contributors.
|
2020-02-24 23:17:30 +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
|
|
|
|
*/
|
|
|
|
|
2020-03-16 11:05:01 +00:00
|
|
|
#ifndef DRC_ITEM_H
|
|
|
|
#define DRC_ITEM_H
|
2020-02-24 23:17:30 +00:00
|
|
|
|
2020-03-16 11:05:01 +00:00
|
|
|
#include <rc_item.h>
|
2021-12-01 14:42:44 +00:00
|
|
|
#include <marker_base.h>
|
2020-06-17 12:46:50 +00:00
|
|
|
|
|
|
|
class PCB_BASE_FRAME;
|
2020-09-11 15:04:11 +00:00
|
|
|
class DRC_RULE;
|
|
|
|
class DRC_TEST_PROVIDER;
|
2021-12-01 14:42:44 +00:00
|
|
|
class PCB_MARKER;
|
|
|
|
class BOARD;
|
2020-02-24 23:17:30 +00:00
|
|
|
|
2020-09-14 17:54:14 +00:00
|
|
|
enum PCB_DRC_CODE {
|
|
|
|
DRCE_FIRST = 1,
|
|
|
|
DRCE_UNCONNECTED_ITEMS = DRCE_FIRST, // items are unconnected
|
|
|
|
DRCE_SHORTING_ITEMS, // items short two nets but are not a net-tie
|
|
|
|
DRCE_ALLOWED_ITEMS, // a disallowed item has been used
|
2021-05-24 18:53:19 +00:00
|
|
|
DRCE_TEXT_ON_EDGECUTS, // text or dimension on Edge.Cuts layer
|
2020-09-14 17:54:14 +00:00
|
|
|
DRCE_CLEARANCE, // items are too close together
|
|
|
|
DRCE_TRACKS_CROSSING, // tracks are crossing
|
2021-08-15 17:23:54 +00:00
|
|
|
DRCE_EDGE_CLEARANCE, // a copper item is too close to the board edge
|
2020-09-14 17:54:14 +00:00
|
|
|
DRCE_ZONES_INTERSECT, // copper area outlines intersect
|
|
|
|
DRCE_ZONE_HAS_EMPTY_NET, // copper area has a net but no pads in nets, which is suspicious
|
2021-08-09 10:10:09 +00:00
|
|
|
DRCE_STARVED_THERMAL, // insufficient number of thermal spokes connected to zone
|
2020-09-14 17:54:14 +00:00
|
|
|
DRCE_DANGLING_VIA, // via which isn't connected to anything
|
|
|
|
DRCE_DANGLING_TRACK, // track with at least one end not connected to anything
|
|
|
|
DRCE_DRILLED_HOLES_TOO_CLOSE, // overlapping drilled holes break drill bits
|
2021-05-20 09:35:31 +00:00
|
|
|
DRCE_DRILLED_HOLES_COLOCATED, // two holes at the same location
|
2020-09-14 17:54:14 +00:00
|
|
|
DRCE_HOLE_CLEARANCE, //
|
|
|
|
DRCE_TRACK_WIDTH, // Track width is too small or too large
|
2021-06-26 09:11:22 +00:00
|
|
|
DRCE_ANNULAR_WIDTH, // Via size and drill leave annular ring too small
|
2021-01-03 22:57:51 +00:00
|
|
|
DRCE_DRILL_OUT_OF_RANGE, // Too small via or pad drill
|
2020-09-14 17:54:14 +00:00
|
|
|
DRCE_VIA_DIAMETER, // Via diameter checks (min/max)
|
|
|
|
DRCE_PADSTACK, // something is wrong with a pad or via stackup
|
2021-01-03 22:57:51 +00:00
|
|
|
DRCE_MICROVIA_DRILL_OUT_OF_RANGE, // Too small micro via drill
|
2020-09-14 17:54:14 +00:00
|
|
|
DRCE_OVERLAPPING_FOOTPRINTS, // footprint courtyards overlap
|
|
|
|
DRCE_MISSING_COURTYARD, // footprint has no courtyard defined
|
|
|
|
DRCE_MALFORMED_COURTYARD, // footprint has a courtyard but malformed
|
|
|
|
// (not convertible to a closed polygon with holes)
|
|
|
|
DRCE_PTH_IN_COURTYARD,
|
|
|
|
DRCE_NPTH_IN_COURTYARD,
|
|
|
|
DRCE_DISABLED_LAYER_ITEM, // item on a disabled layer
|
|
|
|
DRCE_INVALID_OUTLINE, // invalid board outline
|
|
|
|
|
|
|
|
DRCE_MISSING_FOOTPRINT, // footprint not found for netlist item
|
|
|
|
DRCE_DUPLICATE_FOOTPRINT, // more than one footprints found for netlist item
|
|
|
|
DRCE_EXTRA_FOOTPRINT, // netlist item not found for footprint
|
|
|
|
DRCE_NET_CONFLICT, // pad net doesn't match netlist
|
|
|
|
|
2021-09-25 15:55:33 +00:00
|
|
|
DRCE_FOOTPRINT_TYPE_MISMATCH, // footprint attribute does not match actual pads
|
2022-01-11 21:13:41 +00:00
|
|
|
DRCE_LIB_FOOTPRINT_ISSUES, // footprint not found in active libraries
|
|
|
|
DRCE_LIB_FOOTPRINT_MISMATCH, // footprint does not match the current library
|
2021-10-19 11:24:30 +00:00
|
|
|
DRCE_PAD_TH_WITH_NO_HOLE, // footprint has Plated Through-Hole with no hole
|
2021-09-25 15:55:33 +00:00
|
|
|
|
2020-09-14 17:54:14 +00:00
|
|
|
DRCE_UNRESOLVED_VARIABLE,
|
2021-09-22 21:20:18 +00:00
|
|
|
DRCE_ASSERTION_FAILURE, // user-defined (custom rule) assertion
|
2021-08-11 13:01:30 +00:00
|
|
|
|
|
|
|
DRCE_COPPER_SLIVER,
|
2021-08-12 16:58:30 +00:00
|
|
|
DRCE_SOLDERMASK_BRIDGE, // failure to maintain min soldermask web thickness
|
|
|
|
// between copper items with different nets
|
2021-08-11 13:01:30 +00:00
|
|
|
|
2021-08-12 16:58:30 +00:00
|
|
|
DRCE_SILK_CLEARANCE, // silkscreen clipped by mask (potentially leaving it
|
2020-10-04 11:44:22 +00:00
|
|
|
// over pads, exposed copper, etc.)
|
2021-07-11 15:12:28 +00:00
|
|
|
DRCE_TEXT_HEIGHT,
|
|
|
|
DRCE_TEXT_THICKNESS,
|
2020-10-11 21:30:43 +00:00
|
|
|
DRCE_OVERLAPPING_SILK, // silk to silk clearance error
|
2021-08-11 13:01:30 +00:00
|
|
|
|
2020-09-23 21:46:22 +00:00
|
|
|
DRCE_LENGTH_OUT_OF_RANGE,
|
|
|
|
DRCE_SKEW_OUT_OF_RANGE,
|
|
|
|
DRCE_TOO_MANY_VIAS,
|
2020-09-26 20:42:09 +00:00
|
|
|
DRCE_DIFF_PAIR_GAP_OUT_OF_RANGE,
|
|
|
|
DRCE_DIFF_PAIR_UNCOUPLED_LENGTH_TOO_LONG,
|
2020-09-14 17:54:14 +00:00
|
|
|
|
2020-09-27 15:50:24 +00:00
|
|
|
DRCE_LAST = DRCE_DIFF_PAIR_UNCOUPLED_LENGTH_TOO_LONG
|
2020-09-14 17:54:14 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
|
2020-03-16 11:05:01 +00:00
|
|
|
class DRC_ITEM : public RC_ITEM
|
2020-02-24 23:17:30 +00:00
|
|
|
{
|
|
|
|
public:
|
2020-06-08 02:19:46 +00:00
|
|
|
/**
|
|
|
|
* Constructs a DRC_ITEM for the given error code
|
|
|
|
* @see DRCE_T
|
|
|
|
*/
|
2020-08-11 13:33:16 +00:00
|
|
|
static std::shared_ptr<DRC_ITEM> Create( int aErrorCode );
|
2020-04-24 13:36:10 +00:00
|
|
|
|
2020-02-24 23:17:30 +00:00
|
|
|
/**
|
2020-06-08 02:19:46 +00:00
|
|
|
* Constructs a DRC item from a given error settings key
|
|
|
|
* @param aErrorKey is a settings key for an error code (the untranslated string that is used
|
|
|
|
* to represent a given error code in settings files and for storing ignored DRC items)
|
|
|
|
* @return the created item
|
2020-02-24 23:17:30 +00:00
|
|
|
*/
|
2020-08-11 13:33:16 +00:00
|
|
|
static std::shared_ptr<DRC_ITEM> Create( const wxString& aErrorKey );
|
2020-06-08 02:19:46 +00:00
|
|
|
|
|
|
|
static std::vector<std::reference_wrapper<RC_ITEM>> GetItemsWithSeverities()
|
|
|
|
{
|
|
|
|
return allItemTypes;
|
|
|
|
}
|
2020-02-24 23:17:30 +00:00
|
|
|
|
2020-09-11 15:04:11 +00:00
|
|
|
void SetViolatingRule ( DRC_RULE *aRule ) { m_violatingRule = aRule; }
|
|
|
|
DRC_RULE* GetViolatingRule() const { return m_violatingRule; }
|
|
|
|
|
2021-08-17 14:37:33 +00:00
|
|
|
wxString GetViolatingRuleDesc() const override;
|
|
|
|
|
2020-09-11 15:04:11 +00:00
|
|
|
void SetViolatingTest( DRC_TEST_PROVIDER *aProvider ) { m_violatingTest = aProvider; }
|
|
|
|
DRC_TEST_PROVIDER* GetViolatingTest() const { return m_violatingTest; }
|
2020-06-08 02:19:46 +00:00
|
|
|
|
|
|
|
private:
|
|
|
|
DRC_ITEM( int aErrorCode = 0, const wxString& aTitle = "", const wxString& aSettingsKey = "" )
|
|
|
|
{
|
|
|
|
m_errorCode = aErrorCode;
|
|
|
|
m_errorTitle = aTitle;
|
|
|
|
m_settingsKey = aSettingsKey;
|
2021-08-10 15:51:14 +00:00
|
|
|
m_parent = nullptr;
|
2020-06-08 02:19:46 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
/// A list of all DRC_ITEM types which are valid error codes
|
|
|
|
static std::vector<std::reference_wrapper<RC_ITEM>> allItemTypes;
|
|
|
|
|
2020-12-06 18:45:05 +00:00
|
|
|
static DRC_ITEM heading_electrical;
|
|
|
|
static DRC_ITEM heading_DFM;
|
|
|
|
static DRC_ITEM heading_schematic_parity;
|
|
|
|
static DRC_ITEM heading_signal_integrity;
|
2021-07-11 21:47:19 +00:00
|
|
|
static DRC_ITEM heading_readability;
|
2020-12-06 18:45:05 +00:00
|
|
|
static DRC_ITEM heading_misc;
|
|
|
|
|
2020-06-08 02:19:46 +00:00
|
|
|
static DRC_ITEM unconnectedItems;
|
2020-07-30 20:41:52 +00:00
|
|
|
static DRC_ITEM shortingItems;
|
2020-06-08 02:19:46 +00:00
|
|
|
static DRC_ITEM itemsNotAllowed;
|
2021-05-24 18:53:19 +00:00
|
|
|
static DRC_ITEM textOnEdgeCuts;
|
2020-06-08 02:19:46 +00:00
|
|
|
static DRC_ITEM clearance;
|
|
|
|
static DRC_ITEM tracksCrossing;
|
2021-08-15 17:23:54 +00:00
|
|
|
static DRC_ITEM edgeClearance;
|
2020-06-08 02:19:46 +00:00
|
|
|
static DRC_ITEM zonesIntersect;
|
|
|
|
static DRC_ITEM zoneHasEmptyNet;
|
2021-08-09 10:10:09 +00:00
|
|
|
static DRC_ITEM starvedThermal;
|
2020-06-08 02:19:46 +00:00
|
|
|
static DRC_ITEM viaDangling;
|
|
|
|
static DRC_ITEM trackDangling;
|
2020-09-18 12:31:56 +00:00
|
|
|
static DRC_ITEM holeNearHole;
|
2021-05-20 09:35:31 +00:00
|
|
|
static DRC_ITEM holesCoLocated;
|
2020-09-18 12:31:56 +00:00
|
|
|
static DRC_ITEM holeClearance;
|
2020-06-08 02:19:46 +00:00
|
|
|
static DRC_ITEM trackWidth;
|
2020-09-23 10:46:41 +00:00
|
|
|
static DRC_ITEM annularWidth;
|
2020-06-08 02:19:46 +00:00
|
|
|
static DRC_ITEM drillTooSmall;
|
2020-09-18 12:31:56 +00:00
|
|
|
static DRC_ITEM viaDiameter;
|
2020-06-08 02:19:46 +00:00
|
|
|
static DRC_ITEM padstack;
|
|
|
|
static DRC_ITEM microviaDrillTooSmall;
|
|
|
|
static DRC_ITEM courtyardsOverlap;
|
|
|
|
static DRC_ITEM missingCourtyard;
|
|
|
|
static DRC_ITEM malformedCourtyard;
|
|
|
|
static DRC_ITEM pthInsideCourtyard;
|
|
|
|
static DRC_ITEM npthInsideCourtyard;
|
|
|
|
static DRC_ITEM itemOnDisabledLayer;
|
|
|
|
static DRC_ITEM invalidOutline;
|
|
|
|
static DRC_ITEM duplicateFootprints;
|
|
|
|
static DRC_ITEM missingFootprint;
|
|
|
|
static DRC_ITEM extraFootprint;
|
2020-09-04 09:32:20 +00:00
|
|
|
static DRC_ITEM netConflict;
|
2021-07-11 11:49:36 +00:00
|
|
|
static DRC_ITEM libFootprintIssues;
|
2022-01-11 21:13:41 +00:00
|
|
|
static DRC_ITEM libFootprintMismatch;
|
2020-06-08 02:19:46 +00:00
|
|
|
static DRC_ITEM unresolvedVariable;
|
2021-09-22 21:20:18 +00:00
|
|
|
static DRC_ITEM assertionFailure;
|
2021-08-11 13:01:30 +00:00
|
|
|
static DRC_ITEM copperSliver;
|
2021-08-12 16:58:30 +00:00
|
|
|
static DRC_ITEM silkClearance;
|
|
|
|
static DRC_ITEM solderMaskBridge;
|
2020-10-11 21:30:43 +00:00
|
|
|
static DRC_ITEM silkOverlaps;
|
2021-07-11 15:12:28 +00:00
|
|
|
static DRC_ITEM textHeightOutOfRange;
|
|
|
|
static DRC_ITEM textThicknessOutOfRange;
|
2020-09-23 21:46:22 +00:00
|
|
|
static DRC_ITEM lengthOutOfRange;
|
|
|
|
static DRC_ITEM skewOutOfRange;
|
|
|
|
static DRC_ITEM tooManyVias;
|
2020-09-26 20:42:09 +00:00
|
|
|
static DRC_ITEM diffPairGapOutOfRange;
|
|
|
|
static DRC_ITEM diffPairUncoupledLengthTooLong;
|
2021-09-25 15:55:33 +00:00
|
|
|
static DRC_ITEM footprintTypeMismatch;
|
2021-10-19 11:24:30 +00:00
|
|
|
static DRC_ITEM footprintTHPadhasNoHole;
|
2020-02-28 00:05:40 +00:00
|
|
|
|
2020-09-11 15:04:11 +00:00
|
|
|
private:
|
|
|
|
DRC_RULE* m_violatingRule = nullptr;
|
|
|
|
DRC_TEST_PROVIDER* m_violatingTest = nullptr;
|
|
|
|
};
|
2020-02-28 00:05:40 +00:00
|
|
|
|
2021-12-01 14:42:44 +00:00
|
|
|
|
|
|
|
class DRC_ITEMS_PROVIDER : public RC_ITEMS_PROVIDER
|
|
|
|
{
|
|
|
|
public:
|
|
|
|
DRC_ITEMS_PROVIDER( BOARD* aBoard, MARKER_BASE::TYPEMARKER aMarkerType ) :
|
|
|
|
m_board( aBoard ),
|
|
|
|
m_markerType( aMarkerType ),
|
|
|
|
m_severities( 0 )
|
|
|
|
{
|
|
|
|
}
|
|
|
|
|
|
|
|
void SetSeverities( int aSeverities ) override;
|
|
|
|
|
|
|
|
int GetCount( int aSeverity = -1 ) const override;
|
|
|
|
|
|
|
|
std::shared_ptr<RC_ITEM> GetItem( int aIndex ) const override;
|
|
|
|
|
|
|
|
void DeleteItem( int aIndex, bool aDeep ) override;
|
|
|
|
|
|
|
|
void DeleteAllItems( bool aIncludeExclusions, bool aDeep ) override;
|
|
|
|
|
|
|
|
private:
|
|
|
|
BOARD* m_board;
|
|
|
|
MARKER_BASE::TYPEMARKER m_markerType;
|
|
|
|
|
|
|
|
int m_severities;
|
|
|
|
std::vector<PCB_MARKER*> m_filteredMarkers;
|
|
|
|
};
|
|
|
|
|
|
|
|
|
2020-03-16 11:05:01 +00:00
|
|
|
#endif // DRC_ITEM_H
|