2020-07-27 13:33:06 +00:00
|
|
|
/*
|
|
|
|
* This program source code file is part of KiCad, a free EDA CAD application.
|
|
|
|
*
|
2022-03-11 21:16:52 +00:00
|
|
|
* Copyright (C) 2004-2022 KiCad Developers.
|
2020-07-27 13:33:06 +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
|
|
|
|
*/
|
|
|
|
|
|
|
|
#include <common.h>
|
2020-10-04 23:34:59 +00:00
|
|
|
#include <pcb_shape.h>
|
2022-03-14 19:49:00 +00:00
|
|
|
#include <footprint.h>
|
2020-07-27 13:33:06 +00:00
|
|
|
#include <geometry/seg.h>
|
|
|
|
#include <geometry/shape_segment.h>
|
2020-09-11 16:24:27 +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>
|
2020-09-11 16:24:27 +00:00
|
|
|
#include <drc/drc_test_provider_clearance_base.h>
|
2020-10-27 17:09:27 +00:00
|
|
|
#include "drc_rtree.h"
|
2020-07-27 13:33:06 +00:00
|
|
|
|
|
|
|
/*
|
2020-10-06 12:20:29 +00:00
|
|
|
Board edge clearance test. Checks all items for their mechanical clearances against the board
|
|
|
|
edge.
|
2020-07-27 13:33:06 +00:00
|
|
|
Errors generated:
|
2021-08-15 17:23:54 +00:00
|
|
|
- DRCE_EDGE_CLEARANCE
|
2022-03-14 19:49:00 +00:00
|
|
|
- DRCE_SILK_EDGE_CLEARANCE
|
2020-07-27 13:33:06 +00:00
|
|
|
|
2020-08-11 22:15:50 +00:00
|
|
|
TODO:
|
|
|
|
- separate holes to edge check
|
2020-10-06 12:20:29 +00:00
|
|
|
- tester only looks for edge crossings. it doesn't check if items are inside/outside the board
|
|
|
|
area.
|
2020-09-23 21:49:18 +00:00
|
|
|
- pad test missing!
|
2020-07-27 13:33:06 +00:00
|
|
|
*/
|
|
|
|
|
|
|
|
class DRC_TEST_PROVIDER_EDGE_CLEARANCE : public DRC_TEST_PROVIDER_CLEARANCE_BASE
|
|
|
|
{
|
|
|
|
public:
|
|
|
|
DRC_TEST_PROVIDER_EDGE_CLEARANCE () :
|
2022-06-17 21:50:59 +00:00
|
|
|
DRC_TEST_PROVIDER_CLEARANCE_BASE(),
|
|
|
|
m_largestEdgeClearance( 0 )
|
2020-09-11 16:24:27 +00:00
|
|
|
{
|
|
|
|
}
|
2020-07-27 13:33:06 +00:00
|
|
|
|
2020-08-11 22:17:43 +00:00
|
|
|
virtual ~DRC_TEST_PROVIDER_EDGE_CLEARANCE()
|
2020-07-27 13:33:06 +00:00
|
|
|
{
|
|
|
|
}
|
|
|
|
|
|
|
|
virtual bool Run() override;
|
|
|
|
|
2020-08-11 22:17:43 +00:00
|
|
|
virtual const wxString GetName() const override
|
2020-07-27 13:33:06 +00:00
|
|
|
{
|
2022-03-11 21:16:52 +00:00
|
|
|
return wxT( "edge_clearance" );
|
2020-09-11 16:24:27 +00:00
|
|
|
}
|
2020-07-27 13:33:06 +00:00
|
|
|
|
|
|
|
virtual const wxString GetDescription() const override
|
|
|
|
{
|
2022-03-11 21:16:52 +00:00
|
|
|
return wxT( "Tests items vs board edge clearance" );
|
2020-07-27 13:33:06 +00:00
|
|
|
}
|
|
|
|
|
2020-10-27 17:09:27 +00:00
|
|
|
private:
|
|
|
|
bool testAgainstEdge( BOARD_ITEM* item, SHAPE* itemShape, BOARD_ITEM* other,
|
2021-01-01 22:29:15 +00:00
|
|
|
DRC_CONSTRAINT_T aConstraintType, PCB_DRC_CODE aErrorCode );
|
2022-03-14 23:57:55 +00:00
|
|
|
|
|
|
|
private:
|
|
|
|
std::vector<PAD*> m_castellatedPads;
|
2022-06-17 21:50:59 +00:00
|
|
|
int m_largestEdgeClearance;
|
2020-07-27 13:33:06 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
|
2020-10-27 17:09:27 +00:00
|
|
|
bool DRC_TEST_PROVIDER_EDGE_CLEARANCE::testAgainstEdge( BOARD_ITEM* item, SHAPE* itemShape,
|
|
|
|
BOARD_ITEM* edge,
|
2021-01-01 22:29:15 +00:00
|
|
|
DRC_CONSTRAINT_T aConstraintType,
|
2020-10-27 17:09:27 +00:00
|
|
|
PCB_DRC_CODE aErrorCode )
|
|
|
|
{
|
2022-07-22 22:05:25 +00:00
|
|
|
std::shared_ptr<SHAPE> shape;
|
2022-03-14 19:49:00 +00:00
|
|
|
|
|
|
|
if( edge->Type() == PCB_PAD_T )
|
2022-07-22 22:05:25 +00:00
|
|
|
shape = edge->GetEffectiveHoleShape();
|
|
|
|
else
|
|
|
|
shape = edge->GetEffectiveShape( Edge_Cuts );
|
2020-10-27 17:09:27 +00:00
|
|
|
|
2022-02-18 14:53:10 +00:00
|
|
|
auto constraint = m_drcEngine->EvalRules( aConstraintType, edge, item, UNDEFINED_LAYER );
|
2020-10-27 17:09:27 +00:00
|
|
|
int minClearance = constraint.GetValue().Min();
|
|
|
|
int actual;
|
|
|
|
VECTOR2I pos;
|
|
|
|
|
2021-09-05 15:06:12 +00:00
|
|
|
if( constraint.GetSeverity() != RPT_SEVERITY_IGNORE && minClearance >= 0 )
|
2020-10-27 17:09:27 +00:00
|
|
|
{
|
2022-07-22 22:05:25 +00:00
|
|
|
if( itemShape->Collide( shape.get(), minClearance, &actual, &pos ) )
|
2020-10-27 17:09:27 +00:00
|
|
|
{
|
2023-01-04 00:02:25 +00:00
|
|
|
// Exact clearance is allowed
|
|
|
|
if( minClearance > 0 && actual == minClearance )
|
|
|
|
return true;
|
|
|
|
|
2022-03-14 23:57:55 +00:00
|
|
|
if( item->Type() == PCB_TRACE_T || item->Type() == PCB_ARC_T )
|
|
|
|
{
|
|
|
|
// Edge collisions are allowed inside the holes of castellated pads
|
|
|
|
for( PAD* castellatedPad : m_castellatedPads )
|
|
|
|
{
|
|
|
|
if( castellatedPad->GetEffectiveHoleShape()->Collide( pos ) )
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2021-09-05 15:06:12 +00:00
|
|
|
std::shared_ptr<DRC_ITEM> drce = DRC_ITEM::Create( aErrorCode );
|
2020-10-27 17:09:27 +00:00
|
|
|
|
2021-09-05 15:06:12 +00:00
|
|
|
// Only report clearance info if there is any; otherwise it's just a straight collision
|
|
|
|
if( minClearance > 0 )
|
|
|
|
{
|
2022-10-06 20:52:17 +00:00
|
|
|
wxString msg = formatMsg( _( "(%s clearance %s; actual %s)" ),
|
|
|
|
constraint.GetName(),
|
|
|
|
minClearance,
|
|
|
|
actual );
|
2021-09-05 15:06:12 +00:00
|
|
|
|
2022-06-15 23:42:34 +00:00
|
|
|
drce->SetErrorMessage( drce->GetErrorText() + wxS( " " ) + msg );
|
2021-09-05 15:06:12 +00:00
|
|
|
}
|
2020-10-27 17:09:27 +00:00
|
|
|
|
2021-09-05 15:06:12 +00:00
|
|
|
drce->SetItems( edge->m_Uuid, item->m_Uuid );
|
|
|
|
drce->SetViolatingRule( constraint.GetParentRule() );
|
2020-10-27 17:09:27 +00:00
|
|
|
|
2022-01-02 02:06:40 +00:00
|
|
|
reportViolation( drce, pos, Edge_Cuts );
|
2021-09-05 15:06:12 +00:00
|
|
|
return false; // don't report violations with multiple edges; one is enough
|
|
|
|
}
|
2020-10-27 17:09:27 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2020-09-11 16:24:27 +00:00
|
|
|
bool DRC_TEST_PROVIDER_EDGE_CLEARANCE::Run()
|
2020-07-27 13:33:06 +00:00
|
|
|
{
|
2021-08-15 17:23:54 +00:00
|
|
|
if( !m_drcEngine->IsErrorLimitExceeded( DRCE_EDGE_CLEARANCE ) )
|
2021-02-27 13:43:41 +00:00
|
|
|
{
|
|
|
|
if( !reportPhase( _( "Checking copper to board edge clearances..." ) ) )
|
|
|
|
return false; // DRC cancelled
|
|
|
|
}
|
2022-03-14 19:49:00 +00:00
|
|
|
else if( m_drcEngine->IsErrorLimitExceeded( DRCE_SILK_EDGE_CLEARANCE ) )
|
2021-02-27 13:43:41 +00:00
|
|
|
{
|
|
|
|
if( !reportPhase( _( "Checking silk to board edge clearances..." ) ) )
|
|
|
|
return false; // DRC cancelled
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2022-03-11 21:16:52 +00:00
|
|
|
reportAux( wxT( "Edge clearance violations ignored. Tests not run." ) );
|
2021-02-27 13:43:41 +00:00
|
|
|
return true; // continue with other tests
|
|
|
|
}
|
|
|
|
|
2020-07-27 13:33:06 +00:00
|
|
|
m_board = m_drcEngine->GetBoard();
|
2022-03-14 23:57:55 +00:00
|
|
|
m_castellatedPads.clear();
|
2020-07-27 13:33:06 +00:00
|
|
|
|
2020-08-11 22:15:50 +00:00
|
|
|
DRC_CONSTRAINT worstClearanceConstraint;
|
2020-09-11 15:04:11 +00:00
|
|
|
|
2020-11-02 16:20:00 +00:00
|
|
|
if( m_drcEngine->QueryWorstConstraint( EDGE_CLEARANCE_CONSTRAINT, worstClearanceConstraint ) )
|
2022-06-17 21:50:59 +00:00
|
|
|
m_largestEdgeClearance = worstClearanceConstraint.GetValue().Min();
|
2020-07-27 13:33:06 +00:00
|
|
|
|
2022-06-17 21:50:59 +00:00
|
|
|
reportAux( wxT( "Worst clearance : %d nm" ), m_largestEdgeClearance );
|
2020-09-11 16:24:27 +00:00
|
|
|
|
2022-08-22 11:36:41 +00:00
|
|
|
/*
|
|
|
|
* Build an RTree of the various edges (including NPTH holes) and margins found on the board.
|
|
|
|
*/
|
2022-03-12 13:34:25 +00:00
|
|
|
std::vector<std::unique_ptr<PCB_SHAPE>> edges;
|
2020-10-27 17:09:27 +00:00
|
|
|
DRC_RTREE edgesTree;
|
2020-07-27 13:33:06 +00:00
|
|
|
|
2023-03-30 11:49:23 +00:00
|
|
|
forEachGeometryItem( { PCB_SHAPE_T }, LSET( 2, Edge_Cuts, Margin ),
|
2020-09-12 19:28:22 +00:00
|
|
|
[&]( BOARD_ITEM *item ) -> bool
|
|
|
|
{
|
2021-07-17 19:56:18 +00:00
|
|
|
PCB_SHAPE* shape = static_cast<PCB_SHAPE*>( item );
|
2022-07-08 01:30:57 +00:00
|
|
|
STROKE_PARAMS stroke = shape->GetStroke();
|
2020-10-15 10:36:37 +00:00
|
|
|
|
2022-07-08 01:30:57 +00:00
|
|
|
if( item->IsOnLayer( Edge_Cuts ) )
|
|
|
|
stroke.SetWidth( 0 );
|
|
|
|
|
2023-07-24 16:07:56 +00:00
|
|
|
if( shape->GetShape() == SHAPE_T::RECTANGLE && !shape->IsFilled() )
|
2020-10-15 10:36:37 +00:00
|
|
|
{
|
2021-07-31 15:31:38 +00:00
|
|
|
// A single rectangle for the board would make the RTree useless, so convert
|
|
|
|
// to 4 edges
|
2020-10-27 17:09:27 +00:00
|
|
|
edges.emplace_back( static_cast<PCB_SHAPE*>( shape->Clone() ) );
|
2021-07-21 18:31:25 +00:00
|
|
|
edges.back()->SetShape( SHAPE_T::SEGMENT );
|
2020-10-27 17:09:27 +00:00
|
|
|
edges.back()->SetEndX( shape->GetStartX() );
|
2021-07-17 19:56:18 +00:00
|
|
|
edges.back()->SetStroke( stroke );
|
2022-11-28 17:09:12 +00:00
|
|
|
edges.back()->SetParentGroup( nullptr );
|
2020-10-27 17:09:27 +00:00
|
|
|
edges.emplace_back( static_cast<PCB_SHAPE*>( shape->Clone() ) );
|
2021-07-21 18:31:25 +00:00
|
|
|
edges.back()->SetShape( SHAPE_T::SEGMENT );
|
2020-10-27 17:09:27 +00:00
|
|
|
edges.back()->SetEndY( shape->GetStartY() );
|
2021-07-17 19:56:18 +00:00
|
|
|
edges.back()->SetStroke( stroke );
|
2022-11-28 17:09:12 +00:00
|
|
|
edges.back()->SetParentGroup( nullptr );
|
2020-10-27 17:09:27 +00:00
|
|
|
edges.emplace_back( static_cast<PCB_SHAPE*>( shape->Clone() ) );
|
2021-07-21 18:31:25 +00:00
|
|
|
edges.back()->SetShape( SHAPE_T::SEGMENT );
|
2020-10-27 17:09:27 +00:00
|
|
|
edges.back()->SetStartX( shape->GetEndX() );
|
2021-07-17 19:56:18 +00:00
|
|
|
edges.back()->SetStroke( stroke );
|
2022-11-28 17:09:12 +00:00
|
|
|
edges.back()->SetParentGroup( nullptr );
|
2020-10-27 17:09:27 +00:00
|
|
|
edges.emplace_back( static_cast<PCB_SHAPE*>( shape->Clone() ) );
|
2021-07-21 18:31:25 +00:00
|
|
|
edges.back()->SetShape( SHAPE_T::SEGMENT );
|
2020-10-27 17:09:27 +00:00
|
|
|
edges.back()->SetStartY( shape->GetEndY() );
|
2021-07-17 19:56:18 +00:00
|
|
|
edges.back()->SetStroke( stroke );
|
2022-11-28 17:09:12 +00:00
|
|
|
edges.back()->SetParentGroup( nullptr );
|
2020-10-15 10:36:37 +00:00
|
|
|
}
|
2022-07-08 01:30:57 +00:00
|
|
|
else if( shape->GetShape() == SHAPE_T::POLY && !shape->IsFilled() )
|
2020-10-15 10:36:37 +00:00
|
|
|
{
|
2021-07-31 15:31:38 +00:00
|
|
|
// A single polygon for the board would make the RTree useless, so convert
|
|
|
|
// to n edges.
|
2020-10-15 10:36:37 +00:00
|
|
|
SHAPE_LINE_CHAIN poly = shape->GetPolyShape().Outline( 0 );
|
|
|
|
|
|
|
|
for( size_t ii = 0; ii < poly.GetSegmentCount(); ++ii )
|
|
|
|
{
|
|
|
|
SEG seg = poly.CSegment( ii );
|
2020-10-27 17:09:27 +00:00
|
|
|
edges.emplace_back( static_cast<PCB_SHAPE*>( shape->Clone() ) );
|
2021-07-21 18:31:25 +00:00
|
|
|
edges.back()->SetShape( SHAPE_T::SEGMENT );
|
2022-01-02 02:06:40 +00:00
|
|
|
edges.back()->SetStart( seg.A );
|
|
|
|
edges.back()->SetEnd( seg.B );
|
2021-07-17 19:56:18 +00:00
|
|
|
edges.back()->SetStroke( stroke );
|
2022-11-28 17:09:12 +00:00
|
|
|
edges.back()->SetParentGroup( nullptr );
|
2020-10-15 10:36:37 +00:00
|
|
|
}
|
|
|
|
}
|
2022-07-08 01:30:57 +00:00
|
|
|
else
|
|
|
|
{
|
|
|
|
edges.emplace_back( static_cast<PCB_SHAPE*>( shape->Clone() ) );
|
|
|
|
edges.back()->SetStroke( stroke );
|
2022-11-28 17:09:12 +00:00
|
|
|
edges.back()->SetParentGroup( nullptr );
|
2022-07-08 01:30:57 +00:00
|
|
|
}
|
2020-10-15 10:36:37 +00:00
|
|
|
|
2020-09-12 19:28:22 +00:00
|
|
|
return true;
|
2022-03-09 00:47:37 +00:00
|
|
|
} );
|
2020-10-27 17:09:27 +00:00
|
|
|
|
|
|
|
for( const std::unique_ptr<PCB_SHAPE>& edge : edges )
|
2021-06-02 13:00:11 +00:00
|
|
|
{
|
|
|
|
for( PCB_LAYER_ID layer : { Edge_Cuts, Margin } )
|
|
|
|
{
|
|
|
|
if( edge->IsOnLayer( layer ) )
|
2022-06-17 21:50:59 +00:00
|
|
|
edgesTree.Insert( edge.get(), layer, m_largestEdgeClearance );
|
2021-06-02 13:00:11 +00:00
|
|
|
}
|
|
|
|
}
|
2020-07-27 13:33:06 +00:00
|
|
|
|
2022-03-14 19:49:00 +00:00
|
|
|
for( FOOTPRINT* footprint : m_board->Footprints() )
|
|
|
|
{
|
|
|
|
for( PAD* pad : footprint->Pads() )
|
|
|
|
{
|
2022-11-23 13:31:11 +00:00
|
|
|
if( pad->GetAttribute() == PAD_ATTRIB::NPTH && pad->HasHole() )
|
|
|
|
{
|
|
|
|
// edge-clearances are for milling tolerances (drilling tolerances are handled
|
|
|
|
// by hole-clearances)
|
2023-02-22 01:00:11 +00:00
|
|
|
if( pad->GetDrillSizeX() != pad->GetDrillSizeY() )
|
2022-11-23 13:31:11 +00:00
|
|
|
edgesTree.Insert( pad, Edge_Cuts, m_largestEdgeClearance );
|
|
|
|
}
|
2022-03-14 23:57:55 +00:00
|
|
|
|
|
|
|
if( pad->GetProperty() == PAD_PROP::CASTELLATED )
|
|
|
|
m_castellatedPads.push_back( pad );
|
2022-03-14 19:49:00 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2022-08-22 11:36:41 +00:00
|
|
|
/*
|
|
|
|
* Test copper and silk items against the set of edges.
|
|
|
|
*/
|
2022-08-03 09:10:23 +00:00
|
|
|
const int progressDelta = 200;
|
2022-03-12 13:34:25 +00:00
|
|
|
int count = 0;
|
|
|
|
int ii = 0;
|
|
|
|
|
2022-03-09 00:47:37 +00:00
|
|
|
forEachGeometryItem( s_allBasicItemsButZones, LSET::AllLayersMask(),
|
|
|
|
[&]( BOARD_ITEM *item ) -> bool
|
|
|
|
{
|
2022-03-12 13:34:25 +00:00
|
|
|
count++;
|
2022-03-09 00:47:37 +00:00
|
|
|
return true;
|
|
|
|
} );
|
|
|
|
|
2022-03-12 13:34:25 +00:00
|
|
|
forEachGeometryItem( s_allBasicItemsButZones, LSET::AllLayersMask(),
|
|
|
|
[&]( BOARD_ITEM *item ) -> bool
|
|
|
|
{
|
|
|
|
bool testCopper = !m_drcEngine->IsErrorLimitExceeded( DRCE_EDGE_CLEARANCE );
|
2022-03-14 19:49:00 +00:00
|
|
|
bool testSilk = !m_drcEngine->IsErrorLimitExceeded( DRCE_SILK_EDGE_CLEARANCE );
|
2020-07-27 13:33:06 +00:00
|
|
|
|
2022-03-12 13:34:25 +00:00
|
|
|
if( !testCopper && !testSilk )
|
2023-03-07 12:21:23 +00:00
|
|
|
return false; // All limits exceeded; we're done
|
2020-07-27 13:33:06 +00:00
|
|
|
|
2022-08-03 09:10:23 +00:00
|
|
|
if( !reportProgress( ii++, count, progressDelta ) )
|
2023-03-07 12:21:23 +00:00
|
|
|
return false; // DRC cancelled; we're done
|
2020-10-06 12:20:29 +00:00
|
|
|
|
2022-03-12 13:34:25 +00:00
|
|
|
if( isInvisibleText( item ) )
|
2023-03-07 12:21:23 +00:00
|
|
|
return true; // Continue with other items
|
2020-10-06 12:20:29 +00:00
|
|
|
|
2023-03-07 12:21:23 +00:00
|
|
|
if( item->Type() == PCB_PAD_T )
|
2022-03-14 18:07:13 +00:00
|
|
|
{
|
2023-03-07 12:21:23 +00:00
|
|
|
PAD* pad = static_cast<PAD*>( item );
|
|
|
|
|
|
|
|
if( pad->GetProperty() == PAD_PROP::CASTELLATED
|
|
|
|
|| pad->GetAttribute() == PAD_ATTRIB::CONN )
|
|
|
|
{
|
|
|
|
return true; // Continue with other items
|
|
|
|
}
|
2022-03-14 18:07:13 +00:00
|
|
|
}
|
|
|
|
|
2022-03-12 13:34:25 +00:00
|
|
|
const std::shared_ptr<SHAPE>& itemShape = item->GetEffectiveShape();
|
2020-10-06 12:20:29 +00:00
|
|
|
|
2022-03-12 13:34:25 +00:00
|
|
|
for( PCB_LAYER_ID testLayer : { Edge_Cuts, Margin } )
|
|
|
|
{
|
|
|
|
if( testCopper && item->IsOnCopperLayer() )
|
|
|
|
{
|
|
|
|
edgesTree.QueryColliding( item, UNDEFINED_LAYER, testLayer, nullptr,
|
2022-07-08 01:30:57 +00:00
|
|
|
[&]( BOARD_ITEM* edge ) -> bool
|
2022-03-12 13:34:25 +00:00
|
|
|
{
|
|
|
|
return testAgainstEdge( item, itemShape.get(), edge,
|
|
|
|
EDGE_CLEARANCE_CONSTRAINT,
|
|
|
|
DRCE_EDGE_CLEARANCE );
|
|
|
|
},
|
2022-07-08 01:30:57 +00:00
|
|
|
m_largestEdgeClearance );
|
2022-03-12 13:34:25 +00:00
|
|
|
}
|
2020-10-06 12:20:29 +00:00
|
|
|
|
2022-03-12 13:34:25 +00:00
|
|
|
if( testSilk && ( item->IsOnLayer( F_SilkS ) || item->IsOnLayer( B_SilkS ) ) )
|
|
|
|
{
|
|
|
|
if( edgesTree.QueryColliding( item, UNDEFINED_LAYER, testLayer, nullptr,
|
2022-07-08 01:30:57 +00:00
|
|
|
[&]( BOARD_ITEM* edge ) -> bool
|
2022-03-12 13:34:25 +00:00
|
|
|
{
|
|
|
|
return testAgainstEdge( item, itemShape.get(), edge,
|
|
|
|
SILK_CLEARANCE_CONSTRAINT,
|
2022-03-14 19:49:00 +00:00
|
|
|
DRCE_SILK_EDGE_CLEARANCE );
|
2022-03-12 13:34:25 +00:00
|
|
|
},
|
2022-07-08 01:30:57 +00:00
|
|
|
m_largestEdgeClearance ) )
|
2021-04-21 20:57:56 +00:00
|
|
|
{
|
2022-03-12 13:34:25 +00:00
|
|
|
// violations reported during QueryColliding
|
|
|
|
}
|
|
|
|
else
|
2021-04-21 20:57:56 +00:00
|
|
|
{
|
2022-03-12 13:34:25 +00:00
|
|
|
// TODO: check postion being outside board boundary
|
|
|
|
}
|
|
|
|
}
|
2021-07-31 15:31:38 +00:00
|
|
|
}
|
2022-03-12 13:34:25 +00:00
|
|
|
|
|
|
|
return true;
|
|
|
|
} );
|
2020-10-06 12:20:29 +00:00
|
|
|
|
2020-08-25 17:42:52 +00:00
|
|
|
reportRuleStatistics();
|
|
|
|
|
2022-03-11 21:16:52 +00:00
|
|
|
return !m_drcEngine->IsCancelled();
|
2020-07-27 13:33:06 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
namespace detail
|
|
|
|
{
|
2020-09-11 16:24:27 +00:00
|
|
|
static DRC_REGISTER_TEST_PROVIDER<DRC_TEST_PROVIDER_EDGE_CLEARANCE> dummy;
|
2020-10-02 20:51:24 +00:00
|
|
|
}
|