Browse Source

Don't allow collisions with self.

The previous test didn't handle is-self-tests between a hole and
its override in a different NODE.  When calculating the pushout
force we don't remove the via (and its hole) from the current
node until after the calculation, so we end up checking for
collisions between the new (cloned) via's hole and the original
hole in the root node.

Fixes https://gitlab.com/kicad/code/kicad/-/issues/14795
newinvert
Jeff Young 3 years ago
parent
commit
b442d769fd
  1. 2
      pcbnew/router/pns_hole.h
  2. 4
      pcbnew/router/pns_item.cpp
  3. 7
      pcbnew/router/pns_item.h

2
pcbnew/router/pns_hole.h

@ -69,7 +69,7 @@ public:
const SHAPE* Shape() const override { return m_holeShape; }
void SetParentPadVia( ITEM* aParent ) { m_parentPadVia = aParent; }
ITEM* ParentPadVia() const { return m_parentPadVia; }
ITEM* ParentPadVia() const override { return m_parentPadVia; }
BOARD_ITEM* BoardItem() const override
{

4
pcbnew/router/pns_item.cpp

@ -65,7 +65,7 @@ bool ITEM::collideSimple( const ITEM* aHead, const NODE* aNode,
//printf( "h %p n %p t %p ctx %p\n", aHead, aNode, this, aCtx );
if( this == aHead || this == holeH ) // we cannot be self-colliding
if( this == aHead ) // we cannot be self-colliding
return false;
// Special cases for "head" lines with vias attached at the end. Note that this does not
@ -86,7 +86,7 @@ bool ITEM::collideSimple( const ITEM* aHead, const NODE* aNode,
// And a special case for the "head" via's hole.
if( holeH )
if( holeH && !HasSameParentPadVia( holeH ) )
collisionsFound |= collideSimple( holeH, aNode, aCtx );
// Sadly collision routines ignore SHAPE_POLY_LINE widths so we have to pass them in as part

7
pcbnew/router/pns_item.h

@ -250,6 +250,13 @@ public:
void SetIsFreePad( bool aIsFreePad = true ) { m_isFreePad = aIsFreePad; }
bool IsFreePad() const { return m_isFreePad; }
virtual ITEM* ParentPadVia() const { return nullptr; }
virtual bool HasSameParentPadVia( const ITEM* aOther ) const
{
return ParentPadVia() && aOther->ParentPadVia()
&& ParentPadVia()->Parent() == aOther->ParentPadVia()->Parent();
}
bool IsVirtual() const
{
return m_isVirtual;

Loading…
Cancel
Save