2020-08-25 17:42:52 +00:00
|
|
|
/*
|
|
|
|
* This program source code file is part of KiCad, a free EDA CAD application.
|
|
|
|
*
|
2023-02-28 15:34:07 +00:00
|
|
|
* Copyright (C) 2004-2023 KiCad Developers.
|
2020-08-25 17:42:52 +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
|
|
|
|
*/
|
|
|
|
|
2021-06-06 19:03:10 +00:00
|
|
|
#include <board_design_settings.h>
|
2020-09-11 21:50:53 +00:00
|
|
|
#include <drc/drc_engine.h>
|
2020-09-11 15:04:11 +00:00
|
|
|
#include <drc/drc_item.h>
|
|
|
|
#include <drc/drc_rule.h>
|
2021-09-22 21:20:18 +00:00
|
|
|
#include <drc/drc_rule_condition.h>
|
2020-09-11 21:50:53 +00:00
|
|
|
#include <drc/drc_test_provider.h>
|
2021-09-09 15:29:57 +00:00
|
|
|
#include <pad.h>
|
|
|
|
#include <pcb_track.h>
|
2020-08-25 17:42:52 +00:00
|
|
|
|
2021-02-22 23:47:17 +00:00
|
|
|
#include <drawing_sheet/ds_draw_item.h>
|
|
|
|
#include <drawing_sheet/ds_proxy_view_item.h>
|
2020-08-25 17:42:52 +00:00
|
|
|
|
|
|
|
/*
|
|
|
|
Miscellaneous tests:
|
|
|
|
|
|
|
|
- DRCE_DISABLED_LAYER_ITEM, ///< item on a disabled layer
|
|
|
|
- DRCE_INVALID_OUTLINE, ///< invalid board outline
|
|
|
|
- DRCE_UNRESOLVED_VARIABLE,
|
2021-09-22 21:20:18 +00:00
|
|
|
- DRCE_ASSERTION_FAILURE ///< user-defined assertions
|
2020-08-25 17:42:52 +00:00
|
|
|
*/
|
|
|
|
|
|
|
|
class DRC_TEST_PROVIDER_MISC : public DRC_TEST_PROVIDER
|
|
|
|
{
|
|
|
|
public:
|
2020-09-16 10:27:46 +00:00
|
|
|
DRC_TEST_PROVIDER_MISC() :
|
|
|
|
m_board( nullptr )
|
2020-08-25 17:42:52 +00:00
|
|
|
{
|
|
|
|
m_isRuleDriven = false;
|
|
|
|
}
|
|
|
|
|
|
|
|
virtual ~DRC_TEST_PROVIDER_MISC()
|
|
|
|
{
|
|
|
|
}
|
|
|
|
|
|
|
|
virtual bool Run() override;
|
|
|
|
|
|
|
|
virtual const wxString GetName() const override
|
|
|
|
{
|
2022-03-11 21:16:52 +00:00
|
|
|
return wxT( "miscellaneous" );
|
2020-08-25 17:42:52 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
virtual const wxString GetDescription() const override
|
|
|
|
{
|
2022-03-11 21:16:52 +00:00
|
|
|
return wxT( "Misc checks (board outline, missing textvars)" );
|
2020-08-25 17:42:52 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
private:
|
|
|
|
void testOutline();
|
|
|
|
void testDisabledLayers();
|
|
|
|
void testTextVars();
|
2021-09-22 21:20:18 +00:00
|
|
|
void testAssertions();
|
2020-08-25 17:42:52 +00:00
|
|
|
|
|
|
|
BOARD* m_board;
|
|
|
|
};
|
|
|
|
|
|
|
|
|
2020-09-11 21:50:53 +00:00
|
|
|
void DRC_TEST_PROVIDER_MISC::testOutline()
|
2020-08-25 17:42:52 +00:00
|
|
|
{
|
2020-12-24 21:00:41 +00:00
|
|
|
SHAPE_POLY_SET dummyOutline;
|
2020-11-24 14:22:05 +00:00
|
|
|
bool errorHandled = false;
|
|
|
|
|
2020-11-21 20:42:27 +00:00
|
|
|
OUTLINE_ERROR_HANDLER errorHandler =
|
2022-01-01 06:04:08 +00:00
|
|
|
[&]( const wxString& msg, BOARD_ITEM* itemA, BOARD_ITEM* itemB, const VECTOR2I& pt )
|
2020-11-21 20:42:27 +00:00
|
|
|
{
|
2023-10-22 15:14:19 +00:00
|
|
|
errorHandled = true;
|
|
|
|
|
|
|
|
if( m_drcEngine->IsErrorLimitExceeded( DRCE_INVALID_OUTLINE ) )
|
|
|
|
return;
|
|
|
|
|
2023-08-18 09:30:03 +00:00
|
|
|
if( !itemA ) // If we only have a single item, make sure it's A
|
|
|
|
std::swap( itemA, itemB );
|
|
|
|
|
2020-11-21 20:42:27 +00:00
|
|
|
std::shared_ptr<DRC_ITEM> drcItem = DRC_ITEM::Create( DRCE_INVALID_OUTLINE );
|
2020-08-25 17:42:52 +00:00
|
|
|
|
2020-11-21 20:42:27 +00:00
|
|
|
drcItem->SetErrorMessage( drcItem->GetErrorText() + wxS( " " ) + msg );
|
|
|
|
drcItem->SetItems( itemA, itemB );
|
2020-10-22 20:27:46 +00:00
|
|
|
|
2021-12-26 13:47:00 +00:00
|
|
|
reportViolation( drcItem, pt, Edge_Cuts );
|
2020-11-21 20:42:27 +00:00
|
|
|
};
|
2020-11-20 13:55:10 +00:00
|
|
|
|
2023-10-12 13:53:05 +00:00
|
|
|
// Test for very small graphic items (a few nm size) that can create issues
|
|
|
|
// when trying to build the board outlines, and they are not easy to locate onn screen.
|
|
|
|
const int minSizeForValideGraphics = pcbIUScale.mmToIU( 0.001 );
|
2020-12-24 21:00:41 +00:00
|
|
|
|
2023-10-12 13:53:05 +00:00
|
|
|
if( !TestBoardOutlinesGraphicItems(m_board, minSizeForValideGraphics, &errorHandler ) )
|
2023-10-12 12:03:58 +00:00
|
|
|
{
|
|
|
|
if( errorHandled )
|
|
|
|
{
|
|
|
|
// if there are invalid items on Edge.Cuts, they are already reported
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
std::shared_ptr<DRC_ITEM> drcItem = DRC_ITEM::Create( DRCE_INVALID_OUTLINE );
|
|
|
|
wxString msg;
|
|
|
|
|
|
|
|
msg.Printf( _( "(Suspicious items found on Edge.Cuts layer)" ) );
|
|
|
|
|
|
|
|
drcItem->SetErrorMessage( drcItem->GetErrorText() + wxS( " " ) + msg );
|
|
|
|
drcItem->SetItems( m_board );
|
|
|
|
|
|
|
|
reportViolation( drcItem, m_board->GetBoundingBox().Centre(), Edge_Cuts );
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2023-10-12 13:53:05 +00:00
|
|
|
// Use the standard chaining epsilon here so that we report errors that might affect
|
|
|
|
// other tools (such as 3D viewer).
|
|
|
|
int chainingEpsilon = m_board->GetOutlinesChainingEpsilon();
|
|
|
|
|
2020-12-25 12:07:10 +00:00
|
|
|
if( !BuildBoardPolygonOutlines( m_board, dummyOutline, m_board->GetDesignSettings().m_MaxError,
|
|
|
|
chainingEpsilon, &errorHandler ) )
|
2020-11-21 20:42:27 +00:00
|
|
|
{
|
2020-11-24 14:22:05 +00:00
|
|
|
if( errorHandled )
|
|
|
|
{
|
|
|
|
// if there is an invalid outline, then there must be an outline
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
std::shared_ptr<DRC_ITEM> drcItem = DRC_ITEM::Create( DRCE_INVALID_OUTLINE );
|
2022-06-15 23:42:34 +00:00
|
|
|
wxString msg;
|
2020-08-25 17:42:52 +00:00
|
|
|
|
2022-06-15 23:42:34 +00:00
|
|
|
msg.Printf( _( "(no edges found on Edge.Cuts layer)" ) );
|
2020-08-25 17:42:52 +00:00
|
|
|
|
2022-06-15 23:42:34 +00:00
|
|
|
drcItem->SetErrorMessage( drcItem->GetErrorText() + wxS( " " ) + msg );
|
2020-11-24 14:22:05 +00:00
|
|
|
drcItem->SetItems( m_board );
|
2020-10-22 20:27:46 +00:00
|
|
|
|
2022-01-02 02:06:40 +00:00
|
|
|
reportViolation( drcItem, m_board->GetBoundingBox().Centre(), Edge_Cuts );
|
2020-11-24 14:22:05 +00:00
|
|
|
}
|
2020-10-22 20:27:46 +00:00
|
|
|
}
|
2020-08-25 17:42:52 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2020-09-11 21:50:53 +00:00
|
|
|
void DRC_TEST_PROVIDER_MISC::testDisabledLayers()
|
2020-08-25 17:42:52 +00:00
|
|
|
{
|
2022-08-03 09:10:23 +00:00
|
|
|
const int progressDelta = 2000;
|
2021-09-22 21:20:18 +00:00
|
|
|
int ii = 0;
|
|
|
|
int items = 0;
|
|
|
|
|
|
|
|
auto countItems =
|
|
|
|
[&]( BOARD_ITEM* item ) -> bool
|
|
|
|
{
|
|
|
|
++items;
|
|
|
|
return true;
|
|
|
|
};
|
|
|
|
|
2020-08-25 17:42:52 +00:00
|
|
|
LSET disabledLayers = m_board->GetEnabledLayers().flip();
|
|
|
|
|
|
|
|
// Perform the test only for copper layers
|
|
|
|
disabledLayers &= LSET::AllCuMask();
|
|
|
|
|
2020-09-11 21:50:53 +00:00
|
|
|
auto checkDisabledLayers =
|
|
|
|
[&]( BOARD_ITEM* item ) -> bool
|
|
|
|
{
|
2021-09-22 21:20:18 +00:00
|
|
|
if( m_drcEngine->IsErrorLimitExceeded( DRCE_DISABLED_LAYER_ITEM ) )
|
|
|
|
return false;
|
|
|
|
|
2022-08-03 09:10:23 +00:00
|
|
|
if( !reportProgress( ii++, items, progressDelta ) )
|
2021-09-22 21:20:18 +00:00
|
|
|
return false;
|
|
|
|
|
2021-09-11 22:53:19 +00:00
|
|
|
PCB_LAYER_ID badLayer = UNDEFINED_LAYER;
|
2021-09-09 15:29:57 +00:00
|
|
|
|
|
|
|
if( item->Type() == PCB_PAD_T )
|
|
|
|
{
|
|
|
|
PAD* pad = static_cast<PAD*>( item );
|
|
|
|
|
|
|
|
if( pad->GetAttribute() == PAD_ATTRIB::SMD
|
|
|
|
|| pad->GetAttribute() == PAD_ATTRIB::CONN )
|
|
|
|
{
|
2022-02-18 14:19:13 +00:00
|
|
|
if( disabledLayers.test( pad->GetPrincipalLayer() ) )
|
2021-09-11 22:53:19 +00:00
|
|
|
badLayer = item->GetLayer();
|
2021-09-09 15:29:57 +00:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2022-04-23 20:29:46 +00:00
|
|
|
// Through hole pad pierces all physical layers.
|
2021-09-09 15:29:57 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
else if( item->Type() == PCB_VIA_T )
|
|
|
|
{
|
|
|
|
PCB_VIA* via = static_cast<PCB_VIA*>( item );
|
|
|
|
PCB_LAYER_ID top;
|
|
|
|
PCB_LAYER_ID bottom;
|
|
|
|
|
|
|
|
via->LayerPair( &top, &bottom );
|
|
|
|
|
2021-09-11 22:53:19 +00:00
|
|
|
if( disabledLayers.test( top ) )
|
|
|
|
badLayer = top;
|
|
|
|
else if( disabledLayers.test( bottom ) )
|
|
|
|
badLayer = bottom;
|
|
|
|
}
|
2023-03-30 11:49:23 +00:00
|
|
|
else if( item->Type() == PCB_ZONE_T )
|
2021-09-11 22:53:19 +00:00
|
|
|
{
|
|
|
|
// Footprint zones just get a top/bottom/inner setting, so they're on
|
|
|
|
// whatever inner layers there are.
|
2021-09-09 15:29:57 +00:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2021-09-11 22:53:19 +00:00
|
|
|
LSET badLayers = disabledLayers & item->GetLayerSet();
|
|
|
|
|
|
|
|
if( badLayers.any() )
|
|
|
|
badLayer = badLayers.Seq().front();
|
2021-09-09 15:29:57 +00:00
|
|
|
}
|
|
|
|
|
2021-09-11 22:53:19 +00:00
|
|
|
if( badLayer != UNDEFINED_LAYER )
|
2020-09-11 21:50:53 +00:00
|
|
|
{
|
2021-09-22 21:20:18 +00:00
|
|
|
auto drcItem = DRC_ITEM::Create( DRCE_DISABLED_LAYER_ITEM );
|
2022-06-15 23:42:34 +00:00
|
|
|
wxString msg;
|
2020-08-25 17:42:52 +00:00
|
|
|
|
2022-06-15 23:42:34 +00:00
|
|
|
msg.Printf( _( "(layer %s)" ), LayerName( badLayer ) );
|
2020-08-25 17:42:52 +00:00
|
|
|
|
2022-06-15 23:42:34 +00:00
|
|
|
drcItem->SetErrorMessage( drcItem->GetErrorText() + wxS( " " ) + msg );
|
2020-09-11 21:50:53 +00:00
|
|
|
drcItem->SetItems( item );
|
2020-08-25 17:42:52 +00:00
|
|
|
|
2021-12-26 13:47:00 +00:00
|
|
|
reportViolation( drcItem, item->GetPosition(), UNDEFINED_LAYER );
|
2020-09-11 21:50:53 +00:00
|
|
|
}
|
2021-09-09 15:29:57 +00:00
|
|
|
|
2020-09-11 21:50:53 +00:00
|
|
|
return true;
|
|
|
|
};
|
2020-08-25 17:42:52 +00:00
|
|
|
|
2021-09-22 21:20:18 +00:00
|
|
|
forEachGeometryItem( s_allBasicItems, LSET::AllLayersMask(), countItems );
|
2021-09-09 14:17:19 +00:00
|
|
|
forEachGeometryItem( s_allBasicItems, LSET::AllLayersMask(), checkDisabledLayers );
|
2020-08-25 17:42:52 +00:00
|
|
|
}
|
|
|
|
|
2021-09-09 14:17:19 +00:00
|
|
|
|
2021-09-22 21:20:18 +00:00
|
|
|
void DRC_TEST_PROVIDER_MISC::testAssertions()
|
|
|
|
{
|
2022-08-03 09:10:23 +00:00
|
|
|
const int progressDelta = 2000;
|
2021-09-22 21:20:18 +00:00
|
|
|
int ii = 0;
|
|
|
|
int items = 0;
|
|
|
|
|
|
|
|
auto countItems =
|
|
|
|
[&]( BOARD_ITEM* item ) -> bool
|
|
|
|
{
|
|
|
|
++items;
|
|
|
|
return true;
|
|
|
|
};
|
|
|
|
|
|
|
|
auto checkAssertions =
|
|
|
|
[&]( BOARD_ITEM* item ) -> bool
|
|
|
|
{
|
|
|
|
if( m_drcEngine->IsErrorLimitExceeded( DRCE_ASSERTION_FAILURE ) )
|
|
|
|
return false;
|
|
|
|
|
2022-08-03 09:10:23 +00:00
|
|
|
if( !reportProgress( ii++, items, progressDelta ) )
|
2021-09-22 21:20:18 +00:00
|
|
|
return false;
|
|
|
|
|
|
|
|
m_drcEngine->ProcessAssertions( item,
|
|
|
|
[&]( const DRC_CONSTRAINT* c )
|
|
|
|
{
|
|
|
|
auto drcItem = DRC_ITEM::Create( DRCE_ASSERTION_FAILURE );
|
|
|
|
drcItem->SetErrorMessage( drcItem->GetErrorText() + wxS( " (" )
|
|
|
|
+ c->GetName() + wxS( ")" ) );
|
|
|
|
drcItem->SetItems( item );
|
2023-04-29 19:51:32 +00:00
|
|
|
drcItem->SetViolatingRule( c->GetParentRule() );
|
2021-09-22 21:20:18 +00:00
|
|
|
|
2021-12-26 13:47:00 +00:00
|
|
|
reportViolation( drcItem, item->GetPosition(), item->GetLayer() );
|
2021-09-22 21:20:18 +00:00
|
|
|
} );
|
|
|
|
|
|
|
|
return true;
|
|
|
|
};
|
|
|
|
|
|
|
|
forEachGeometryItem( {}, LSET::AllLayersMask(), countItems );
|
|
|
|
forEachGeometryItem( {}, LSET::AllLayersMask(), checkAssertions );
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2020-09-11 21:50:53 +00:00
|
|
|
void DRC_TEST_PROVIDER_MISC::testTextVars()
|
2020-08-25 17:42:52 +00:00
|
|
|
{
|
2022-08-03 09:10:23 +00:00
|
|
|
const int progressDelta = 2000;
|
2021-09-22 21:20:18 +00:00
|
|
|
int ii = 0;
|
|
|
|
int items = 0;
|
|
|
|
|
2022-03-09 00:47:37 +00:00
|
|
|
static const std::vector<KICAD_T> itemTypes = {
|
2023-06-06 15:09:34 +00:00
|
|
|
PCB_FIELD_T,
|
2023-03-30 11:49:23 +00:00
|
|
|
PCB_TEXT_T,
|
|
|
|
PCB_TEXTBOX_T,
|
2022-03-09 00:47:37 +00:00
|
|
|
PCB_DIMENSION_T
|
|
|
|
};
|
|
|
|
|
|
|
|
forEachGeometryItem( itemTypes, LSET::AllLayersMask(),
|
2021-09-22 21:20:18 +00:00
|
|
|
[&]( BOARD_ITEM* item ) -> bool
|
|
|
|
{
|
|
|
|
++items;
|
|
|
|
return true;
|
2022-03-09 00:47:37 +00:00
|
|
|
} );
|
2021-09-22 21:20:18 +00:00
|
|
|
|
2022-03-09 00:47:37 +00:00
|
|
|
forEachGeometryItem( itemTypes, LSET::AllLayersMask(),
|
|
|
|
[&]( BOARD_ITEM* item ) -> bool
|
2020-09-11 21:50:53 +00:00
|
|
|
{
|
2020-09-12 19:28:22 +00:00
|
|
|
if( m_drcEngine->IsErrorLimitExceeded( DRCE_UNRESOLVED_VARIABLE ) )
|
|
|
|
return false;
|
2020-08-25 17:42:52 +00:00
|
|
|
|
2022-08-03 09:10:23 +00:00
|
|
|
if( !reportProgress( ii++, items, progressDelta ) )
|
2021-09-22 21:20:18 +00:00
|
|
|
return false;
|
|
|
|
|
2021-12-26 13:47:00 +00:00
|
|
|
BOARD_ITEM* boardItem = dynamic_cast<BOARD_ITEM*>( item );
|
|
|
|
EDA_TEXT* text = dynamic_cast<EDA_TEXT*>( boardItem );
|
2020-08-25 17:42:52 +00:00
|
|
|
|
2022-03-25 19:51:05 +00:00
|
|
|
wxCHECK( boardItem, false );
|
|
|
|
|
2023-05-05 13:21:56 +00:00
|
|
|
if( text && text->GetShownText( true ).Matches( wxT( "*${*}*" ) ) )
|
2020-09-11 21:50:53 +00:00
|
|
|
{
|
|
|
|
std::shared_ptr<DRC_ITEM>drcItem = DRC_ITEM::Create( DRCE_UNRESOLVED_VARIABLE );
|
|
|
|
drcItem->SetItems( item );
|
2020-08-25 17:42:52 +00:00
|
|
|
|
2021-12-26 13:47:00 +00:00
|
|
|
reportViolation( drcItem, boardItem->GetPosition(), boardItem->GetLayer() );
|
2020-09-11 21:50:53 +00:00
|
|
|
}
|
2022-03-25 19:51:05 +00:00
|
|
|
|
2020-09-11 21:50:53 +00:00
|
|
|
return true;
|
2022-03-09 00:47:37 +00:00
|
|
|
} );
|
2020-08-25 17:42:52 +00:00
|
|
|
|
2021-02-22 23:47:17 +00:00
|
|
|
DS_PROXY_VIEW_ITEM* drawingSheet = m_drcEngine->GetDrawingSheet();
|
2023-06-12 21:33:55 +00:00
|
|
|
DS_DRAW_ITEM_LIST drawItems( pcbIUScale );
|
2020-08-25 17:42:52 +00:00
|
|
|
|
2021-02-22 16:37:43 +00:00
|
|
|
if( !drawingSheet || m_drcEngine->IsErrorLimitExceeded( DRCE_UNRESOLVED_VARIABLE ) )
|
2020-08-25 17:42:52 +00:00
|
|
|
return;
|
|
|
|
|
2022-03-11 21:16:52 +00:00
|
|
|
drawItems.SetPageNumber( wxT( "1" ) );
|
2021-02-22 16:37:43 +00:00
|
|
|
drawItems.SetSheetCount( 1 );
|
2022-03-11 21:16:52 +00:00
|
|
|
drawItems.SetFileName( wxT( "dummyFilename" ) );
|
|
|
|
drawItems.SetSheetName( wxT( "dummySheet" ) );
|
|
|
|
drawItems.SetSheetLayer( wxT( "dummyLayer" ) );
|
2021-02-22 16:37:43 +00:00
|
|
|
drawItems.SetProject( m_board->GetProject() );
|
|
|
|
drawItems.BuildDrawItemsList( drawingSheet->GetPageInfo(), drawingSheet->GetTitleBlock() );
|
2020-08-25 17:42:52 +00:00
|
|
|
|
2021-02-22 23:47:17 +00:00
|
|
|
for( DS_DRAW_ITEM_BASE* item = drawItems.GetFirst(); item; item = drawItems.GetNext() )
|
2020-08-25 17:42:52 +00:00
|
|
|
{
|
2020-09-12 19:28:22 +00:00
|
|
|
if( m_drcEngine->IsErrorLimitExceeded( DRCE_UNRESOLVED_VARIABLE ) )
|
|
|
|
break;
|
2020-08-25 17:42:52 +00:00
|
|
|
|
2022-03-11 20:13:47 +00:00
|
|
|
if( m_drcEngine->IsCancelled() )
|
|
|
|
return;
|
|
|
|
|
2021-02-22 23:47:17 +00:00
|
|
|
DS_DRAW_ITEM_TEXT* text = dynamic_cast<DS_DRAW_ITEM_TEXT*>( item );
|
2020-09-12 19:28:22 +00:00
|
|
|
|
2023-05-05 13:21:56 +00:00
|
|
|
if( text && text->GetShownText( true ).Matches( wxT( "*${*}*" ) ) )
|
2020-09-12 19:28:22 +00:00
|
|
|
{
|
|
|
|
std::shared_ptr<DRC_ITEM> drcItem = DRC_ITEM::Create( DRCE_UNRESOLVED_VARIABLE );
|
2022-08-15 16:59:34 +00:00
|
|
|
drcItem->SetItems( drawingSheet );
|
2020-08-25 17:42:52 +00:00
|
|
|
|
2022-08-15 16:59:34 +00:00
|
|
|
reportViolation( drcItem, text->GetPosition(), LAYER_DRAWINGSHEET );
|
2020-08-25 17:42:52 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2020-09-11 21:50:53 +00:00
|
|
|
bool DRC_TEST_PROVIDER_MISC::Run()
|
2020-08-25 17:42:52 +00:00
|
|
|
{
|
|
|
|
m_board = m_drcEngine->GetBoard();
|
|
|
|
|
2021-02-27 13:43:41 +00:00
|
|
|
if( !m_drcEngine->IsErrorLimitExceeded( DRCE_INVALID_OUTLINE ) )
|
|
|
|
{
|
|
|
|
if( !reportPhase( _( "Checking board outline..." ) ) )
|
|
|
|
return false; // DRC cancelled
|
2020-09-18 19:57:54 +00:00
|
|
|
|
2021-02-27 13:43:41 +00:00
|
|
|
testOutline();
|
|
|
|
}
|
2020-08-25 17:42:52 +00:00
|
|
|
|
2021-02-27 13:43:41 +00:00
|
|
|
if( !m_drcEngine->IsErrorLimitExceeded( DRCE_DISABLED_LAYER_ITEM ) )
|
|
|
|
{
|
|
|
|
if( !reportPhase( _( "Checking disabled layers..." ) ) )
|
|
|
|
return false; // DRC cancelled
|
2020-09-18 19:57:54 +00:00
|
|
|
|
2021-02-27 13:43:41 +00:00
|
|
|
testDisabledLayers();
|
|
|
|
}
|
2020-08-25 17:42:52 +00:00
|
|
|
|
2021-02-27 13:43:41 +00:00
|
|
|
if( !m_drcEngine->IsErrorLimitExceeded( DRCE_UNRESOLVED_VARIABLE ) )
|
|
|
|
{
|
|
|
|
if( !reportPhase( _( "Checking text variables..." ) ) )
|
|
|
|
return false; // DRC cancelled
|
2020-09-18 19:57:54 +00:00
|
|
|
|
2021-02-27 13:43:41 +00:00
|
|
|
testTextVars();
|
|
|
|
}
|
2020-08-25 17:42:52 +00:00
|
|
|
|
2021-09-22 21:20:18 +00:00
|
|
|
if( !m_drcEngine->IsErrorLimitExceeded( DRCE_ASSERTION_FAILURE ) )
|
|
|
|
{
|
|
|
|
if( !reportPhase( _( "Checking assertions..." ) ) )
|
|
|
|
return false; // DRC cancelled
|
|
|
|
|
|
|
|
testAssertions();
|
|
|
|
}
|
|
|
|
|
2022-03-11 20:13:47 +00:00
|
|
|
return !m_drcEngine->IsCancelled();
|
2020-08-25 17:42:52 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
namespace detail
|
|
|
|
{
|
2020-09-11 21:50:53 +00:00
|
|
|
static DRC_REGISTER_TEST_PROVIDER<DRC_TEST_PROVIDER_MISC> dummy;
|
2020-08-25 17:42:52 +00:00
|
|
|
}
|