60 virtual bool Run()
override;
62 virtual const wxString
GetName()
const override
64 return wxT(
"miscellaneous" );
69 return wxT(
"Misc checks (board outline, missing textvars)" );
85 bool errorHandled =
false;
96 std::swap( itemA, itemB );
100 drcItem->SetErrorMessage( drcItem->GetErrorText() + wxS(
" " ) + msg );
101 drcItem->SetItems( itemA, itemB );
121 msg.Printf(
_(
"(Suspicious items found on Edge.Cuts layer)" ) );
123 drcItem->SetErrorMessage( drcItem->GetErrorText() + wxS(
" " ) + msg );
136 chainingEpsilon, &errorHandler ) )
147 msg.Printf(
_(
"(no edges found on Edge.Cuts layer)" ) );
149 drcItem->SetErrorMessage( drcItem->GetErrorText() + wxS(
" " ) + msg );
160 const int progressDelta = 2000;
176 auto checkDisabledLayers =
191 if(
pad->GetAttribute() == PAD_ATTRIB::SMD
192 ||
pad->GetAttribute() == PAD_ATTRIB::CONN )
194 if( disabledLayers.test(
pad->GetPrincipalLayer() ) )
208 via->LayerPair( &top, &bottom );
210 if( disabledLayers.test( top ) )
212 else if( disabledLayers.test( bottom ) )
222 LSET badLayers = disabledLayers & item->GetLayerSet();
224 if( badLayers.any() )
225 badLayer = badLayers.
Seq().front();
233 msg.Printf(
_(
"(layer %s)" ),
LayerName( badLayer ) );
235 drcItem->SetErrorMessage( drcItem->GetErrorText() + wxS(
" " ) + msg );
236 drcItem->SetItems( item );
251 const int progressDelta = 2000;
262 auto checkAssertions =
274 drcItem->SetErrorMessage( drcItem->GetErrorText() + wxS(
" (" )
276 drcItem->SetItems( item );
287 static wxRegEx warningExpr( wxS(
"^\\$\\{DRC_WARNING\\s*([^}]*)\\}(.*)$" ) );
289 wxString
text = textItem->GetText();
291 if( warningExpr.Matches(
text ) )
294 drcItem->SetItems( item );
295 drcItem->SetErrorMessage( warningExpr.GetMatch(
text, 1 ) );
306 static wxRegEx errorExpr( wxS(
"^\\$\\{DRC_ERROR\\s*([^}]*)\\}(.*)$" ) );
308 wxString
text = textItem->GetText();
310 if( errorExpr.Matches(
text ) )
313 drcItem->SetItems( item );
314 drcItem->SetErrorMessage( errorExpr.GetMatch(
text, 1 ) );
331 const int progressDelta = 2000;
335 static const std::vector<KICAD_T> itemTypes = {
363 if( result.Matches( wxT(
"*${*}*" ) ) )
366 drcItem->SetItems( item );
387 drawItems.
BuildDrawItemsList( drawingSheet->GetPageInfo(), drawingSheet->GetTitleBlock() );
399 if(
text &&
text->GetShownText(
true ).Matches( wxT(
"*${*}*" ) ) )
402 drcItem->SetItems( drawingSheet );
424 if( !
reportPhase(
_(
"Checking disabled layers..." ) ) )
constexpr EDA_IU_SCALE pcbIUScale
BASE_SET & flip(size_t pos)
A base class for any item which can be embedded within the BOARD container class, and therefore insta...
virtual PCB_LAYER_ID GetLayer() const
Return the primary layer this item is on.
Information pertinent to a Pcbnew printed circuit board.
LSET GetEnabledLayers() const
A proxy function that calls the corresponding function in m_BoardSettings.
const BOX2I GetBoundingBox() const override
Return the orthogonal bounding box of this object for display purposes.
int GetOutlinesChainingEpsilon()
PROJECT * GetProject() const
BOARD_DESIGN_SETTINGS & GetDesignSettings() const
constexpr Vec Centre() const
DRC_RULE * GetParentRule() const
DS_PROXY_VIEW_ITEM * GetDrawingSheet() const
bool IsErrorLimitExceeded(int error_code)
void ProcessAssertions(const BOARD_ITEM *a, std::function< void(const DRC_CONSTRAINT *)> aFailureHandler, REPORTER *aReporter=nullptr)
static std::shared_ptr< DRC_ITEM > Create(int aErrorCode)
Constructs a DRC_ITEM for the given error code.
virtual const wxString GetName() const override
virtual ~DRC_TEST_PROVIDER_MISC()
void testDisabledLayers()
virtual const wxString GetDescription() const override
virtual bool Run() override
Run this provider against the given PCB with configured options (if any).
Represent a DRC "provider" which runs some DRC functions over a BOARD and spits out DRC_ITEM and posi...
virtual bool reportPhase(const wxString &aStageName)
int forEachGeometryItem(const std::vector< KICAD_T > &aTypes, LSET aLayers, const std::function< bool(BOARD_ITEM *)> &aFunc)
virtual void reportViolation(std::shared_ptr< DRC_ITEM > &item, const VECTOR2I &aMarkerPos, int aMarkerLayer)
static std::vector< KICAD_T > s_allBasicItems
virtual bool reportProgress(size_t aCount, size_t aSize, size_t aDelta=1)
Base class to handle basic graphic items.
Store the list of graphic items: rect, lines, polygons and texts to draw/plot the title block and fra...
DS_DRAW_ITEM_BASE * GetFirst()
void BuildDrawItemsList(const PAGE_INFO &aPageInfo, const TITLE_BLOCK &aTitleBlock)
Drawing or plot the drawing sheet.
void SetFileName(const wxString &aFileName)
Set the filename to draw/plot.
void SetSheetName(const wxString &aSheetName)
Set the sheet name to draw/plot.
void SetSheetLayer(const wxString &aSheetLayer)
Set the sheet layer to draw/plot.
void SetSheetCount(int aSheetCount)
Set the value of the count of sheets, for basic inscriptions.
void SetPageNumber(const wxString &aPageNumber)
Set the value of the sheet number.
DS_DRAW_ITEM_BASE * GetNext()
void SetProject(const PROJECT *aProject)
virtual VECTOR2I GetPosition() const
A mix-in class (via multiple inheritance) that handles texts such as labels, parts,...
LSET is a set of PCB_LAYER_IDs.
static LSET AllLayersMask()
static LSET AllCuMask(int aCuLayerCount=MAX_CU_LAYERS)
Return a mask holding the requested number of Cu PCB_LAYER_IDs.
LSEQ Seq(const LSEQ &aSequence) const
Return an LSEQ from the union of this LSET and a desired sequence.
PCB_LAYER_ID GetLayer() const override
Return the primary layer this item is on.
Represent a set of closed polygons.
const wxString ExpandEnvVarSubstitutions(const wxString &aString, const PROJECT *aProject)
Replace any environment variable & text variable references with their values.
bool TestBoardOutlinesGraphicItems(BOARD *aBoard, int aMinDist, OUTLINE_ERROR_HANDLER *aErrorHandler)
Test a board graphic items on edge cut layer for validity.
bool BuildBoardPolygonOutlines(BOARD *aBoard, SHAPE_POLY_SET &aOutlines, int aErrorMax, int aChainingEpsilon, OUTLINE_ERROR_HANDLER *aErrorHandler, bool aAllowUseArcsInPolygons)
Extract the board outlines and build a closed polygon from lines, arcs and circle items on edge cut l...
const std::function< void(const wxString &msg, BOARD_ITEM *itemA, BOARD_ITEM *itemB, const VECTOR2I &pt)> OUTLINE_ERROR_HANDLER
@ DRCE_DISABLED_LAYER_ITEM
@ DRCE_UNRESOLVED_VARIABLE
wxString LayerName(int aLayer)
Returns the default display name for a given layer.
@ LAYER_DRAWINGSHEET
drawingsheet frame and titleblock
PCB_LAYER_ID
A quick note on layer IDs:
static DRC_REGISTER_TEST_PROVIDER< DRC_TEST_PROVIDER_ANNULAR_WIDTH > dummy
constexpr int mmToIU(double mm) const
@ PCB_VIA_T
class PCB_VIA, a via (like a track segment on a copper layer)
@ PCB_TEXTBOX_T
class PCB_TEXTBOX, wrapped text on a layer
@ PCB_ZONE_T
class ZONE, a copper pour area
@ PCB_TEXT_T
class PCB_TEXT, text on a layer
@ PCB_FIELD_T
class PCB_FIELD, text associated with a footprint property
@ PCB_PAD_T
class PAD, a pad in a footprint
@ PCB_DIMENSION_T
class PCB_DIMENSION_BASE: abstract dimension meta-type