Refine track dangling test.
Turns out Clean Up Tracks and Vias wants a different answer from DRC.
(cherry picked from commit fb40c202a1
)
This commit is contained in:
parent
0df1ec8765
commit
f6d1baa50a
|
@ -710,7 +710,8 @@ static int getMinDist( BOARD_CONNECTED_ITEM* aItem, const VECTOR2I& aPoint )
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
bool CONNECTIVITY_DATA::TestTrackEndpointDangling( PCB_TRACK* aTrack, VECTOR2I* aPos ) const
|
bool CONNECTIVITY_DATA::TestTrackEndpointDangling( PCB_TRACK* aTrack, bool aIgnoreTracksInPads,
|
||||||
|
VECTOR2I* aPos ) const
|
||||||
{
|
{
|
||||||
const std::list<CN_ITEM*>& items = GetConnectivityAlgo()->ItemEntry( aTrack ).GetItems();
|
const std::list<CN_ITEM*>& items = GetConnectivityAlgo()->ItemEntry( aTrack ).GetItems();
|
||||||
|
|
||||||
|
@ -770,12 +771,17 @@ bool CONNECTIVITY_DATA::TestTrackEndpointDangling( PCB_TRACK* aTrack, VECTOR2I*
|
||||||
|
|
||||||
if( hitStart && hitEnd )
|
if( hitStart && hitEnd )
|
||||||
{
|
{
|
||||||
if( zone || item->Type() == PCB_PAD_T || item->Type() == PCB_VIA_T )
|
if( zone )
|
||||||
{
|
{
|
||||||
// Both start and end in a zone or under a pad: track may be redundant, but
|
// Both start and end in a zone: track may be redundant, but it's not dangling
|
||||||
// it's not dangling
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
else if( item->Type() == PCB_PAD_T || item->Type() == PCB_VIA_T )
|
||||||
|
{
|
||||||
|
// Both start and end are under a pad: see what the caller wants us to do
|
||||||
|
if( aIgnoreTracksInPads )
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
if( getMinDist( item, aTrack->GetStart() ) < getMinDist( item, aTrack->GetEnd() ) )
|
if( getMinDist( item, aTrack->GetStart() ) < getMinDist( item, aTrack->GetEnd() ) )
|
||||||
start_count++;
|
start_count++;
|
||||||
|
|
|
@ -210,7 +210,8 @@ public:
|
||||||
|
|
||||||
void RunOnUnconnectedEdges( std::function<bool( CN_EDGE& )> aFunc );
|
void RunOnUnconnectedEdges( std::function<bool( CN_EDGE& )> aFunc );
|
||||||
|
|
||||||
bool TestTrackEndpointDangling( PCB_TRACK* aTrack, VECTOR2I* aPos = nullptr ) const;
|
bool TestTrackEndpointDangling( PCB_TRACK* aTrack, bool aIgnoreTracksInPads,
|
||||||
|
VECTOR2I* aPos = nullptr ) const;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Function ClearLocalRatsnest()
|
* Function ClearLocalRatsnest()
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
/*
|
/*
|
||||||
* This program source code file is part of KiCad, a free EDA CAD application.
|
* This program source code file is part of KiCad, a free EDA CAD application.
|
||||||
*
|
*
|
||||||
* Copyright (C) 2004-2022 KiCad Developers.
|
* Copyright (C) 2004-2023 KiCad Developers.
|
||||||
*
|
*
|
||||||
* This program is free software; you can redistribute it and/or
|
* This program is free software; you can redistribute it and/or
|
||||||
* modify it under the terms of the GNU General Public License
|
* modify it under the terms of the GNU General Public License
|
||||||
|
@ -100,7 +100,7 @@ bool DRC_TEST_PROVIDER_CONNECTIVITY::Run()
|
||||||
int code = track->Type() == PCB_VIA_T ? DRCE_DANGLING_VIA : DRCE_DANGLING_TRACK;
|
int code = track->Type() == PCB_VIA_T ? DRCE_DANGLING_VIA : DRCE_DANGLING_TRACK;
|
||||||
VECTOR2I pos;
|
VECTOR2I pos;
|
||||||
|
|
||||||
if( connectivity->TestTrackEndpointDangling( track, &pos ) )
|
if( connectivity->TestTrackEndpointDangling( track, true, &pos ) )
|
||||||
{
|
{
|
||||||
std::shared_ptr<DRC_ITEM> drcItem = DRC_ITEM::Create( code );
|
std::shared_ptr<DRC_ITEM> drcItem = DRC_ITEM::Create( code );
|
||||||
drcItem->SetItems( track );
|
drcItem->SetItems( track );
|
||||||
|
|
|
@ -3,7 +3,7 @@
|
||||||
*
|
*
|
||||||
* Copyright (C) 2004-2018 Jean-Pierre Charras, jp.charras at wanadoo.fr
|
* Copyright (C) 2004-2018 Jean-Pierre Charras, jp.charras at wanadoo.fr
|
||||||
* Copyright (C) 2011 Wayne Stambaugh <stambaughw@verizon.net>
|
* Copyright (C) 2011 Wayne Stambaugh <stambaughw@verizon.net>
|
||||||
* Copyright (C) 1992-2022 KiCad Developers, see AUTHORS.txt for contributors.
|
* Copyright (C) 1992-2023 KiCad Developers, see AUTHORS.txt for contributors.
|
||||||
*
|
*
|
||||||
* This program is free software; you can redistribute it and/or
|
* This program is free software; you can redistribute it and/or
|
||||||
* modify it under the terms of the GNU General Public License
|
* modify it under the terms of the GNU General Public License
|
||||||
|
@ -273,7 +273,7 @@ bool TRACKS_CLEANER::deleteDanglingTracks( bool aTrack, bool aVia )
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
// Test if a track (or a via) endpoint is not connected to another track or zone.
|
// Test if a track (or a via) endpoint is not connected to another track or zone.
|
||||||
if( m_brd->GetConnectivity()->TestTrackEndpointDangling( track ) )
|
if( m_brd->GetConnectivity()->TestTrackEndpointDangling( track, false ) )
|
||||||
{
|
{
|
||||||
std::shared_ptr<CLEANUP_ITEM> item;
|
std::shared_ptr<CLEANUP_ITEM> item;
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue