2020-08-25 17:42:52 +00:00
|
|
|
/*
|
|
|
|
* This program source code file is part of KiCad, a free EDA CAD application.
|
|
|
|
*
|
2024-05-06 22:31:08 +00:00
|
|
|
* Copyright (C) 2004-2022, 2024 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
|
|
|
|
*/
|
|
|
|
|
|
|
|
#include <common.h>
|
2021-06-11 21:07:02 +00:00
|
|
|
#include <pcb_track.h>
|
2022-08-01 16:44:23 +00:00
|
|
|
#include <pad.h>
|
|
|
|
#include <footprint.h>
|
2021-06-06 19:03:10 +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>
|
|
|
|
#include <drc/drc_test_provider.h>
|
2022-08-01 16:44:23 +00:00
|
|
|
#include <macros.h>
|
|
|
|
#include <convert_basic_shapes_to_polygon.h>
|
|
|
|
#include <board_design_settings.h>
|
2020-08-25 17:42:52 +00:00
|
|
|
|
|
|
|
/*
|
2020-11-02 16:20:00 +00:00
|
|
|
Via/pad annular ring width test. Checks if there's sufficient copper ring around
|
|
|
|
PTH/NPTH holes (vias/pads)
|
2020-08-25 17:42:52 +00:00
|
|
|
Errors generated:
|
2021-06-26 09:11:22 +00:00
|
|
|
- DRCE_ANNULAR_WIDTH
|
2020-08-25 17:42:52 +00:00
|
|
|
|
2020-09-08 13:44:44 +00:00
|
|
|
Todo:
|
2020-08-25 17:42:52 +00:00
|
|
|
- check pad holes too.
|
|
|
|
- pad stack support (different IAR/OAR values depending on layer)
|
|
|
|
*/
|
|
|
|
|
2024-05-06 22:31:08 +00:00
|
|
|
/**
|
|
|
|
* Find the nearest collision point between two shape line chains.
|
|
|
|
*
|
|
|
|
* @note This collision test only tests the shape line chain segments (outline) by setting the
|
|
|
|
* shape closed status to false.
|
|
|
|
*
|
|
|
|
* @param aLhs is the left hand shape line chain to run the collision test on.
|
|
|
|
* @param aRhs is the right hand shape line chain the run the collision test against \a aLhs.
|
|
|
|
* @param aClearance is the collision clearance between the two shape line changes.
|
|
|
|
* @param[out] aDistance is an optional pointer to store the nearest collision distance.
|
|
|
|
* @param[out] aPt1 is an optional pointer to store the nearest collision point.
|
|
|
|
* @retrun true if a collision occurs between \a aLhs and \a aRhs otherwise false.
|
|
|
|
*/
|
|
|
|
static inline bool collide( const SHAPE_LINE_CHAIN& aLhs, const SHAPE_LINE_CHAIN& aRhs,
|
|
|
|
int aClearance, int* aDistance = nullptr, VECTOR2I* aPt1 = nullptr )
|
|
|
|
{
|
|
|
|
wxCHECK( aLhs.PointCount() && aRhs.PointCount(), false );
|
|
|
|
|
|
|
|
VECTOR2I pt1;
|
|
|
|
bool retv = false;
|
|
|
|
int dist = std::numeric_limits<int>::max();
|
|
|
|
int tmp = dist;
|
|
|
|
|
|
|
|
SHAPE_LINE_CHAIN lhs( aLhs );
|
|
|
|
SHAPE_LINE_CHAIN rhs( aRhs );
|
|
|
|
|
|
|
|
lhs.SetClosed( false );
|
|
|
|
lhs.Append( lhs.CPoint( 0 ) );
|
|
|
|
rhs.SetClosed( false );
|
|
|
|
rhs.Append( rhs.CPoint( 0 ) );
|
|
|
|
|
|
|
|
for( int i = 0; i < rhs.SegmentCount(); i ++ )
|
|
|
|
{
|
|
|
|
if( lhs.Collide( rhs.CSegment( i ), tmp, &tmp, &pt1 ) )
|
|
|
|
{
|
|
|
|
retv = true;
|
|
|
|
|
|
|
|
if( tmp < dist )
|
|
|
|
dist = tmp;
|
|
|
|
|
|
|
|
if( aDistance )
|
|
|
|
*aDistance = dist;
|
|
|
|
|
|
|
|
if( aPt1 )
|
|
|
|
*aPt1 = pt1;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
return retv;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
static bool collide( const SHAPE_POLY_SET& aLhs, const SHAPE_LINE_CHAIN& aRhs, int aClearance,
|
|
|
|
int* aDistance = nullptr, VECTOR2I* aPt1 = nullptr )
|
|
|
|
{
|
|
|
|
VECTOR2I pt1;
|
|
|
|
bool retv = false;
|
|
|
|
int tmp = std::numeric_limits<int>::max();
|
|
|
|
int dist = tmp;
|
|
|
|
|
|
|
|
for( int i = 0; i < aLhs.OutlineCount(); i++ )
|
|
|
|
{
|
|
|
|
if( collide( aLhs.Outline( i ), aRhs, aClearance, &tmp, &pt1 ) )
|
|
|
|
{
|
|
|
|
retv = true;
|
|
|
|
|
|
|
|
if( tmp < dist )
|
|
|
|
{
|
|
|
|
dist = tmp;
|
|
|
|
|
|
|
|
if( aDistance )
|
|
|
|
*aDistance = dist;
|
|
|
|
|
|
|
|
if( aPt1 )
|
|
|
|
*aPt1 = pt1;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
for( int j = 0; j < aLhs.HoleCount( i ); i++ )
|
|
|
|
{
|
|
|
|
if( collide( aLhs.CHole( i, j ), aRhs, aClearance, &tmp, &pt1 ) )
|
|
|
|
{
|
|
|
|
retv = true;
|
|
|
|
|
|
|
|
if( tmp < dist )
|
|
|
|
{
|
|
|
|
dist = tmp;
|
|
|
|
|
|
|
|
if( aDistance )
|
|
|
|
*aDistance = dist;
|
|
|
|
|
|
|
|
if( aPt1 )
|
|
|
|
*aPt1 = pt1;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
return retv;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2021-06-26 09:11:22 +00:00
|
|
|
class DRC_TEST_PROVIDER_ANNULAR_WIDTH : public DRC_TEST_PROVIDER
|
2020-08-25 17:42:52 +00:00
|
|
|
{
|
|
|
|
public:
|
2021-06-26 09:11:22 +00:00
|
|
|
DRC_TEST_PROVIDER_ANNULAR_WIDTH()
|
2020-08-25 17:42:52 +00:00
|
|
|
{
|
|
|
|
}
|
|
|
|
|
2021-06-26 09:11:22 +00:00
|
|
|
virtual ~DRC_TEST_PROVIDER_ANNULAR_WIDTH()
|
2020-08-25 17:42:52 +00:00
|
|
|
{
|
|
|
|
}
|
|
|
|
|
|
|
|
virtual bool Run() override;
|
|
|
|
|
|
|
|
virtual const wxString GetName() const override
|
|
|
|
{
|
2022-03-11 21:16:52 +00:00
|
|
|
return wxT( "annular_width" );
|
2020-08-25 17:42:52 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
virtual const wxString GetDescription() const override
|
|
|
|
{
|
2022-03-11 21:16:52 +00:00
|
|
|
return wxT( "Tests pad/via annular rings" );
|
2020-08-25 17:42:52 +00:00
|
|
|
}
|
|
|
|
};
|
|
|
|
|
|
|
|
|
2021-06-26 09:11:22 +00:00
|
|
|
bool DRC_TEST_PROVIDER_ANNULAR_WIDTH::Run()
|
2020-08-25 17:42:52 +00:00
|
|
|
{
|
2021-02-27 13:43:41 +00:00
|
|
|
if( m_drcEngine->IsErrorLimitExceeded( DRCE_ANNULAR_WIDTH ) )
|
|
|
|
{
|
2022-03-11 21:16:52 +00:00
|
|
|
reportAux( wxT( "Annular width violations ignored. Skipping check." ) );
|
2021-02-27 13:43:41 +00:00
|
|
|
return true; // continue with other tests
|
|
|
|
}
|
|
|
|
|
2022-08-03 09:10:23 +00:00
|
|
|
const int progressDelta = 500;
|
2020-09-16 15:03:55 +00:00
|
|
|
|
2020-11-02 16:20:00 +00:00
|
|
|
if( !m_drcEngine->HasRulesForConstraintType( ANNULAR_WIDTH_CONSTRAINT ) )
|
2020-08-25 17:42:52 +00:00
|
|
|
{
|
2022-03-11 21:16:52 +00:00
|
|
|
reportAux( wxT( "No annular width constraints found. Tests not run." ) );
|
2021-02-27 13:43:41 +00:00
|
|
|
return true; // continue with other tests
|
2020-08-25 17:42:52 +00:00
|
|
|
}
|
|
|
|
|
2022-08-01 16:44:23 +00:00
|
|
|
if( !reportPhase( _( "Checking pad & via annular rings..." ) ) )
|
2021-02-27 13:43:41 +00:00
|
|
|
return false; // DRC cancelled
|
2020-08-25 17:42:52 +00:00
|
|
|
|
2022-08-01 16:44:23 +00:00
|
|
|
int maxError = m_drcEngine->GetBoard()->GetDesignSettings().m_MaxError;
|
|
|
|
|
|
|
|
auto calcEffort =
|
|
|
|
[]( BOARD_ITEM* item )
|
|
|
|
{
|
|
|
|
switch( item->Type() )
|
|
|
|
{
|
|
|
|
case PCB_VIA_T:
|
|
|
|
return 1;
|
|
|
|
|
|
|
|
case PCB_PAD_T:
|
|
|
|
{
|
|
|
|
PAD* pad = static_cast<PAD*>( item );
|
|
|
|
|
|
|
|
if( !pad->HasHole() || pad->GetAttribute() != PAD_ATTRIB::PTH )
|
|
|
|
return 0;
|
|
|
|
|
|
|
|
if( pad->GetOffset() == VECTOR2I( 0, 0 ) )
|
|
|
|
{
|
|
|
|
switch( pad->GetShape() )
|
|
|
|
{
|
|
|
|
case PAD_SHAPE::CHAMFERED_RECT:
|
|
|
|
if( pad->GetChamferRectRatio() > 0.30 )
|
|
|
|
break;
|
|
|
|
|
|
|
|
KI_FALLTHROUGH;
|
|
|
|
|
|
|
|
case PAD_SHAPE::CIRCLE:
|
|
|
|
case PAD_SHAPE::OVAL:
|
2023-06-02 09:10:48 +00:00
|
|
|
case PAD_SHAPE::RECTANGLE:
|
2022-08-01 16:44:23 +00:00
|
|
|
case PAD_SHAPE::ROUNDRECT:
|
|
|
|
return 1;
|
|
|
|
|
|
|
|
default:
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2022-08-03 09:10:23 +00:00
|
|
|
return 5;
|
2022-08-01 16:44:23 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
default:
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
};
|
|
|
|
|
2021-06-26 09:11:22 +00:00
|
|
|
auto checkAnnularWidth =
|
2020-09-11 21:50:53 +00:00
|
|
|
[&]( BOARD_ITEM* item ) -> bool
|
|
|
|
{
|
2020-09-23 10:46:41 +00:00
|
|
|
if( m_drcEngine->IsErrorLimitExceeded( DRCE_ANNULAR_WIDTH ) )
|
2020-09-12 19:28:22 +00:00
|
|
|
return false;
|
|
|
|
|
2024-05-07 12:02:30 +00:00
|
|
|
// PADSTACKS TODO: once we have padstacks we'll need to run this per-layer....
|
|
|
|
auto constraint = m_drcEngine->EvalRules( ANNULAR_WIDTH_CONSTRAINT, item, nullptr,
|
|
|
|
UNDEFINED_LAYER );
|
|
|
|
|
|
|
|
int annularWidth = 0;
|
|
|
|
int v_min = 0;
|
|
|
|
int v_max = 0;
|
|
|
|
bool fail_min = false;
|
|
|
|
bool fail_max = false;
|
|
|
|
|
2020-08-25 17:42:52 +00:00
|
|
|
|
2022-08-01 16:44:23 +00:00
|
|
|
switch( item->Type() )
|
|
|
|
{
|
|
|
|
case PCB_VIA_T:
|
|
|
|
{
|
|
|
|
PCB_VIA* via = static_cast<PCB_VIA*>( item );
|
|
|
|
annularWidth = ( via->GetWidth() - via->GetDrillValue() ) / 2;
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
|
|
|
case PCB_PAD_T:
|
|
|
|
{
|
|
|
|
PAD* pad = static_cast<PAD*>( item );
|
|
|
|
bool handled = false;
|
|
|
|
|
|
|
|
if( !pad->HasHole() || pad->GetAttribute() != PAD_ATTRIB::PTH )
|
|
|
|
return true;
|
|
|
|
|
2024-05-06 22:31:08 +00:00
|
|
|
std::vector<const PAD*> sameNumPads;
|
|
|
|
|
|
|
|
const FOOTPRINT* fp = static_cast<const FOOTPRINT*>( pad->GetParent() );
|
|
|
|
|
|
|
|
if( fp )
|
|
|
|
sameNumPads = fp->GetPads( pad->GetNumber(), pad );
|
|
|
|
|
2022-08-01 16:44:23 +00:00
|
|
|
if( pad->GetOffset() == VECTOR2I( 0, 0 ) )
|
|
|
|
{
|
|
|
|
switch( pad->GetShape() )
|
|
|
|
{
|
2024-05-03 17:05:12 +00:00
|
|
|
case PAD_SHAPE::CIRCLE:
|
|
|
|
annularWidth = ( pad->GetSizeX() - pad->GetDrillSizeX() ) / 2;
|
2024-05-06 22:31:08 +00:00
|
|
|
|
|
|
|
// If there are more pads with the same number. Check to see if the
|
|
|
|
// pad is embedded inside another pad with the same number below.
|
|
|
|
if( sameNumPads.empty() )
|
|
|
|
handled = true;
|
|
|
|
|
2024-05-03 17:05:12 +00:00
|
|
|
break;
|
|
|
|
|
2022-08-01 16:44:23 +00:00
|
|
|
case PAD_SHAPE::CHAMFERED_RECT:
|
|
|
|
if( pad->GetChamferRectRatio() > 0.30 )
|
|
|
|
break;
|
|
|
|
|
|
|
|
KI_FALLTHROUGH;
|
|
|
|
|
|
|
|
case PAD_SHAPE::OVAL:
|
2023-06-02 09:10:48 +00:00
|
|
|
case PAD_SHAPE::RECTANGLE:
|
2022-08-01 16:44:23 +00:00
|
|
|
case PAD_SHAPE::ROUNDRECT:
|
|
|
|
annularWidth = std::min( pad->GetSizeX() - pad->GetDrillSizeX(),
|
|
|
|
pad->GetSizeY() - pad->GetDrillSizeY() ) / 2;
|
2024-05-06 22:31:08 +00:00
|
|
|
|
|
|
|
// If there are more pads with the same number. Check to see if the
|
|
|
|
// pad is embedded inside another pad with the same number below.
|
|
|
|
if( sameNumPads.empty() )
|
|
|
|
handled = true;
|
|
|
|
|
2022-08-01 16:44:23 +00:00
|
|
|
break;
|
|
|
|
|
|
|
|
default:
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
if( !handled )
|
|
|
|
{
|
|
|
|
// Slow (but general purpose) method.
|
2024-05-06 22:31:08 +00:00
|
|
|
SEG::ecoord dist_sq;
|
2022-08-01 16:44:23 +00:00
|
|
|
SHAPE_POLY_SET padOutline;
|
2024-05-06 22:31:08 +00:00
|
|
|
std::shared_ptr<SHAPE_SEGMENT> slot = pad->GetEffectiveHoleShape();
|
2022-08-01 16:44:23 +00:00
|
|
|
|
2022-10-21 12:48:45 +00:00
|
|
|
pad->TransformShapeToPolygon( padOutline, UNDEFINED_LAYER, 0, maxError,
|
|
|
|
ERROR_INSIDE );
|
2022-08-01 16:44:23 +00:00
|
|
|
|
2024-05-06 22:31:08 +00:00
|
|
|
if( sameNumPads.empty() )
|
2022-08-01 16:44:23 +00:00
|
|
|
{
|
2024-05-06 22:31:08 +00:00
|
|
|
if( !padOutline.Collide( pad->GetPosition() ) )
|
|
|
|
{
|
|
|
|
// Hole outside pad
|
|
|
|
annularWidth = 0;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
// Disable is-inside test in SquaredDistance
|
|
|
|
padOutline.Outline( 0 ).SetClosed( false );
|
|
|
|
|
|
|
|
dist_sq = padOutline.SquaredDistanceToSeg( slot->GetSeg() );
|
|
|
|
annularWidth = sqrt( dist_sq ) - slot->GetWidth() / 2;
|
|
|
|
}
|
2022-08-01 16:44:23 +00:00
|
|
|
}
|
2024-05-07 12:02:30 +00:00
|
|
|
else if( constraint.Value().HasMin()
|
|
|
|
&& ( annularWidth < constraint.Value().Min() ) )
|
2022-08-01 16:44:23 +00:00
|
|
|
{
|
2024-05-06 22:31:08 +00:00
|
|
|
SHAPE_POLY_SET otherPadOutline;
|
|
|
|
SHAPE_POLY_SET slotPolygon;
|
|
|
|
|
|
|
|
slot->TransformToPolygon( slotPolygon, 0, ERROR_INSIDE );
|
|
|
|
|
|
|
|
for( const PAD* sameNumPad : sameNumPads )
|
|
|
|
{
|
|
|
|
// Construct the full pad with outline and hole.
|
|
|
|
sameNumPad->TransformShapeToPolygon( otherPadOutline,
|
|
|
|
UNDEFINED_LAYER, 0, maxError,
|
|
|
|
ERROR_OUTSIDE );
|
|
|
|
|
|
|
|
sameNumPad->TransformHoleToPolygon( otherPadOutline, 0, maxError,
|
|
|
|
ERROR_INSIDE );
|
|
|
|
|
|
|
|
|
|
|
|
// If the pad hole under test intersects with another pad outline,
|
|
|
|
// the annular width calculated above is used.
|
|
|
|
bool intersects = false;
|
|
|
|
|
|
|
|
for( int i = 0; i < otherPadOutline.OutlineCount() && !intersects; i++ )
|
|
|
|
{
|
|
|
|
intersects |= slotPolygon.COutline( 0 ).Intersects( otherPadOutline.COutline( i ) );
|
|
|
|
if( intersects )
|
|
|
|
continue;
|
|
|
|
|
|
|
|
for( int j = 0; j < otherPadOutline.HoleCount( i ) && !intersects; j++ )
|
|
|
|
{
|
|
|
|
intersects |= slotPolygon.COutline( 0 ).Intersects( otherPadOutline.CHole( i, j ) );
|
|
|
|
if( intersects )
|
|
|
|
continue;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
if( intersects )
|
|
|
|
continue;
|
|
|
|
|
|
|
|
// Determine the effective annular width if the pad hole under
|
|
|
|
// test lies withing the boundary of another pad outline.
|
|
|
|
int effectiveWidth = std::numeric_limits<int>::max();
|
|
|
|
|
|
|
|
if( collide( otherPadOutline, slotPolygon.Outline( 0 ),
|
|
|
|
effectiveWidth, &effectiveWidth ) )
|
|
|
|
{
|
|
|
|
if( effectiveWidth > annularWidth )
|
|
|
|
annularWidth = effectiveWidth;
|
|
|
|
}
|
|
|
|
}
|
2022-08-01 16:44:23 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
|
|
|
default:
|
2020-09-11 21:50:53 +00:00
|
|
|
return true;
|
2022-08-01 16:44:23 +00:00
|
|
|
}
|
2020-08-25 17:42:52 +00:00
|
|
|
|
2021-09-05 15:06:12 +00:00
|
|
|
if( constraint.GetSeverity() == RPT_SEVERITY_IGNORE )
|
|
|
|
return true;
|
|
|
|
|
2020-09-11 21:50:53 +00:00
|
|
|
if( constraint.Value().HasMin() )
|
|
|
|
{
|
|
|
|
v_min = constraint.Value().Min();
|
2021-06-26 09:11:22 +00:00
|
|
|
fail_min = annularWidth < v_min;
|
2020-09-11 21:50:53 +00:00
|
|
|
}
|
2020-08-25 17:42:52 +00:00
|
|
|
|
2020-09-11 21:50:53 +00:00
|
|
|
if( constraint.Value().HasMax() )
|
|
|
|
{
|
|
|
|
v_max = constraint.Value().Max();
|
2021-06-26 09:11:22 +00:00
|
|
|
fail_max = annularWidth > v_max;
|
2020-09-11 21:50:53 +00:00
|
|
|
}
|
2020-08-25 17:42:52 +00:00
|
|
|
|
2020-09-11 21:50:53 +00:00
|
|
|
if( fail_min || fail_max )
|
|
|
|
{
|
2020-09-23 10:46:41 +00:00
|
|
|
std::shared_ptr<DRC_ITEM> drcItem = DRC_ITEM::Create( DRCE_ANNULAR_WIDTH );
|
2022-06-15 23:42:34 +00:00
|
|
|
wxString msg;
|
2020-08-25 17:42:52 +00:00
|
|
|
|
2020-09-22 14:50:15 +00:00
|
|
|
if( fail_min )
|
2022-08-01 16:44:23 +00:00
|
|
|
{
|
2022-10-06 20:52:17 +00:00
|
|
|
msg = formatMsg( _( "(%s min annular width %s; actual %s)" ),
|
|
|
|
constraint.GetName(),
|
|
|
|
v_min,
|
|
|
|
annularWidth );
|
2022-08-01 16:44:23 +00:00
|
|
|
}
|
2020-09-22 14:50:15 +00:00
|
|
|
|
|
|
|
if( fail_max )
|
2022-08-01 16:44:23 +00:00
|
|
|
{
|
2022-10-06 20:52:17 +00:00
|
|
|
msg = formatMsg( _( "(%s max annular width %s; actual %s)" ),
|
|
|
|
constraint.GetName(),
|
|
|
|
v_max,
|
|
|
|
annularWidth );
|
2022-08-01 16:44:23 +00:00
|
|
|
}
|
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 );
|
|
|
|
drcItem->SetViolatingRule( constraint.GetParentRule() );
|
2020-08-25 17:42:52 +00:00
|
|
|
|
2022-08-01 16:44:23 +00:00
|
|
|
reportViolation( drcItem, item->GetPosition(), item->GetLayer() );
|
2020-09-11 21:50:53 +00:00
|
|
|
}
|
2020-08-25 17:42:52 +00:00
|
|
|
|
2020-09-11 21:50:53 +00:00
|
|
|
return true;
|
|
|
|
};
|
2020-08-25 17:42:52 +00:00
|
|
|
|
2020-09-16 15:03:55 +00:00
|
|
|
BOARD* board = m_drcEngine->GetBoard();
|
2022-08-01 16:44:23 +00:00
|
|
|
size_t ii = 0;
|
|
|
|
size_t total = 0;
|
2020-09-16 15:03:55 +00:00
|
|
|
|
2021-06-11 21:07:02 +00:00
|
|
|
for( PCB_TRACK* item : board->Tracks() )
|
2022-08-01 16:44:23 +00:00
|
|
|
total += calcEffort( item );
|
|
|
|
|
|
|
|
for( FOOTPRINT* footprint : board->Footprints() )
|
2020-09-16 15:03:55 +00:00
|
|
|
{
|
2022-08-01 16:44:23 +00:00
|
|
|
for( PAD* pad : footprint->Pads() )
|
|
|
|
total += calcEffort( pad );
|
|
|
|
}
|
|
|
|
|
|
|
|
for( PCB_TRACK* item : board->Tracks() )
|
|
|
|
{
|
|
|
|
ii += calcEffort( item );
|
|
|
|
|
2022-08-03 09:10:23 +00:00
|
|
|
if( !reportProgress( ii, total, progressDelta ) )
|
2022-03-11 20:13:47 +00:00
|
|
|
return false; // DRC cancelled
|
2020-09-16 15:03:55 +00:00
|
|
|
|
2021-06-26 09:11:22 +00:00
|
|
|
if( !checkAnnularWidth( item ) )
|
2022-03-11 20:13:47 +00:00
|
|
|
break;
|
2020-09-16 15:03:55 +00:00
|
|
|
}
|
2020-08-25 17:42:52 +00:00
|
|
|
|
2022-08-01 16:44:23 +00:00
|
|
|
for( FOOTPRINT* footprint : board->Footprints() )
|
|
|
|
{
|
|
|
|
for( PAD* pad : footprint->Pads() )
|
|
|
|
{
|
|
|
|
ii += calcEffort( pad );
|
|
|
|
|
2022-08-03 09:10:23 +00:00
|
|
|
if( !reportProgress( ii, total, progressDelta ) )
|
2022-08-01 16:44:23 +00:00
|
|
|
return false; // DRC cancelled
|
|
|
|
|
|
|
|
if( !checkAnnularWidth( pad ) )
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2020-08-25 17:42:52 +00:00
|
|
|
reportRuleStatistics();
|
|
|
|
|
2022-03-11 20:13:47 +00:00
|
|
|
return !m_drcEngine->IsCancelled();
|
2020-08-25 17:42:52 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
namespace detail
|
|
|
|
{
|
2021-06-26 09:11:22 +00:00
|
|
|
static DRC_REGISTER_TEST_PROVIDER<DRC_TEST_PROVIDER_ANNULAR_WIDTH> dummy;
|
2020-09-08 13:44:44 +00:00
|
|
|
}
|