diff --git a/pcbnew/router/pns_kicad_iface.cpp b/pcbnew/router/pns_kicad_iface.cpp index 2f44ead9de..7bbb04c041 100644 --- a/pcbnew/router/pns_kicad_iface.cpp +++ b/pcbnew/router/pns_kicad_iface.cpp @@ -88,6 +88,8 @@ public: int ClearanceEpsilon() const { return m_clearanceEpsilon; } + void ClearCacheForItem( const PNS::ITEM* aItem ) override; + private: int holeRadius( const PNS::ITEM* aItem ) const; @@ -294,6 +296,12 @@ bool PNS_PCBNEW_RULE_RESOLVER::QueryConstraint( PNS::CONSTRAINT_TYPE aType, } +void PNS_PCBNEW_RULE_RESOLVER::ClearCacheForItem( const PNS::ITEM* aItem ) +{ + m_clearanceCache.erase( std::make_pair( aItem, nullptr ) ); +} + + int PNS_PCBNEW_RULE_RESOLVER::Clearance( const PNS::ITEM* aA, const PNS::ITEM* aB ) { std::pair key( aA, aB ); diff --git a/pcbnew/router/pns_node.h b/pcbnew/router/pns_node.h index c707b367a1..a8cb643951 100644 --- a/pcbnew/router/pns_node.h +++ b/pcbnew/router/pns_node.h @@ -94,6 +94,8 @@ public: PNS::CONSTRAINT* aConstraint ) = 0; virtual wxString NetName( int aNet ) = 0; + + virtual void ClearCacheForItem( const ITEM* aItem ) {} }; /** diff --git a/pcbnew/router/pns_router.cpp b/pcbnew/router/pns_router.cpp index 53d5c03db3..3e1d7fcc43 100644 --- a/pcbnew/router/pns_router.cpp +++ b/pcbnew/router/pns_router.cpp @@ -548,6 +548,7 @@ void ROUTER::updateView( NODE* aNode, ITEM_SET& aCurrent, bool aDragging ) for( ITEM* item : added ) { + GetRuleResolver()->ClearCacheForItem( item ); int clearance = GetRuleResolver()->Clearance( item, nullptr ); m_iface->DisplayItem( item, clearance, aDragging ); }