KiCad PCB EDA Suite
Loading...
Searching...
No Matches
DRC_ENGINE Class Reference

Design Rule Checker object that performs all the DRC tests. More...

#include <drc_engine.h>

Inheritance diagram for DRC_ENGINE:
UNITS_PROVIDER

Classes

struct  DRC_ENGINE_CONSTRAINT
 

Public Member Functions

 DRC_ENGINE (BOARD *aBoard=nullptr, BOARD_DESIGN_SETTINGS *aSettings=nullptr)
 
virtual ~DRC_ENGINE ()
 
void SetBoard (BOARD *aBoard)
 
BOARDGetBoard () const
 
void SetDesignSettings (BOARD_DESIGN_SETTINGS *aSettings)
 
BOARD_DESIGN_SETTINGSGetDesignSettings () const
 
void SetSchematicNetlist (NETLIST *aNetlist)
 
NETLISTGetSchematicNetlist () const
 
void SetDrawingSheet (DS_PROXY_VIEW_ITEM *aDrawingSheet)
 
DS_PROXY_VIEW_ITEMGetDrawingSheet () const
 
void SetDebugOverlay (std::shared_ptr< KIGFX::VIEW_OVERLAY > aOverlay)
 
std::shared_ptr< KIGFX::VIEW_OVERLAYGetDebugOverlay () const
 
void SetViolationHandler (DRC_VIOLATION_HANDLER aHandler)
 Set an optional DRC violation handler (receives DRC_ITEMs and positions).
 
void ClearViolationHandler ()
 
void SetProgressReporter (PROGRESS_REPORTER *aProgRep)
 Set an optional reporter for user-level progress info.
 
PROGRESS_REPORTERGetProgressReporter () const
 
void SetLogReporter (REPORTER *aReporter)
 
void InitEngine (const wxFileName &aRulePath)
 Initialize the DRC engine.
 
void RunTests (EDA_UNITS aUnits, bool aReportAllTrackErrors, bool aTestFootprints)
 Run the DRC tests.
 
bool IsErrorLimitExceeded (int error_code)
 
DRC_CONSTRAINT EvalRules (DRC_CONSTRAINT_T aConstraintType, const BOARD_ITEM *a, const BOARD_ITEM *b, PCB_LAYER_ID aLayer, REPORTER *aReporter=nullptr)
 
DRC_CONSTRAINT EvalZoneConnection (const BOARD_ITEM *a, const BOARD_ITEM *b, PCB_LAYER_ID aLayer, REPORTER *aReporter=nullptr)
 
void ProcessAssertions (const BOARD_ITEM *a, std::function< void(const DRC_CONSTRAINT *)> aFailureHandler, REPORTER *aReporter=nullptr)
 
bool HasRulesForConstraintType (DRC_CONSTRAINT_T constraintID)
 
bool GetReportAllTrackErrors () const
 
bool GetTestFootprints () const
 
bool RulesValid ()
 
void ReportViolation (const std::shared_ptr< DRC_ITEM > &aItem, const VECTOR2I &aPos, int aMarkerLayer)
 
bool KeepRefreshing (bool aWait=false)
 
void AdvanceProgress ()
 
void SetMaxProgress (int aSize)
 
bool ReportProgress (double aProgress)
 
bool ReportPhase (const wxString &aMessage)
 
void ReportAux (const wxString &aStr)
 
bool IsCancelled () const
 
bool QueryWorstConstraint (DRC_CONSTRAINT_T aRuleId, DRC_CONSTRAINT &aConstraint)
 
std::set< int > QueryDistinctConstraints (DRC_CONSTRAINT_T aConstraintId)
 
std::vector< DRC_TEST_PROVIDER * > GetTestProviders () const
 
DRC_TEST_PROVIDERGetTestProvider (const wxString &name) const
 
bool IsNetTieExclusion (int aTrackNetCode, PCB_LAYER_ID aTrackLayer, const VECTOR2I &aCollisionPos, BOARD_ITEM *aCollidingItem)
 Check if the given collision between a track and another item occurs during the track's entry into a net-tie pad.
 
EDA_UNITS GetUserUnits () const
 
void SetUserUnits (EDA_UNITS aUnits)
 
virtual void GetUnitPair (EDA_UNITS &aPrimaryUnit, EDA_UNITS &aSecondaryUnits)
 
const EDA_IU_SCALEGetIuScale () const
 
virtual ORIGIN_TRANSFORMSGetOriginTransforms ()
 
wxString StringFromValue (double aValue, bool aAddUnitLabel=false, EDA_DATA_TYPE aType=EDA_DATA_TYPE::DISTANCE) const
 Converts aValue in internal units into a united string.
 
wxString StringFromValue (const EDA_ANGLE &aValue, bool aAddUnitLabel=false) const
 
wxString MessageTextFromValue (double aValue, bool aAddUnitLabel=true, EDA_DATA_TYPE aType=EDA_DATA_TYPE::DISTANCE) const
 A lower-precision version of StringFromValue().
 
wxString MessageTextFromValue (const EDA_ANGLE &aValue, bool aAddUnitLabel=true) const
 
wxString MessageTextFromMinOptMax (const MINOPTMAX< int > &aValue) const
 
int ValueFromString (const wxString &aTextValue, EDA_DATA_TYPE aType=EDA_DATA_TYPE::DISTANCE) const
 Converts aTextValue in aUnits to internal units used by the frame.
 
EDA_ANGLE AngleValueFromString (const wxString &aTextValue) const
 

Static Public Member Functions

static bool IsNetADiffPair (BOARD *aBoard, NETINFO_ITEM *aNet, int &aNetP, int &aNetN)
 
static int MatchDpSuffix (const wxString &aNetName, wxString &aComplementNet, wxString &aBaseDpName)
 Check if the given net is a diff pair, returning its polarity and complement if so.
 

Protected Attributes

BOARD_DESIGN_SETTINGSm_designSettings
 
BOARDm_board
 
DS_PROXY_VIEW_ITEMm_drawingSheet
 
NETLISTm_schematicNetlist
 
std::vector< std::shared_ptr< DRC_RULE > > m_rules
 
bool m_rulesValid
 
std::vector< DRC_TEST_PROVIDER * > m_testProviders
 
std::vector< int > m_errorLimits
 
bool m_reportAllTrackErrors
 
bool m_testFootprints
 
std::map< DRC_CONSTRAINT_T, std::vector< DRC_ENGINE_CONSTRAINT * > * > m_constraintMap
 
DRC_VIOLATION_HANDLER m_violationHandler
 
REPORTERm_reporter
 
PROGRESS_REPORTERm_progressReporter
 
std::shared_ptr< KIGFX::VIEW_OVERLAYm_debugOverlay
 

Private Member Functions

void addRule (std::shared_ptr< DRC_RULE > &rule)
 
void loadRules (const wxFileName &aPath)
 Load and parse a rule set from an sexpr text file.
 
void compileRules ()
 
void loadImplicitRules ()
 
std::shared_ptr< DRC_RULEcreateImplicitRule (const wxString &name)
 

Private Attributes

const EDA_IU_SCALEm_iuScale
 
EDA_UNITS m_userUnits
 

Detailed Description

Design Rule Checker object that performs all the DRC tests.

Optionally reports violations via a DRC_VIOLATION_HANDLER, user-level progress via a PROGRESS_REPORTER and rule parse errors via a REPORTER, all set through various setter calls.

Note that EvalRules() has yet another optional REPORTER for reporting resolution info to the user.

Definition at line 82 of file drc_engine.h.

Constructor & Destructor Documentation

◆ DRC_ENGINE()

DRC_ENGINE::DRC_ENGINE ( BOARD aBoard = nullptr,
BOARD_DESIGN_SETTINGS aSettings = nullptr 
)

Definition at line 66 of file drc_engine.cpp.

References DRCE_FIRST, DRCE_LAST, ERROR_LIMIT, and m_errorLimits.

◆ ~DRC_ENGINE()

DRC_ENGINE::~DRC_ENGINE ( )
virtual

Definition at line 85 of file drc_engine.cpp.

References m_constraintMap, and m_rules.

Member Function Documentation

◆ addRule()

void DRC_ENGINE::addRule ( std::shared_ptr< DRC_RULE > &  rule)
inlineprivate

Definition at line 205 of file drc_engine.h.

References m_rules.

Referenced by createImplicitRule(), and loadImplicitRules().

◆ AdvanceProgress()

void DRC_ENGINE::AdvanceProgress ( )

Definition at line 1633 of file drc_engine.cpp.

References PROGRESS_REPORTER::AdvanceProgress(), and m_progressReporter.

◆ AngleValueFromString()

EDA_ANGLE UNITS_PROVIDER::AngleValueFromString ( const wxString &  aTextValue) const
inlineinherited

◆ ClearViolationHandler()

void DRC_ENGINE::ClearViolationHandler ( )
inline

Definition at line 115 of file drc_engine.h.

References m_violationHandler.

◆ compileRules()

◆ createImplicitRule()

std::shared_ptr< DRC_RULE > DRC_ENGINE::createImplicitRule ( const wxString &  name)
private

Definition at line 125 of file drc_engine.cpp.

References addRule(), and name.

Referenced by loadImplicitRules().

◆ EvalRules()

DRC_CONSTRAINT DRC_ENGINE::EvalRules ( DRC_CONSTRAINT_T  aConstraintType,
const BOARD_ITEM a,
const BOARD_ITEM b,
PCB_LAYER_ID  aLayer,
REPORTER aReporter = nullptr 
)

Definition at line 675 of file drc_engine.cpp.

References _, ANNULAR_WIDTH_CONSTRAINT, ASSERTION_CONSTRAINT, B_CrtYd, LSET::BackMask(), CLEARANCE_CONSTRAINT, CONNECTION_WIDTH_CONSTRAINT, COURTYARD_CLEARANCE_CONSTRAINT, DIFF_PAIR_GAP_CONSTRAINT, DISALLOW_CONSTRAINT, DRC_DISALLOW_BB_VIAS, DRC_DISALLOW_FOOTPRINTS, DRC_DISALLOW_GRAPHICS, DRC_DISALLOW_HOLES, DRC_DISALLOW_MICRO_VIAS, DRC_DISALLOW_PADS, DRC_DISALLOW_TEXTS, DRC_DISALLOW_TRACKS, DRC_DISALLOW_VIAS, DRC_DISALLOW_ZONES, EDGE_CLEARANCE_CONSTRAINT, EscapeHTML(), F_CrtYd, LSET::FrontMask(), BOARD_CONNECTED_ITEM::GetClearanceOverrides(), FOOTPRINT::GetCourtyard(), BOARD::GetEnabledLayers(), EDA_ITEM::GetFlags(), EDA_ITEM::GetItemDescription(), FOOTPRINT::GetItemDescription(), ZONE::GetItemDescription(), BOARD_ITEM::GetLayerSet(), BOARD_CONNECTED_ITEM::GetLocalClearance(), FOOTPRINT::GetLocalZoneConnection(), ZONE::GetMinThickness(), ZONE::GetPadConnection(), DRC_CONSTRAINT::GetParentRule(), ZONE::GetThermalReliefGap(), ZONE::GetThermalReliefSpokeWidth(), hasDrilledHole(), HOLE_CLEARANCE_CONSTRAINT, HOLE_PROXY, HOLE_SIZE_CONSTRAINT, HOLE_TO_HOLE_CONSTRAINT, BOARD_ITEM::IsConnected(), SHAPE_POLY_SET::IsEmpty(), isKeepoutZone(), BOARD_ITEM::IsOnCopperLayer(), LENGTH_CONSTRAINT, m_board, m_constraintMap, m_designSettings, DRC_CONSTRAINT::m_DisallowFlags, BOARD_DESIGN_SETTINGS::m_HoleClearance, DRC_RULE::m_Implicit, BOARD_DESIGN_SETTINGS::m_MinClearance, DRC_CONSTRAINT::m_Type, DRC_CONSTRAINT::m_Value, DRC_CONSTRAINT::m_ZoneConnection, MAX_UNCOUPLED_CONSTRAINT, EDA_UNIT_UTILS::UI::MessageTextFromValue(), UNITS_PROVIDER::MessageTextFromValue(), MINOPTMAX< T >::Min(), MIN_RESOLVED_SPOKES_CONSTRAINT, NULL_CONSTRAINT, pad, PCB_ARC_T, PCB_FIELD_T, PCB_FOOTPRINT_T, PCB_LOCATE_HOLE_T, PCB_PAD_T, PCB_SHAPE_T, PCB_TABLE_T, PCB_TEXT_T, PCB_TEXTBOX_T, PCB_TRACE_T, PCB_VIA_T, PCB_ZONE_T, PHYSICAL_CLEARANCE_CONSTRAINT, PHYSICAL_HOLE_CLEARANCE_CONSTRAINT, PrintZoneConnection(), REPORT, MINOPTMAX< T >::SetMin(), DRC_CONSTRAINT::SetName(), MINOPTMAX< T >::SetOpt(), DRC_CONSTRAINT::SetParentRule(), SILK_CLEARANCE_CONSTRAINT, SKEW_CONSTRAINT, TEXT_HEIGHT_CONSTRAINT, TEXT_THICKNESS_CONSTRAINT, THERMAL_RELIEF_GAP_CONSTRAINT, THERMAL_SPOKE_WIDTH_CONSTRAINT, TRACK_WIDTH_CONSTRAINT, EDA_ITEM::Type(), UNDEFINED_LAYER, unityScale, VIA_DIAMETER_CONSTRAINT, and ZONE_CONNECTION_CONSTRAINT.

Referenced by DRC_TEST_PROVIDER_HOLE_SIZE::checkPadHole(), DRC_TEST_PROVIDER_HOLE_SIZE::checkViaHole(), EvalZoneConnection(), DRC_TEST_PROVIDER_ANNULAR_WIDTH::Run(), DRC_TEST_PROVIDER_CONNECTION_WIDTH::Run(), test::DRC_TEST_PROVIDER_DIFF_PAIR_COUPLING::Run(), DRC_TEST_PROVIDER_DISALLOW::Run(), DRC_TEST_PROVIDER_SILK_CLEARANCE::Run(), DRC_TEST_PROVIDER_TEXT_DIMS::Run(), DRC_TEST_PROVIDER_TRACK_WIDTH::Run(), DRC_TEST_PROVIDER_VIA_DIAMETER::Run(), DRC_TEST_PROVIDER_MATCHED_LENGTH::runInternal(), DRC_TEST_PROVIDER_EDGE_CLEARANCE::testAgainstEdge(), DRC_TEST_PROVIDER_COURTYARD_CLEARANCE::testCourtyardClearances(), DRC_TEST_PROVIDER_HOLE_TO_HOLE::testHoleAgainstHole(), DRC_TEST_PROVIDER_PHYSICAL_CLEARANCE::testItemAgainstItem(), DRC_TEST_PROVIDER_COPPER_CLEARANCE::testItemAgainstZone(), DRC_TEST_PROVIDER_PHYSICAL_CLEARANCE::testItemAgainstZones(), DRC_TEST_PROVIDER_COPPER_CLEARANCE::testKnockoutTextAgainstZone(), DRC_TEST_PROVIDER_COPPER_CLEARANCE::testPadAgainstItem(), DRC_TEST_PROVIDER_COPPER_CLEARANCE::testSingleLayerItemAgainstItem(), and DRC_TEST_PROVIDER_COPPER_CLEARANCE::testZonesToZones().

◆ EvalZoneConnection()

DRC_CONSTRAINT DRC_ENGINE::EvalZoneConnection ( const BOARD_ITEM a,
const BOARD_ITEM b,
PCB_LAYER_ID  aLayer,
REPORTER aReporter = nullptr 
)

◆ GetBoard()

◆ GetDebugOverlay()

std::shared_ptr< KIGFX::VIEW_OVERLAY > DRC_ENGINE::GetDebugOverlay ( ) const
inline

Definition at line 105 of file drc_engine.h.

References m_debugOverlay.

Referenced by test::DRC_TEST_PROVIDER_DIFF_PAIR_COUPLING::Run().

◆ GetDesignSettings()

BOARD_DESIGN_SETTINGS * DRC_ENGINE::GetDesignSettings ( ) const
inline

Definition at line 92 of file drc_engine.h.

References m_designSettings.

Referenced by IsNetTieExclusion().

◆ GetDrawingSheet()

DS_PROXY_VIEW_ITEM * DRC_ENGINE::GetDrawingSheet ( ) const
inline

Definition at line 98 of file drc_engine.h.

References m_drawingSheet.

Referenced by DRC_TEST_PROVIDER_MISC::testTextVars().

◆ GetIuScale()

◆ GetOriginTransforms()

virtual ORIGIN_TRANSFORMS & UNITS_PROVIDER::GetOriginTransforms ( )
inlinevirtualinherited

Reimplemented in EDA_BASE_FRAME, and PCB_BASE_FRAME.

Definition at line 60 of file units_provider.h.

◆ GetProgressReporter()

PROGRESS_REPORTER * DRC_ENGINE::GetProgressReporter ( ) const
inline

Definition at line 124 of file drc_engine.h.

References m_progressReporter.

Referenced by DRC_CACHE_GENERATOR::Run(), and DRC_TEST_PROVIDER_SLIVER_CHECKER::Run().

◆ GetReportAllTrackErrors()

◆ GetSchematicNetlist()

NETLIST * DRC_ENGINE::GetSchematicNetlist ( ) const
inline

Definition at line 95 of file drc_engine.h.

References m_schematicNetlist.

Referenced by DRC_TEST_PROVIDER_SCHEMATIC_PARITY::Run().

◆ GetTestFootprints()

bool DRC_ENGINE::GetTestFootprints ( ) const
inline

Definition at line 163 of file drc_engine.h.

References m_testFootprints.

Referenced by DRC_TEST_PROVIDER_SCHEMATIC_PARITY::Run().

◆ GetTestProvider()

DRC_TEST_PROVIDER * DRC_ENGINE::GetTestProvider ( const wxString &  name) const

Definition at line 1828 of file drc_engine.cpp.

References m_testProviders, and name.

◆ GetTestProviders()

std::vector< DRC_TEST_PROVIDER * > DRC_ENGINE::GetTestProviders ( ) const
inline

Definition at line 181 of file drc_engine.h.

References m_testProviders.

◆ GetUnitPair()

virtual void UNITS_PROVIDER::GetUnitPair ( EDA_UNITS aPrimaryUnit,
EDA_UNITS aSecondaryUnits 
)
inlinevirtualinherited

◆ GetUserUnits()

EDA_UNITS UNITS_PROVIDER::GetUserUnits ( ) const
inlineinherited

Definition at line 43 of file units_provider.h.

References UNITS_PROVIDER::m_userUnits.

Referenced by DIALOG_BOOK_REPORTER::AddHTMLPage(), PANEL_SYMBOL_CHOOSER::constructRightPanel(), PG_UNIT_EDITOR::CreateControls(), PCB::IFACE::CreateKiWindow(), DIALOG_SHIM::DIALOG_SHIM(), DIALOG_TRACK_VIA_PROPERTIES::DIALOG_TRACK_VIA_PROPERTIES(), PL_EDITOR_FRAME::DisplayGridMsg(), EDA_DRAW_FRAME::DisplayUnitsMsg(), DRAWING_TOOL::drawArc(), DRAWING_TOOL::drawShape(), DRAWING_TOOL::DrawSpecificationStackup(), EVT_GRID_CMD_CELL_CHANGED(), FOOTPRINT_PREVIEW_PANEL::FOOTPRINT_PREVIEW_PANEL(), FP_TEXT_GRID_TABLE::FP_TEXT_GRID_TABLE(), PCB_NET_INSPECTOR_PANEL::generateReport(), RC_ITEM::GetJsonViolation(), GERBER_DRAW_ITEM::GetMsgPanelInfo(), UNITS_PROVIDER::GetUnitPair(), EDA_DRAW_FRAME::GetUnitPair(), WX_GRID::GetUnitValue(), GetUserUnits(), UNIT_BINDER::init(), FIELDS_GRID_TABLE::initGrid(), GERBVIEW_INSPECTION_TOOL::MeasureTool(), PCB_VIEWER_TOOLS::MeasureTool(), UNITS_PROVIDER::MessageTextFromMinOptMax(), UNITS_PROVIDER::MessageTextFromValue(), PANEL_SETUP_BOARD_STACKUP::onAdjustDielectricThickness(), WX_GRID::onCellEditorHidden(), PANEL_SETUP_BOARD_STACKUP::onExportToClipboard(), DIALOG_ERC::OnSaveReport(), PANEL_PREVIEW_3D_MODEL::onUnitsChanged(), PANEL_SETUP_NETCLASSES::onUnitsChanged(), UNIT_BINDER::onUnitsChanged(), DIALOG_TRACK_VIA_PROPERTIES::onUnitsChanged(), PANEL_SETUP_BOARD_STACKUP::onUnitsChanged(), DIALOG_GENERATORS::onUnitsChanged(), PANEL_FOOTPRINT_CHOOSER::PANEL_FOOTPRINT_CHOOSER(), PANEL_PREVIEW_3D_MODEL::PANEL_PREVIEW_3D_MODEL(), PANEL_SETUP_NETCLASSES::PANEL_SETUP_NETCLASSES(), PG_UNIT_EDITOR::PG_UNIT_EDITOR(), PIN_TABLE_DATA_MODEL::PIN_TABLE_DATA_MODEL(), POSITION_RELATIVE_TOOL::PositionRelative(), DRC_TOOL::RunTests(), EDA_DRAW_FRAME::SaveSettings(), PCB_BASE_FRAME::SetBoard(), WX_GRID::SetUnitsProvider(), PIN_TABLE_DATA_MODEL::SetValue(), FIELDS_GRID_TABLE::SetValue(), FP_TEXT_GRID_TABLE::SetValue(), GERBVIEW_INSPECTION_TOOL::ShowDCodes(), UNITS_PROVIDER::StringFromValue(), COMMON_TOOLS::ToggleUnits(), EDA_DRAW_FRAME::ToggleUserUnits(), PCB_BASE_FRAME::unitsChangeRefresh(), EDITOR_CONDITIONS::unitsFunc(), GERBVIEW_FRAME::updateDCodeSelectBox(), PG_UNIT_EDITOR::UpdateFrame(), PL_EDITOR_FRAME::UpdateStatusBar(), DRC_TOOL::userUnits(), GRID::UserUnitsMessageText(), and UNITS_PROVIDER::ValueFromString().

◆ HasRulesForConstraintType()

bool DRC_ENGINE::HasRulesForConstraintType ( DRC_CONSTRAINT_T  constraintID)

◆ InitEngine()

void DRC_ENGINE::InitEngine ( const wxFileName &  aRulePath)

◆ IsCancelled()

bool DRC_ENGINE::IsCancelled ( ) const

◆ IsErrorLimitExceeded()

bool DRC_ENGINE::IsErrorLimitExceeded ( int  error_code)

Definition at line 1572 of file drc_engine.cpp.

References DRCE_LAST, and m_errorLimits.

Referenced by DRC_TEST_PROVIDER_ANNULAR_WIDTH::Run(), DRC_TEST_PROVIDER_CONNECTION_WIDTH::Run(), DRC_TEST_PROVIDER_CONNECTIVITY::Run(), DRC_TEST_PROVIDER_COPPER_CLEARANCE::Run(), DRC_TEST_PROVIDER_DISALLOW::Run(), DRC_TEST_PROVIDER_EDGE_CLEARANCE::Run(), DRC_TEST_PROVIDER_FOOTPRINT_CHECKS::Run(), DRC_TEST_PROVIDER_HOLE_SIZE::Run(), DRC_TEST_PROVIDER_HOLE_TO_HOLE::Run(), DRC_TEST_PROVIDER_LIBRARY_PARITY::Run(), DRC_TEST_PROVIDER_MISC::Run(), DRC_TEST_PROVIDER_PHYSICAL_CLEARANCE::Run(), DRC_TEST_PROVIDER_SILK_CLEARANCE::Run(), DRC_TEST_PROVIDER_SLIVER_CHECKER::Run(), DRC_TEST_PROVIDER_SOLDER_MASK::Run(), DRC_TEST_PROVIDER_TEXT_DIMS::Run(), DRC_TEST_PROVIDER_TRACK_WIDTH::Run(), DRC_TEST_PROVIDER_VIA_DIAMETER::Run(), DRC_TEST_PROVIDER_MISC::testAssertions(), DRC_TEST_PROVIDER_COURTYARD_CLEARANCE::testCourtyardClearances(), DRC_TEST_PROVIDER_MISC::testDisabledLayers(), DRC_TEST_PROVIDER_COURTYARD_CLEARANCE::testFootprintCourtyardDefinitions(), DRC_TEST_PROVIDER_HOLE_TO_HOLE::testHoleAgainstHole(), DRC_TEST_PROVIDER_PHYSICAL_CLEARANCE::testItemAgainstItem(), DRC_TEST_PROVIDER_COPPER_CLEARANCE::testItemAgainstZone(), DRC_TEST_PROVIDER_PHYSICAL_CLEARANCE::testItemAgainstZones(), DRC_TEST_PROVIDER_COPPER_CLEARANCE::testKnockoutTextAgainstZone(), DRC_TEST_PROVIDER_SOLDER_MASK::testMaskBridges(), DRC_TEST_PROVIDER_SCHEMATIC_PARITY::testNetlist(), DRC_TEST_PROVIDER_MISC::testOutline(), DRC_TEST_PROVIDER_COPPER_CLEARANCE::testPadAgainstItem(), DRC_TEST_PROVIDER_SOLDER_MASK::testSilkToMaskClearance(), DRC_TEST_PROVIDER_COPPER_CLEARANCE::testSingleLayerItemAgainstItem(), DRC_TEST_PROVIDER_MISC::testTextVars(), DRC_TEST_PROVIDER_ZONE_CONNECTIONS::testZoneLayer(), and DRC_TEST_PROVIDER_COPPER_CLEARANCE::testZonesToZones().

◆ IsNetADiffPair()

bool DRC_ENGINE::IsNetADiffPair ( BOARD aBoard,
NETINFO_ITEM aNet,
int &  aNetP,
int &  aNetN 
)
static

◆ IsNetTieExclusion()

bool DRC_ENGINE::IsNetTieExclusion ( int  aTrackNetCode,
PCB_LAYER_ID  aTrackLayer,
const VECTOR2I aCollisionPos,
BOARD_ITEM aCollidingItem 
)

◆ KeepRefreshing()

bool DRC_ENGINE::KeepRefreshing ( bool  aWait = false)

Definition at line 1624 of file drc_engine.cpp.

References PROGRESS_REPORTER::KeepRefreshing(), and m_progressReporter.

◆ loadImplicitRules()

void DRC_ENGINE::loadImplicitRules ( )
private

Definition at line 138 of file drc_engine.cpp.

References _, addRule(), ANNULAR_WIDTH_CONSTRAINT, B_SilkS, CLEARANCE_CONSTRAINT, CONNECTION_WIDTH_CONSTRAINT, COURTYARD_CLEARANCE_CONSTRAINT, createImplicitRule(), DIFF_PAIR_GAP_CONSTRAINT, DISALLOW_CONSTRAINT, DRC_DISALLOW_FOOTPRINTS, DRC_DISALLOW_PADS, DRC_DISALLOW_TRACKS, DRC_DISALLOW_VIAS, DRC_DISALLOW_ZONES, EDGE_CLEARANCE_CONSTRAINT, F_SilkS, BOARD::Footprints(), BOARD::GetDesignSettings(), HOLE_CLEARANCE_CONSTRAINT, HOLE_SIZE_CONSTRAINT, HOLE_TO_HOLE_CONSTRAINT, isKeepoutZone(), m_board, BOARD_DESIGN_SETTINGS::m_CopperEdgeClearance, DRC_CONSTRAINT::m_DisallowFlags, BOARD_DESIGN_SETTINGS::m_HoleClearance, BOARD_DESIGN_SETTINGS::m_HoleToHoleMin, BOARD_DESIGN_SETTINGS::m_MicroViasMinDrill, BOARD_DESIGN_SETTINGS::m_MicroViasMinSize, BOARD_DESIGN_SETTINGS::m_MinClearance, BOARD_DESIGN_SETTINGS::m_MinConn, BOARD_DESIGN_SETTINGS::m_MinResolvedSpokes, BOARD_DESIGN_SETTINGS::m_MinSilkTextHeight, BOARD_DESIGN_SETTINGS::m_MinSilkTextThickness, BOARD_DESIGN_SETTINGS::m_MinThroughDrill, BOARD_DESIGN_SETTINGS::m_NetSettings, BOARD_DESIGN_SETTINGS::m_SilkClearance, BOARD_DESIGN_SETTINGS::m_TrackMinWidth, BOARD_DESIGN_SETTINGS::m_ViasMinAnnularWidth, BOARD_DESIGN_SETTINGS::m_ViasMinSize, MIN_RESOLVED_SPOKES_CONSTRAINT, name, ReportAux(), MINOPTMAX< T >::SetMin(), MINOPTMAX< T >::SetOpt(), SILK_CLEARANCE_CONSTRAINT, BOARD::SynchronizeNetsAndNetClasses(), TEXT_HEIGHT_CONSTRAINT, TEXT_THICKNESS_CONSTRAINT, TRACK_WIDTH_CONSTRAINT, DRC_CONSTRAINT::Value(), VIA_DIAMETER_CONSTRAINT, and BOARD::Zones().

Referenced by InitEngine().

◆ loadRules()

void DRC_ENGINE::loadRules ( const wxFileName &  aPath)
private

Load and parse a rule set from an sexpr text file.

Exceptions
PARSE_ERROR

Definition at line 466 of file drc_engine.cpp.

References m_reporter, m_rules, and DRC_RULES_PARSER::Parse().

Referenced by InitEngine().

◆ MatchDpSuffix()

int DRC_ENGINE::MatchDpSuffix ( const wxString &  aNetName,
wxString &  aComplementNet,
wxString &  aBaseDpName 
)
static

Check if the given net is a diff pair, returning its polarity and complement if so.

Parameters
aNetNameis the input net name, like DIFF_P
aComplementNetwill be filled with the complement, like DIFF_N
aBaseDpNamewill be filled with the base name, like DIFF
Returns
1 if aNetName is the positive half of a pair, -1 if negative, 0 if not a diff pair

Definition at line 1720 of file drc_engine.cpp.

Referenced by inDiffPairFunc(), BOARD_INSPECTION_TOOL::InspectClearance(), isCoupledDiffPairFunc(), and IsNetADiffPair().

◆ MessageTextFromMinOptMax()

wxString UNITS_PROVIDER::MessageTextFromMinOptMax ( const MINOPTMAX< int > &  aValue) const
inlineinherited

◆ MessageTextFromValue() [1/2]

wxString UNITS_PROVIDER::MessageTextFromValue ( const EDA_ANGLE aValue,
bool  aAddUnitLabel = true 
) const
inlineinherited

◆ MessageTextFromValue() [2/2]

wxString UNITS_PROVIDER::MessageTextFromValue ( double  aValue,
bool  aAddUnitLabel = true,
EDA_DATA_TYPE  aType = EDA_DATA_TYPE::DISTANCE 
) const
inlineinherited

A lower-precision version of StringFromValue().

Should ONLY be used for status text and messages. Not suitable for dialogs, files, etc. where the loss of precision matters.

Definition at line 101 of file units_provider.h.

References UNITS_PROVIDER::GetIuScale(), UNITS_PROVIDER::GetUserUnits(), and EDA_UNIT_UTILS::UI::MessageTextFromValue().

Referenced by CheckLibSymbol(), CheckLibSymbolGraphics(), DRC_TEST_PROVIDER_MATCHED_LENGTH::checkSkews(), DIALOG_BOARD_REANNOTATE::CoordTowxString(), GERBVIEW_FRAME::DisplayGridMsg(), GERBER_FILE_IMAGE::DisplayImageInfo(), DRAWING_TOOL::DrawBoardCharacteristics(), EvalRules(), PCB_NET_INSPECTOR_PANEL::formatLength(), DRC_TEST_PROVIDER::formatMsg(), SCH_LINE::GetItemDescription(), SCH_SHAPE::GetItemDescription(), DS_DRAW_ITEM_LINE::GetItemDescription(), DS_DRAW_ITEM_RECT::GetItemDescription(), PCB_TRACK::GetItemDescription(), LIB_PIN::GetMsgPanelInfo(), SCH_BITMAP::GetMsgPanelInfo(), SCH_FIELD::GetMsgPanelInfo(), SCH_JUNCTION::GetMsgPanelInfo(), SCH_LABEL_BASE::GetMsgPanelInfo(), SCH_PIN::GetMsgPanelInfo(), SCH_TABLECELL::GetMsgPanelInfo(), SCH_TEXT::GetMsgPanelInfo(), SCH_TEXTBOX::GetMsgPanelInfo(), DS_DRAW_ITEM_BASE::GetMsgPanelInfo(), PCB_TUNING_PATTERN::GetMsgPanelInfo(), NETINFO_ITEM::GetMsgPanelInfo(), PAD::GetMsgPanelInfo(), PCB_DIMENSION_BASE::GetMsgPanelInfo(), PCB_DIM_ALIGNED::GetMsgPanelInfo(), PCB_DIM_LEADER::GetMsgPanelInfo(), PCB_REFERENCE_IMAGE::GetMsgPanelInfo(), PCB_TABLECELL::GetMsgPanelInfo(), PCB_TARGET::GetMsgPanelInfo(), PCB_TEXT::GetMsgPanelInfo(), PCB_TEXTBOX::GetMsgPanelInfo(), PCB_TRACK::GetMsgPanelInfo(), PCB_VIA::GetMsgPanelInfo(), ZONE::GetMsgPanelInfo(), STROKE_PARAMS::GetMsgPanelInfo(), GetNetNavigatorItemText(), SYMBOL_SEARCH_HANDLER::getResultCell(), TEXT_SEARCH_HANDLER::getResultCell(), LABEL_SEARCH_HANDLER::getResultCell(), DIALOG_BOARD_REANNOTATE::MakeSampleText(), PCB_BASE_FRAME::MessageTextFromCoord(), test::DRC_TEST_PROVIDER_DIFF_PAIR_COUPLING::Run(), DRC_TEST_PROVIDER_MATCHED_LENGTH::runInternal(), DIALOG_BOARD_STATISTICS::saveReportClicked(), TUNING_STATUS_VIEW_ITEM::SetCurrent(), TUNING_STATUS_VIEW_ITEM::SetMinMax(), EDA_SHAPE::ShapeGetMsgPanelInfo(), showCoord(), TRACK_WIDTH_MENU::update(), DIFF_PAIR_MENU::update(), VIA_SIZE_MENU::update(), BOARD_NETLIST_UPDATER::updateCopperZoneNets(), DIALOG_BOARD_STATISTICS::updateDrillGrid(), PCB_CONTROL::UpdateMessagePanel(), PL_EDITOR_FRAME::UpdateMsgPanelInfo(), SCH_BASE_FRAME::UpdateStatusBar(), GERBVIEW_FRAME::UpdateStatusBar(), PCB_BASE_FRAME::UpdateStatusBar(), and DIALOG_BOARD_STATISTICS::updateWidets().

◆ ProcessAssertions()

void DRC_ENGINE::ProcessAssertions ( const BOARD_ITEM a,
std::function< void(const DRC_CONSTRAINT *)>  aFailureHandler,
REPORTER aReporter = nullptr 
)

◆ QueryDistinctConstraints()

std::set< int > DRC_ENGINE::QueryDistinctConstraints ( DRC_CONSTRAINT_T  aConstraintId)

Definition at line 1705 of file drc_engine.cpp.

References m_constraintMap.

Referenced by DRC_TEST_PROVIDER_CONNECTION_WIDTH::Run().

◆ QueryWorstConstraint()

◆ ReportAux()

void DRC_ENGINE::ReportAux ( const wxString &  aStr)

◆ ReportPhase()

bool DRC_ENGINE::ReportPhase ( const wxString &  aMessage)

◆ ReportProgress()

bool DRC_ENGINE::ReportProgress ( double  aProgress)

◆ ReportViolation()

void DRC_ENGINE::ReportViolation ( const std::shared_ptr< DRC_ITEM > &  aItem,
const VECTOR2I aPos,
int  aMarkerLayer 
)

◆ RulesValid()

bool DRC_ENGINE::RulesValid ( )
inline

Definition at line 165 of file drc_engine.h.

References m_rulesValid.

◆ RunTests()

◆ SetBoard()

void DRC_ENGINE::SetBoard ( BOARD aBoard)
inline

Definition at line 88 of file drc_engine.h.

References m_board.

◆ SetDebugOverlay()

void DRC_ENGINE::SetDebugOverlay ( std::shared_ptr< KIGFX::VIEW_OVERLAY aOverlay)
inline

Definition at line 100 of file drc_engine.h.

References m_debugOverlay.

◆ SetDesignSettings()

void DRC_ENGINE::SetDesignSettings ( BOARD_DESIGN_SETTINGS aSettings)
inline

Definition at line 91 of file drc_engine.h.

References m_designSettings.

◆ SetDrawingSheet()

void DRC_ENGINE::SetDrawingSheet ( DS_PROXY_VIEW_ITEM aDrawingSheet)
inline

Definition at line 97 of file drc_engine.h.

References m_drawingSheet.

◆ SetLogReporter()

void DRC_ENGINE::SetLogReporter ( REPORTER aReporter)
inline

Definition at line 133 of file drc_engine.h.

References m_reporter.

◆ SetMaxProgress()

void DRC_ENGINE::SetMaxProgress ( int  aSize)

Definition at line 1640 of file drc_engine.cpp.

References m_progressReporter, and PROGRESS_REPORTER::SetMaxProgress().

◆ SetProgressReporter()

void DRC_ENGINE::SetProgressReporter ( PROGRESS_REPORTER aProgRep)
inline

Set an optional reporter for user-level progress info.

Definition at line 123 of file drc_engine.h.

References m_progressReporter.

◆ SetSchematicNetlist()

void DRC_ENGINE::SetSchematicNetlist ( NETLIST aNetlist)
inline

Definition at line 94 of file drc_engine.h.

References m_schematicNetlist.

◆ SetUserUnits()

◆ SetViolationHandler()

void DRC_ENGINE::SetViolationHandler ( DRC_VIOLATION_HANDLER  aHandler)
inline

Set an optional DRC violation handler (receives DRC_ITEMs and positions).

Definition at line 110 of file drc_engine.h.

References m_violationHandler.

Referenced by DoCourtyardInvalidTest(), and DoCourtyardOverlapTest().

◆ StringFromValue() [1/2]

wxString UNITS_PROVIDER::StringFromValue ( const EDA_ANGLE aValue,
bool  aAddUnitLabel = false 
) const
inlineinherited

◆ StringFromValue() [2/2]

wxString UNITS_PROVIDER::StringFromValue ( double  aValue,
bool  aAddUnitLabel = false,
EDA_DATA_TYPE  aType = EDA_DATA_TYPE::DISTANCE 
) const
inlineinherited

Converts aValue in internal units into a united string.

For readability, trailing 0s are removed if the mantissa has 3 or more digits. This function should be used to display values in dialogs because a value entered in mm (for instance 2.0 mm) could need up to 8 digits mantissa if displayed in inch to avoid truncation or rounding made just by the printf function.

Parameters
aValue= value in internal units
aAddUnitLabel= true to add symbol unit to the string value
aTypeis the type of this value, and controls the way the value is converted to a string, and the suitable unit
Returns
A wxString object containing value and optionally the symbol unit (like 2.000 mm)

Definition at line 81 of file units_provider.h.

References UNITS_PROVIDER::GetIuScale(), UNITS_PROVIDER::GetUserUnits(), and EDA_UNIT_UTILS::UI::StringFromValue().

Referenced by DIALOG_PLOT::applyPlotSettings(), PANEL_SETUP_BOARD_STACKUP::computeBoardThickness(), MICROWAVE_TOOL::createFootprint(), MICROWAVE_TOOL::createMicrowaveInductor(), DIALOG_TRACK_VIA_PROPERTIES::DIALOG_TRACK_VIA_PROPERTIES(), DRAWING_TOOL::DrawSpecificationStackup(), VALIDATION_ERROR_TOO_LARGE< T >::Format(), VALIDATION_ERROR_TOO_SMALL< T >::Format(), DRC_TEST_PROVIDER::formatMsg(), PIN_TABLE_DATA_MODEL::GetValue(), FIELDS_GRID_TABLE::GetValue(), FP_TEXT_GRID_TABLE::GetValue(), BOARD_INSPECTION_TOOL::InspectClearance(), BOARD_INSPECTION_TOOL::InspectDRCError(), PANEL_SETUP_BOARD_STACKUP::lazyBuildRowUI(), PANEL_SETUP_BOARD_STACKUP::onAdjustDielectricThickness(), WX_GRID::onCellEditorHidden(), DIALOG_TRACK_VIA_PROPERTIES::onUnitsChanged(), reportMax(), reportMin(), reportOpt(), PANEL_SETUP_BOARD_STACKUP::setDefaultLayerWidths(), WX_GRID::SetUnitValue(), PANEL_SETUP_BOARD_STACKUP::synchronizeWithBoard(), PANEL_FP_EDITOR_DEFAULTS::TransferDataFromWindow(), PANEL_SETUP_TEXT_AND_GRAPHICS::TransferDataFromWindow(), PANEL_SETUP_CONSTRAINTS::TransferDataToWindow(), DIALOG_FOOTPRINT_PROPERTIES::Validate(), and DIALOG_FOOTPRINT_PROPERTIES_FP_EDITOR::Validate().

◆ ValueFromString()

Member Data Documentation

◆ m_board

BOARD* DRC_ENGINE::m_board
protected

Definition at line 232 of file drc_engine.h.

Referenced by EvalRules(), GetBoard(), InitEngine(), loadImplicitRules(), RunTests(), and SetBoard().

◆ m_constraintMap

std::map<DRC_CONSTRAINT_T, std::vector<DRC_ENGINE_CONSTRAINT*>*> DRC_ENGINE::m_constraintMap
protected

◆ m_debugOverlay

std::shared_ptr<KIGFX::VIEW_OVERLAY> DRC_ENGINE::m_debugOverlay
protected

Definition at line 251 of file drc_engine.h.

Referenced by GetDebugOverlay(), and SetDebugOverlay().

◆ m_designSettings

BOARD_DESIGN_SETTINGS* DRC_ENGINE::m_designSettings
protected

Definition at line 231 of file drc_engine.h.

Referenced by EvalRules(), GetDesignSettings(), RunTests(), and SetDesignSettings().

◆ m_drawingSheet

DS_PROXY_VIEW_ITEM* DRC_ENGINE::m_drawingSheet
protected

Definition at line 233 of file drc_engine.h.

Referenced by GetDrawingSheet(), and SetDrawingSheet().

◆ m_errorLimits

std::vector<int> DRC_ENGINE::m_errorLimits
protected

Definition at line 240 of file drc_engine.h.

Referenced by DRC_ENGINE(), InitEngine(), IsErrorLimitExceeded(), ReportViolation(), and RunTests().

◆ m_iuScale

const EDA_IU_SCALE& UNITS_PROVIDER::m_iuScale
privateinherited

Definition at line 147 of file units_provider.h.

Referenced by UNITS_PROVIDER::GetIuScale().

◆ m_progressReporter

◆ m_reportAllTrackErrors

bool DRC_ENGINE::m_reportAllTrackErrors
protected

Definition at line 241 of file drc_engine.h.

Referenced by GetReportAllTrackErrors(), and RunTests().

◆ m_reporter

REPORTER* DRC_ENGINE::m_reporter
protected

Definition at line 248 of file drc_engine.h.

Referenced by loadRules(), ReportAux(), ReportViolation(), and SetLogReporter().

◆ m_rules

std::vector<std::shared_ptr<DRC_RULE> > DRC_ENGINE::m_rules
protected

Definition at line 236 of file drc_engine.h.

Referenced by addRule(), compileRules(), InitEngine(), loadRules(), and ~DRC_ENGINE().

◆ m_rulesValid

bool DRC_ENGINE::m_rulesValid
protected

Definition at line 237 of file drc_engine.h.

Referenced by InitEngine(), and RulesValid().

◆ m_schematicNetlist

NETLIST* DRC_ENGINE::m_schematicNetlist
protected

Definition at line 234 of file drc_engine.h.

Referenced by GetSchematicNetlist(), and SetSchematicNetlist().

◆ m_testFootprints

bool DRC_ENGINE::m_testFootprints
protected

Definition at line 242 of file drc_engine.h.

Referenced by GetTestFootprints(), and RunTests().

◆ m_testProviders

std::vector<DRC_TEST_PROVIDER*> DRC_ENGINE::m_testProviders
protected

Definition at line 238 of file drc_engine.h.

Referenced by GetTestProvider(), GetTestProviders(), InitEngine(), and RunTests().

◆ m_userUnits

EDA_UNITS UNITS_PROVIDER::m_userUnits
privateinherited

Definition at line 148 of file units_provider.h.

Referenced by UNITS_PROVIDER::GetUserUnits(), and UNITS_PROVIDER::SetUserUnits().

◆ m_violationHandler

DRC_VIOLATION_HANDLER DRC_ENGINE::m_violationHandler
protected

Definition at line 247 of file drc_engine.h.

Referenced by ClearViolationHandler(), ReportViolation(), and SetViolationHandler().


The documentation for this class was generated from the following files: