PNS: Consider pad orientation when routing
PNS: Skip smart pads when posture was manually forced This allows a more-correct pad breakout to be chosen when smart pads is off.
This commit is contained in:
parent
96d49d1473
commit
81d4e06f00
|
@ -831,6 +831,7 @@ std::unique_ptr<PNS::SOLID> PNS_KICAD_IFACE_BASE::syncPad( PAD* aPad )
|
||||||
solid->SetNet( aPad->GetNetCode() );
|
solid->SetNet( aPad->GetNetCode() );
|
||||||
solid->SetParent( aPad );
|
solid->SetParent( aPad );
|
||||||
solid->SetPadToDie( aPad->GetPadToDieLength() );
|
solid->SetPadToDie( aPad->GetPadToDieLength() );
|
||||||
|
solid->SetOrientation( aPad->GetOrientation() );
|
||||||
|
|
||||||
wxPoint wx_c = aPad->ShapePos();
|
wxPoint wx_c = aPad->ShapePos();
|
||||||
wxPoint offset = aPad->GetOffset();
|
wxPoint offset = aPad->GetOffset();
|
||||||
|
|
|
@ -28,6 +28,7 @@
|
||||||
#include "pns_node.h"
|
#include "pns_node.h"
|
||||||
#include "pns_router.h"
|
#include "pns_router.h"
|
||||||
#include "pns_shove.h"
|
#include "pns_shove.h"
|
||||||
|
#include "pns_solid.h"
|
||||||
#include "pns_topology.h"
|
#include "pns_topology.h"
|
||||||
#include "pns_walkaround.h"
|
#include "pns_walkaround.h"
|
||||||
|
|
||||||
|
@ -702,7 +703,7 @@ bool LINE_PLACER::rhShoveOnly( const VECTOR2I& aP, LINE& aNewHead )
|
||||||
|
|
||||||
int effortLevel = OPTIMIZER::MERGE_OBTUSE;
|
int effortLevel = OPTIMIZER::MERGE_OBTUSE;
|
||||||
|
|
||||||
if( Settings().SmartPads() )
|
if( Settings().SmartPads() && !m_postureSolver.IsManuallyForced() )
|
||||||
effortLevel = OPTIMIZER::SMART_PADS;
|
effortLevel = OPTIMIZER::SMART_PADS;
|
||||||
|
|
||||||
optimizer.SetEffortLevel( effortLevel );
|
optimizer.SetEffortLevel( effortLevel );
|
||||||
|
@ -995,6 +996,13 @@ bool LINE_PLACER::Start( const VECTOR2I& aP, ITEM* aStartItem )
|
||||||
seg.B.y = -seg.B.y;
|
seg.B.y = -seg.B.y;
|
||||||
lastSegDir = DIRECTION_45( seg );
|
lastSegDir = DIRECTION_45( seg );
|
||||||
}
|
}
|
||||||
|
else if( aStartItem && aStartItem->Kind() == ITEM::SOLID_T &&
|
||||||
|
static_cast<SOLID*>( aStartItem )->Parent()->Type() == PCB_PAD_T )
|
||||||
|
{
|
||||||
|
double angle = static_cast<SOLID*>( aStartItem )->GetOrientation() / 10.0;
|
||||||
|
angle = ( angle + 22.5 ) / 45.0;
|
||||||
|
lastSegDir = DIRECTION_45( static_cast<DIRECTION_45::Directions>( int( angle ) ) );
|
||||||
|
}
|
||||||
|
|
||||||
m_postureSolver.Clear();
|
m_postureSolver.Clear();
|
||||||
m_postureSolver.AddTrailPoint( aP );
|
m_postureSolver.AddTrailPoint( aP );
|
||||||
|
@ -1608,9 +1616,9 @@ DIRECTION_45 POSTURE_SOLVER::GetPosture( const VECTOR2I& aP )
|
||||||
// Adjusts how close to p0 we unlock the posture again if one was locked already
|
// Adjusts how close to p0 we unlock the posture again if one was locked already
|
||||||
const int unlockDistanceFactor = 4;
|
const int unlockDistanceFactor = 4;
|
||||||
|
|
||||||
if( m_disabled || m_trail.PointCount() < 2 )
|
if( m_disabled || m_trail.PointCount() < 2 || m_manuallyForced )
|
||||||
{
|
{
|
||||||
if( m_lastSegDirection != DIRECTION_45::UNDEFINED )
|
if( !m_manuallyForced && m_lastSegDirection != DIRECTION_45::UNDEFINED )
|
||||||
m_direction = m_lastSegDirection;
|
m_direction = m_lastSegDirection;
|
||||||
|
|
||||||
return m_direction;
|
return m_direction;
|
||||||
|
|
|
@ -95,6 +95,8 @@ public:
|
||||||
|
|
||||||
void SetDisabled( bool aDisabled = true ) { m_disabled = aDisabled; }
|
void SetDisabled( bool aDisabled = true ) { m_disabled = aDisabled; }
|
||||||
|
|
||||||
|
bool IsManuallyForced() const { return m_manuallyForced; }
|
||||||
|
|
||||||
private:
|
private:
|
||||||
SHAPE_LINE_CHAIN m_trail;
|
SHAPE_LINE_CHAIN m_trail;
|
||||||
int m_tolerance;
|
int m_tolerance;
|
||||||
|
|
|
@ -931,7 +931,7 @@ int OPTIMIZER::smartPadsSingle( LINE* aLine, ITEM* aPad, bool aEnd, int aEndVert
|
||||||
|
|
||||||
DIRECTION_45 dir_bkout( breakout.CSegment( -1 ) );
|
DIRECTION_45 dir_bkout( breakout.CSegment( -1 ) );
|
||||||
|
|
||||||
if(!connect.SegmentCount())
|
if( !connect.SegmentCount() )
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
int ang1 = dir_bkout.Angle( DIRECTION_45( connect.CSegment( 0 ) ) );
|
int ang1 = dir_bkout.Angle( DIRECTION_45( connect.CSegment( 0 ) ) );
|
||||||
|
|
|
@ -39,6 +39,7 @@ public:
|
||||||
{
|
{
|
||||||
m_movable = false;
|
m_movable = false;
|
||||||
m_padToDie = 0;
|
m_padToDie = 0;
|
||||||
|
m_orientation = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
~SOLID()
|
~SOLID()
|
||||||
|
@ -130,12 +131,16 @@ public:
|
||||||
m_offset = aOffset;
|
m_offset = aOffset;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
double GetOrientation() const { return m_orientation; }
|
||||||
|
void SetOrientation( double aOrientation ) { m_orientation = aOrientation; }
|
||||||
|
|
||||||
private:
|
private:
|
||||||
VECTOR2I m_pos;
|
VECTOR2I m_pos;
|
||||||
SHAPE* m_shape;
|
SHAPE* m_shape;
|
||||||
SHAPE* m_alternateShape;
|
SHAPE* m_alternateShape;
|
||||||
VECTOR2I m_offset;
|
VECTOR2I m_offset;
|
||||||
int m_padToDie;
|
int m_padToDie;
|
||||||
|
double m_orientation; // in 1/10 degrees, matching PAD
|
||||||
};
|
};
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue