Space out placed footprints with some padding.
Fixes: lp:1788917 * https://bugs.launchpad.net/kicad/+bug/1788917
This commit is contained in:
parent
4d6cd52ffc
commit
0f9ded9563
|
@ -65,6 +65,8 @@ typedef std::vector<TSubRect> CSubRectArray;
|
|||
// Use 0.01 mm units to calculate placement, to avoid long calculation time
|
||||
const int scale = (int)(0.01 * IU_PER_MM);
|
||||
|
||||
const int PADDING = (int)(1 * IU_PER_MM);
|
||||
|
||||
// Populates a list of rectangles, from a list of modules
|
||||
void fillRectList( CSubRectArray& vecSubRects, std::vector <MODULE*>& aModuleList )
|
||||
{
|
||||
|
@ -73,7 +75,8 @@ void fillRectList( CSubRectArray& vecSubRects, std::vector <MODULE*>& aModuleLis
|
|||
for( unsigned ii = 0; ii < aModuleList.size(); ii++ )
|
||||
{
|
||||
EDA_RECT fpBox = aModuleList[ii]->GetFootprintRect();
|
||||
TSubRect fpRect( fpBox.GetWidth()/scale, fpBox.GetHeight()/scale, ii );
|
||||
TSubRect fpRect( ( fpBox.GetWidth() + PADDING ) / scale,
|
||||
( fpBox.GetHeight() + PADDING ) / scale, ii );
|
||||
vecSubRects.push_back( fpRect );
|
||||
}
|
||||
}
|
||||
|
@ -284,7 +287,7 @@ void PCB_EDIT_FRAME::SpreadFootprints( std::vector<MODULE*>* aFootprints,
|
|||
islastItem = true;
|
||||
|
||||
footprintListBySheet.push_back( footprint );
|
||||
subsurface += footprint->GetArea();
|
||||
subsurface += footprint->GetArea( PADDING );
|
||||
|
||||
if( islastItem )
|
||||
{
|
||||
|
|
|
@ -62,7 +62,6 @@ MODULE::MODULE( BOARD* parent ) :
|
|||
m_ModuleStatus = MODULE_PADS_LOCKED;
|
||||
m_arflag = 0;
|
||||
m_CntRot90 = m_CntRot180 = 0;
|
||||
m_Surface = 0.0;
|
||||
m_Link = 0;
|
||||
m_LastEditTime = 0;
|
||||
m_LocalClearance = 0;
|
||||
|
@ -464,7 +463,14 @@ void MODULE::DrawEdgesOnly( EDA_DRAW_PANEL* panel, wxDC* DC, const wxPoint& offs
|
|||
void MODULE::CalculateBoundingBox()
|
||||
{
|
||||
m_BoundaryBox = GetFootprintRect();
|
||||
m_Surface = std::abs( (double) m_BoundaryBox.GetWidth() * m_BoundaryBox.GetHeight() );
|
||||
}
|
||||
|
||||
|
||||
double MODULE::GetArea( int aPadding ) const
|
||||
{
|
||||
double w = std::abs( m_BoundaryBox.GetWidth() ) + aPadding;
|
||||
double h = std::abs( m_BoundaryBox.GetHeight() ) + aPadding;
|
||||
return w * h;
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -569,7 +569,7 @@ public:
|
|||
*/
|
||||
wxString GetNextPadName( bool aFillSequenceGaps ) const;
|
||||
|
||||
double GetArea() const { return m_Surface; }
|
||||
double GetArea( int aPadding = 0 ) const;
|
||||
|
||||
timestamp_t GetLink() const { return m_Link; }
|
||||
void SetLink( timestamp_t aLink ) { m_Link = aLink; }
|
||||
|
@ -746,7 +746,6 @@ private:
|
|||
ZoneConnection m_ZoneConnection;
|
||||
timestamp_t m_LastEditTime;
|
||||
int m_arflag; ///< Use to trace ratsnest and auto routing.
|
||||
double m_Surface; ///< Bounding box area
|
||||
timestamp_t m_Link; ///< Temporary logical link used during editing
|
||||
int m_CntRot90; ///< Horizontal automatic placement cost ( 0..10 ).
|
||||
int m_CntRot180; ///< Vertical automatic placement cost ( 0..10 ).
|
||||
|
|
Loading…
Reference in New Issue