Take footprint edge cuts into account in the board statistics
Reported in https://gitlab.com/kicad/code/kicad/-/issues/18245
This commit is contained in:
parent
c8ebcc8e0f
commit
10988478da
|
@ -325,27 +325,9 @@ void DIALOG_BOARD_STATISTICS::getDataFromPCB()
|
||||||
sort( m_drillTypes.begin(), m_drillTypes.end(),
|
sort( m_drillTypes.begin(), m_drillTypes.end(),
|
||||||
DRILL_LINE_ITEM::COMPARE( DRILL_LINE_ITEM::COL_COUNT, false ) );
|
DRILL_LINE_ITEM::COMPARE( DRILL_LINE_ITEM::COL_COUNT, false ) );
|
||||||
|
|
||||||
bool boundingBoxCreated = false; //flag if bounding box initialized
|
|
||||||
BOX2I bbox;
|
|
||||||
SHAPE_POLY_SET polySet;
|
SHAPE_POLY_SET polySet;
|
||||||
m_hasOutline = board->GetBoardPolygonOutlines( polySet );
|
m_hasOutline = board->GetBoardPolygonOutlines( polySet );
|
||||||
|
|
||||||
// If board has no Edge Cuts lines, board->GetBoardPolygonOutlines will
|
|
||||||
// return small rectangle, so we double check that
|
|
||||||
bool edgeCutsExists = false;
|
|
||||||
|
|
||||||
for( BOARD_ITEM* drawing : board->Drawings() )
|
|
||||||
{
|
|
||||||
if( drawing->GetLayer() == Edge_Cuts )
|
|
||||||
{
|
|
||||||
edgeCutsExists = true;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if( !edgeCutsExists )
|
|
||||||
m_hasOutline = false;
|
|
||||||
|
|
||||||
if( m_hasOutline )
|
if( m_hasOutline )
|
||||||
{
|
{
|
||||||
m_boardArea = 0.0;
|
m_boardArea = 0.0;
|
||||||
|
@ -391,17 +373,10 @@ void DIALOG_BOARD_STATISTICS::getDataFromPCB()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if( boundingBoxCreated )
|
// Compute the bounding box to get a rectangular size
|
||||||
{
|
BOX2I bbox = board->GetBoardEdgesBoundingBox();
|
||||||
bbox.Merge( outline.BBox() );
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
bbox = outline.BBox();
|
|
||||||
boundingBoxCreated = true;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
m_boardWidth = bbox.GetWidth();
|
m_boardWidth = bbox.GetWidth();
|
||||||
m_boardHeight = bbox.GetHeight();
|
m_boardHeight = bbox.GetHeight();
|
||||||
|
|
Loading…
Reference in New Issue