mirror of
https://gitlab.com/kicad/code/kicad.git
synced 2025-04-19 18:01:21 +00:00
Minor adjustments to autoplace
Don't use FP bbox with text when placing footprints
Don't do unneeded poly calculation when initial work is only with
bounding box
Fixes https://gitlab.com/kicad/code/kicad/-/issues/19451
(cherry picked from commit e0c57b7f20
)
This commit is contained in:
parent
775b768833
commit
f226287360
@ -317,7 +317,7 @@ void AR_AUTOPLACER::buildFpAreas( FOOTPRINT* aFootprint, int aFpClearance )
|
||||
if( aFootprint->GetLayer() == B_Cu )
|
||||
layerMask.set( B_Cu );
|
||||
|
||||
BOX2I fpBBox = aFootprint->GetBoundingBox();
|
||||
BOX2I fpBBox = aFootprint->GetBoundingBox( false );
|
||||
|
||||
fpBBox.Inflate( ( m_matrix.m_GridRouting / 2 ) + aFpClearance );
|
||||
|
||||
@ -333,11 +333,11 @@ void AR_AUTOPLACER::buildFpAreas( FOOTPRINT* aFootprint, int aFpClearance )
|
||||
}
|
||||
|
||||
|
||||
void AR_AUTOPLACER::genModuleOnRoutingMatrix( FOOTPRINT* Module )
|
||||
void AR_AUTOPLACER::genModuleOnRoutingMatrix( FOOTPRINT* aFootprint )
|
||||
{
|
||||
int ox, oy, fx, fy;
|
||||
LSET layerMask;
|
||||
BOX2I fpBBox = Module->GetBoundingBox();
|
||||
BOX2I fpBBox = aFootprint->GetBoundingBox( false );
|
||||
|
||||
fpBBox.Inflate( m_matrix.m_GridRouting / 2 );
|
||||
ox = fpBBox.GetX();
|
||||
@ -369,28 +369,28 @@ void AR_AUTOPLACER::genModuleOnRoutingMatrix( FOOTPRINT* Module )
|
||||
if( fy > m_matrix.m_BrdBox.GetBottom() )
|
||||
fy = m_matrix.m_BrdBox.GetBottom();
|
||||
|
||||
if( Module->GetLayer() == F_Cu )
|
||||
if( aFootprint->GetLayer() == F_Cu )
|
||||
layerMask.set( F_Cu );
|
||||
|
||||
if( Module->GetLayer() == B_Cu )
|
||||
if( aFootprint->GetLayer() == B_Cu )
|
||||
layerMask.set( B_Cu );
|
||||
|
||||
m_matrix.TraceFilledRectangle( ox, oy, fx, fy, layerMask,
|
||||
CELL_IS_MODULE, AR_MATRIX::WRITE_OR_CELL );
|
||||
|
||||
// Trace pads + clearance areas.
|
||||
for( PAD* pad : Module->Pads() )
|
||||
for( PAD* pad : aFootprint->Pads() )
|
||||
{
|
||||
int margin = (m_matrix.m_GridRouting / 2) + pad->GetOwnClearance( pad->GetLayer() );
|
||||
m_matrix.PlacePad( pad, CELL_IS_MODULE, margin, AR_MATRIX::WRITE_OR_CELL );
|
||||
}
|
||||
|
||||
// Trace clearance.
|
||||
int margin = ( m_matrix.m_GridRouting * Module->GetPadCount() ) / AR_GAIN;
|
||||
int margin = ( m_matrix.m_GridRouting * aFootprint->GetPadCount() ) / AR_GAIN;
|
||||
m_matrix.CreateKeepOutRectangle( ox, oy, fx, fy, margin, AR_KEEPOUT_MARGIN , layerMask );
|
||||
|
||||
// Build the footprint courtyard
|
||||
buildFpAreas( Module, margin );
|
||||
buildFpAreas( aFootprint, margin );
|
||||
|
||||
// Substract the shape to free areas
|
||||
m_topFreeArea.BooleanSubtract( m_fpAreaTop );
|
||||
@ -514,18 +514,14 @@ int AR_AUTOPLACER::testFootprintOnBoard( FOOTPRINT* aFootprint, bool TstOtherSid
|
||||
BOX2I fpBBox = aFootprint->GetBoundingBox( false );
|
||||
fpBBox.Move( -1*aOffset );
|
||||
|
||||
buildFpAreas( aFootprint, 0 );
|
||||
|
||||
int diag = //testModuleByPolygon( aFootprint, side, aOffset );
|
||||
testRectangle( fpBBox, side );
|
||||
int diag = testRectangle( fpBBox, side );
|
||||
|
||||
if( diag != AR_FREE_CELL )
|
||||
return diag;
|
||||
|
||||
if( TstOtherSide )
|
||||
{
|
||||
diag = //testModuleByPolygon( aFootprint, otherside, aOffset );
|
||||
testRectangle( fpBBox, otherside );
|
||||
diag = testRectangle( fpBBox, otherside );
|
||||
|
||||
if( diag != AR_FREE_CELL )
|
||||
return diag;
|
||||
|
Loading…
Reference in New Issue
Block a user