Add edge-exclusions to router (for castellated pads).
Fixes https://gitlab.com/kicad/code/kicad/issues/1790
(cherry picked from commit 833dc70bff
)
This commit is contained in:
parent
58451335cb
commit
cd5b4ec8f2
|
@ -223,7 +223,7 @@ void DIALOG_ERC::updateDisplayedCounts()
|
|||
msg.Replace( wxT( "(%s)" ), wxEmptyString );
|
||||
}
|
||||
|
||||
m_notebook->SetPageText( 0, msg );
|
||||
m_notebook->SetPageText( 1, msg );
|
||||
|
||||
if( !m_ercRun && numErrors == 0 )
|
||||
numErrors = -1;
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
* KiRouter - a push-and-(sometimes-)shove PCB router
|
||||
*
|
||||
* 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>
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify it
|
||||
|
@ -124,7 +124,19 @@ bool ITEM::collideSimple( const ITEM* aOther, const NODE* aNode, bool aDifferent
|
|||
return false;
|
||||
|
||||
int clearance = 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 );
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -1343,6 +1343,13 @@ void PNS_KICAD_IFACE_BASE::SyncWorld( PNS::NODE *aWorld )
|
|||
aWorld->Add( std::move( solid ) );
|
||||
|
||||
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() );
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
* KiRouter - a push-and-(sometimes-)shove PCB router
|
||||
*
|
||||
* 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>
|
||||
*
|
||||
|
@ -712,6 +712,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 )
|
||||
{
|
||||
// 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
|
||||
*
|
||||
* 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>
|
||||
*
|
||||
|
@ -269,6 +269,10 @@ public:
|
|||
|
||||
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.
|
||||
*/
|
||||
|
@ -465,6 +469,8 @@ private:
|
|||
int m_depth; ///< depth of the node (number of parent nodes in the
|
||||
///< inheritance chain)
|
||||
|
||||
std::vector< std::unique_ptr<SHAPE> > m_edgeExclusions;
|
||||
|
||||
std::unordered_set<ITEM*> m_garbageItems;
|
||||
};
|
||||
|
||||
|
|
Loading…
Reference in New Issue