Add edge-exclusions to router (for castellated pads).
Fixes https://gitlab.com/kicad/code/kicad/issues/1790
This commit is contained in:
parent
89eeba3312
commit
833dc70bff
|
@ -2,7 +2,7 @@
|
||||||
* KiRouter - a push-and-(sometimes-)shove PCB router
|
* KiRouter - a push-and-(sometimes-)shove PCB router
|
||||||
*
|
*
|
||||||
* Copyright (C) 2013-2014 CERN
|
* Copyright (C) 2013-2014 CERN
|
||||||
* Copyright (C) 2016-2020 KiCad Developers, see AUTHORS.txt for contributors.
|
* Copyright (C) 2016-2022 KiCad Developers, see AUTHORS.txt for contributors.
|
||||||
* Author: Tomasz Wlostowski <tomasz.wlostowski@cern.ch>
|
* Author: Tomasz Wlostowski <tomasz.wlostowski@cern.ch>
|
||||||
*
|
*
|
||||||
* This program is free software: you can redistribute it and/or modify it
|
* This program is free software: you can redistribute it and/or modify it
|
||||||
|
@ -129,7 +129,19 @@ bool ITEM::collideSimple( const ITEM* aOther, const NODE* aNode, bool aDifferent
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
int clearance = aOverrideClearance >= 0 ? aOverrideClearance : aNode->GetClearance( this, aOther );
|
int clearance = aOverrideClearance >= 0 ? aOverrideClearance : aNode->GetClearance( this, aOther );
|
||||||
return shapeA->Collide( shapeB, clearance + lineWidthA + lineWidthB );
|
|
||||||
|
if( m_parent && m_parent->GetLayer() == Edge_Cuts )
|
||||||
|
{
|
||||||
|
int actual;
|
||||||
|
VECTOR2I pos;
|
||||||
|
|
||||||
|
return( shapeA->Collide( shapeB, clearance + lineWidthA, &actual, &pos )
|
||||||
|
&& !aNode->QueryEdgeExclusions( pos ) );
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
return shapeA->Collide( shapeB, clearance + lineWidthA + lineWidthB );
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -1285,6 +1285,13 @@ void PNS_KICAD_IFACE_BASE::SyncWorld( PNS::NODE *aWorld )
|
||||||
aWorld->Add( std::move( solid ) );
|
aWorld->Add( std::move( solid ) );
|
||||||
|
|
||||||
worstClearance = std::max( worstClearance, pad->GetLocalClearance() );
|
worstClearance = std::max( worstClearance, pad->GetLocalClearance() );
|
||||||
|
|
||||||
|
if( pad->GetProperty() == PAD_PROP::CASTELLATED )
|
||||||
|
{
|
||||||
|
std::unique_ptr<SHAPE> hole;
|
||||||
|
hole.reset( new SHAPE_SEGMENT( *pad->GetEffectiveHoleShape() ) );
|
||||||
|
aWorld->AddEdgeExclusion( std::move( hole ) );
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
syncTextItem( aWorld, &footprint->Reference(), footprint->Reference().GetLayer() );
|
syncTextItem( aWorld, &footprint->Reference(), footprint->Reference().GetLayer() );
|
||||||
|
|
|
@ -2,7 +2,7 @@
|
||||||
* KiRouter - a push-and-(sometimes-)shove PCB router
|
* KiRouter - a push-and-(sometimes-)shove PCB router
|
||||||
*
|
*
|
||||||
* Copyright (C) 2013-2019 CERN
|
* Copyright (C) 2013-2019 CERN
|
||||||
* Copyright (C) 2016-2021 KiCad Developers, see AUTHORS.txt for contributors.
|
* Copyright (C) 2016-2022 KiCad Developers, see AUTHORS.txt for contributors.
|
||||||
*
|
*
|
||||||
* @author Tomasz Wlostowski <tomasz.wlostowski@cern.ch>
|
* @author Tomasz Wlostowski <tomasz.wlostowski@cern.ch>
|
||||||
*
|
*
|
||||||
|
@ -717,6 +717,24 @@ void NODE::Add( std::unique_ptr< ITEM > aItem, bool aAllowRedundant )
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void NODE::AddEdgeExclusion( std::unique_ptr<SHAPE> aShape )
|
||||||
|
{
|
||||||
|
m_edgeExclusions.push_back( std::move( aShape ) );
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
bool NODE::QueryEdgeExclusions( const VECTOR2I& aPos ) const
|
||||||
|
{
|
||||||
|
for( const std::unique_ptr<SHAPE>& edgeExclusion : m_edgeExclusions )
|
||||||
|
{
|
||||||
|
if( edgeExclusion->Collide( aPos ) )
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
void NODE::doRemove( ITEM* aItem )
|
void NODE::doRemove( ITEM* aItem )
|
||||||
{
|
{
|
||||||
// case 1: removing an item that is stored in the root node from any branch:
|
// case 1: removing an item that is stored in the root node from any branch:
|
||||||
|
|
|
@ -2,7 +2,7 @@
|
||||||
* KiRouter - a push-and-(sometimes-)shove PCB router
|
* KiRouter - a push-and-(sometimes-)shove PCB router
|
||||||
*
|
*
|
||||||
* Copyright (C) 2013-2014 CERN
|
* Copyright (C) 2013-2014 CERN
|
||||||
* Copyright (C) 2016-2021 KiCad Developers, see AUTHORS.txt for contributors.
|
* Copyright (C) 2016-2022 KiCad Developers, see AUTHORS.txt for contributors.
|
||||||
*
|
*
|
||||||
* @author Tomasz Wlostowski <tomasz.wlostowski@cern.ch>
|
* @author Tomasz Wlostowski <tomasz.wlostowski@cern.ch>
|
||||||
*
|
*
|
||||||
|
@ -278,6 +278,10 @@ public:
|
||||||
|
|
||||||
void Add( LINE& aLine, bool aAllowRedundant = false );
|
void Add( LINE& aLine, bool aAllowRedundant = false );
|
||||||
|
|
||||||
|
void AddEdgeExclusion( std::unique_ptr<SHAPE> aShape );
|
||||||
|
|
||||||
|
bool QueryEdgeExclusions( const VECTOR2I& aPos ) const;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Remove an item from this branch.
|
* Remove an item from this branch.
|
||||||
*/
|
*/
|
||||||
|
@ -484,6 +488,8 @@ private:
|
||||||
int m_depth; ///< depth of the node (number of parent nodes in the
|
int m_depth; ///< depth of the node (number of parent nodes in the
|
||||||
///< inheritance chain)
|
///< inheritance chain)
|
||||||
|
|
||||||
|
std::vector< std::unique_ptr<SHAPE> > m_edgeExclusions;
|
||||||
|
|
||||||
std::unordered_set<ITEM*> m_garbageItems;
|
std::unordered_set<ITEM*> m_garbageItems;
|
||||||
|
|
||||||
COLLISION_QUERY_SCOPE m_collisionQueryScope;
|
COLLISION_QUERY_SCOPE m_collisionQueryScope;
|
||||||
|
|
Loading…
Reference in New Issue