PNS: Allow for approximation error in hull clearance
Also revert to using exact hulls for non-compound shapes Fixes https://gitlab.com/kicad/code/kicad/-/issues/14898
This commit is contained in:
parent
660c407095
commit
96f9f2c658
|
@ -1185,10 +1185,24 @@ std::unique_ptr<PNS::SOLID> PNS_KICAD_IFACE_BASE::syncPad( PAD* aPad )
|
||||||
if( aPad->GetDrillSize().x > 0 )
|
if( aPad->GetDrillSize().x > 0 )
|
||||||
solid->SetHole( new PNS::HOLE( aPad->GetEffectiveHoleShape()->Clone() ) );
|
solid->SetHole( new PNS::HOLE( aPad->GetEffectiveHoleShape()->Clone() ) );
|
||||||
|
|
||||||
std::shared_ptr<SHAPE_POLY_SET> shape = aPad->GetEffectivePolygon();
|
std::shared_ptr<SHAPE> shape = aPad->GetEffectiveShape( UNDEFINED_LAYER,
|
||||||
|
FLASHING::ALWAYS_FLASHED );
|
||||||
|
std::shared_ptr<SHAPE_POLY_SET> polygon = aPad->GetEffectivePolygon();
|
||||||
|
|
||||||
if( shape->OutlineCount() )
|
if( shape->HasIndexableSubshapes() && polygon->OutlineCount() )
|
||||||
solid->SetShape( new SHAPE_SIMPLE( shape->Outline( 0 ) ) );
|
{
|
||||||
|
solid->SetShape( new SHAPE_SIMPLE( polygon->Outline( 0 ) ) );
|
||||||
|
|
||||||
|
// GetEffectivePolygon may produce an approximation of the shape, so we need to account for
|
||||||
|
// this when building hulls around this shape.
|
||||||
|
solid->SetExtraClearance( m_board->GetDesignSettings().m_MaxError );
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
// Prefer using the original shape if it's not a compound shape; the hulls for
|
||||||
|
// circular and rectangular pads can be exact.
|
||||||
|
solid->SetShape( shape->Clone() );
|
||||||
|
}
|
||||||
|
|
||||||
return solid;
|
return solid;
|
||||||
}
|
}
|
||||||
|
|
|
@ -41,6 +41,8 @@ const SHAPE_LINE_CHAIN SOLID::Hull( int aClearance, int aWalkaroundThickness, in
|
||||||
if( !m_shape )
|
if( !m_shape )
|
||||||
return SHAPE_LINE_CHAIN();
|
return SHAPE_LINE_CHAIN();
|
||||||
|
|
||||||
|
aClearance += ExtraClearance();
|
||||||
|
|
||||||
if( m_shape->Type() == SH_COMPOUND )
|
if( m_shape->Type() == SH_COMPOUND )
|
||||||
{
|
{
|
||||||
SHAPE_COMPOUND* cmpnd = static_cast<SHAPE_COMPOUND*>( m_shape );
|
SHAPE_COMPOUND* cmpnd = static_cast<SHAPE_COMPOUND*>( m_shape );
|
||||||
|
|
|
@ -38,7 +38,8 @@ public:
|
||||||
SOLID() :
|
SOLID() :
|
||||||
ITEM( SOLID_T ),
|
ITEM( SOLID_T ),
|
||||||
m_shape( nullptr ),
|
m_shape( nullptr ),
|
||||||
m_hole( nullptr )
|
m_hole( nullptr ),
|
||||||
|
m_extraClearance( 0 )
|
||||||
{
|
{
|
||||||
m_movable = false;
|
m_movable = false;
|
||||||
m_padToDie = 0;
|
m_padToDie = 0;
|
||||||
|
@ -65,6 +66,7 @@ public:
|
||||||
m_padToDie = aSolid.m_padToDie;
|
m_padToDie = aSolid.m_padToDie;
|
||||||
m_orientation = aSolid.m_orientation;
|
m_orientation = aSolid.m_orientation;
|
||||||
m_anchorPoints = aSolid.m_anchorPoints;
|
m_anchorPoints = aSolid.m_anchorPoints;
|
||||||
|
m_extraClearance = aSolid.m_extraClearance;
|
||||||
}
|
}
|
||||||
|
|
||||||
SOLID& operator=( const SOLID& aB )
|
SOLID& operator=( const SOLID& aB )
|
||||||
|
@ -79,6 +81,7 @@ public:
|
||||||
m_padToDie = aB.m_padToDie;
|
m_padToDie = aB.m_padToDie;
|
||||||
m_orientation = aB.m_orientation;
|
m_orientation = aB.m_orientation;
|
||||||
m_anchorPoints = aB.m_anchorPoints;
|
m_anchorPoints = aB.m_anchorPoints;
|
||||||
|
m_extraClearance = aB.m_extraClearance;
|
||||||
return *this;
|
return *this;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -135,6 +138,9 @@ public:
|
||||||
virtual bool HasHole() const override { return m_hole != nullptr; }
|
virtual bool HasHole() const override { return m_hole != nullptr; }
|
||||||
virtual HOLE *Hole() const override { return m_hole; }
|
virtual HOLE *Hole() const override { return m_hole; }
|
||||||
|
|
||||||
|
int ExtraClearance() const { return m_extraClearance; }
|
||||||
|
void SetExtraClearance( int aClearance ) { m_extraClearance = aClearance; }
|
||||||
|
|
||||||
private:
|
private:
|
||||||
VECTOR2I m_pos;
|
VECTOR2I m_pos;
|
||||||
SHAPE* m_shape;
|
SHAPE* m_shape;
|
||||||
|
@ -143,6 +149,7 @@ private:
|
||||||
EDA_ANGLE m_orientation;
|
EDA_ANGLE m_orientation;
|
||||||
HOLE* m_hole;
|
HOLE* m_hole;
|
||||||
std::vector<VECTOR2I> m_anchorPoints;
|
std::vector<VECTOR2I> m_anchorPoints;
|
||||||
|
int m_extraClearance;
|
||||||
};
|
};
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue