Sometimes use grid (instead of clearance) for slop radius.
This is particularly important both when very large grids are in use, and when the router hasn't been initialized with a net yet (ie: in hover mode) and the board clearance is set to 0. https://forum.kicad.info/t/new-track-start-position-problem-on-kicad-7-0-10-rc1/47006
This commit is contained in:
parent
2de8991752
commit
d155870275
|
@ -734,6 +734,8 @@ void PCB_TUNING_PATTERN::EditStart( GENERATOR_TOOL* aTool, BOARD* aBoard, BOARD_
|
|||
static PNS::LINKED_ITEM* pickSegment( PNS::ROUTER* aRouter, const VECTOR2I& aWhere, int aLayer,
|
||||
VECTOR2I& aPointOut )
|
||||
{
|
||||
int maxSlopRadius = aRouter->Sizes().Clearance() + aRouter->Sizes().TrackWidth() / 2;
|
||||
|
||||
static const int candidateCount = 2;
|
||||
PNS::LINKED_ITEM* prioritized[candidateCount];
|
||||
SEG::ecoord dist[candidateCount];
|
||||
|
@ -757,9 +759,9 @@ static PNS::LINKED_ITEM* pickSegment( PNS::ROUTER* aRouter, const VECTOR2I& aWhe
|
|||
return false;
|
||||
};
|
||||
|
||||
for( bool useClearance : { false, true } )
|
||||
for( int slopRadius : { 0, maxSlopRadius } )
|
||||
{
|
||||
PNS::ITEM_SET candidates = aRouter->QueryHoverItems( aWhere, useClearance );
|
||||
PNS::ITEM_SET candidates = aRouter->QueryHoverItems( aWhere, slopRadius );
|
||||
|
||||
for( PNS::ITEM* item : candidates.Items() )
|
||||
{
|
||||
|
|
|
@ -120,32 +120,14 @@ bool ROUTER::RoutingInProgress() const
|
|||
}
|
||||
|
||||
|
||||
const ITEM_SET ROUTER::QueryHoverItems( const VECTOR2I& aP, bool aUseClearance )
|
||||
const ITEM_SET ROUTER::QueryHoverItems( const VECTOR2I& aP, int aSlopRadius )
|
||||
{
|
||||
NODE* node = nullptr;
|
||||
int clearance = 0;
|
||||
|
||||
if( m_state == IDLE || m_placer == nullptr )
|
||||
{
|
||||
node = m_world.get();
|
||||
clearance = 0;
|
||||
}
|
||||
else if( m_mode == PNS_MODE_ROUTE_SINGLE )
|
||||
{
|
||||
node = m_placer->CurrentNode();
|
||||
clearance = m_sizes.Clearance() + m_sizes.TrackWidth() / 2;
|
||||
}
|
||||
else if( m_mode == PNS_MODE_ROUTE_DIFF_PAIR )
|
||||
{
|
||||
node = m_placer->CurrentNode();
|
||||
clearance = m_sizes.Clearance() + m_sizes.DiffPairWidth() / 2;
|
||||
}
|
||||
|
||||
NODE* node = m_placer ? m_placer->CurrentNode() : m_world.get();
|
||||
PNS::ITEM_SET ret;
|
||||
|
||||
wxCHECK( node, ret );
|
||||
|
||||
if( aUseClearance )
|
||||
if( aSlopRadius > 0 )
|
||||
{
|
||||
NODE::OBSTACLES obs;
|
||||
SEGMENT test( SEG( aP, aP ), nullptr );
|
||||
|
@ -155,7 +137,7 @@ const ITEM_SET ROUTER::QueryHoverItems( const VECTOR2I& aP, bool aUseClearance )
|
|||
test.SetLayers( LAYER_RANGE::All() );
|
||||
|
||||
opts.m_differentNetsOnly = false;
|
||||
opts.m_overrideClearance = clearance;
|
||||
opts.m_overrideClearance = aSlopRadius;
|
||||
|
||||
node->QueryColliding( &test, obs, opts );
|
||||
|
||||
|
|
|
@ -181,7 +181,7 @@ public:
|
|||
|
||||
bool IsPlacingVia() const;
|
||||
|
||||
const ITEM_SET QueryHoverItems( const VECTOR2I& aP, bool aUseClearance = false );
|
||||
const ITEM_SET QueryHoverItems( const VECTOR2I& aP, int aSlopRadius = 0 );
|
||||
|
||||
bool StartDragging( const VECTOR2I& aP, ITEM* aItem, int aDragMode = DM_ANY );
|
||||
bool StartDragging( const VECTOR2I& aP, ITEM_SET aItems, int aDragMode = DM_COMPONENT );
|
||||
|
|
|
@ -100,6 +100,7 @@ ITEM* TOOL_BASE::pickSingleItem( const VECTOR2I& aWhere, NET_HANDLE aNet, int aL
|
|||
bool aIgnorePads, const std::vector<ITEM*> aAvoidItems )
|
||||
{
|
||||
int tl = aLayer > 0 ? aLayer : getView()->GetTopLayer();
|
||||
int maxSlopRadius = std::max( m_gridHelper->GetGrid().x, m_gridHelper->GetGrid().y );
|
||||
|
||||
static const int candidateCount = 5;
|
||||
ITEM* prioritized[candidateCount];
|
||||
|
@ -123,9 +124,9 @@ ITEM* TOOL_BASE::pickSingleItem( const VECTOR2I& aWhere, NET_HANDLE aNet, int aL
|
|||
return false;
|
||||
};
|
||||
|
||||
for( bool useClearance : { false, true } )
|
||||
for( int slopRadius : { 0, maxSlopRadius } )
|
||||
{
|
||||
ITEM_SET candidates = m_router->QueryHoverItems( aWhere, useClearance );
|
||||
ITEM_SET candidates = m_router->QueryHoverItems( aWhere, slopRadius );
|
||||
|
||||
for( ITEM* item : candidates.Items() )
|
||||
{
|
||||
|
|
Loading…
Reference in New Issue