diff --git a/3d-viewer/3d_canvas/cinfo3d_visu.cpp b/3d-viewer/3d_canvas/cinfo3d_visu.cpp index f6c74466ea..7e4abf8a1c 100644 --- a/3d-viewer/3d_canvas/cinfo3d_visu.cpp +++ b/3d-viewer/3d_canvas/cinfo3d_visu.cpp @@ -484,6 +484,9 @@ void CINFO3D_VISU::createBoardPolygon() wxLogMessage( errmsg ); } + // Be sure the polygon is strictly simple to avoid issues. + m_board_poly.Simplify( SHAPE_POLY_SET::PM_STRICTLY_SIMPLE ); + Polygon_Calc_BBox_3DU( m_board_poly, m_board2dBBox3DU, m_biuTo3Dunits ); } diff --git a/pcbnew/class_board.cpp b/pcbnew/class_board.cpp index 636babadbe..09f9de8656 100644 --- a/pcbnew/class_board.cpp +++ b/pcbnew/class_board.cpp @@ -2881,5 +2881,11 @@ extern bool BuildBoardPolygonOutlines( BOARD* aBoard, bool BOARD::GetBoardPolygonOutlines( SHAPE_POLY_SET& aOutlines, wxString* aErrorText ) { - return BuildBoardPolygonOutlines( this, aOutlines, aErrorText ); + bool success = BuildBoardPolygonOutlines( this, aOutlines, aErrorText ); + + // Make polygon strictly simple to avoid issues (especially in 3D viewer) + aOutlines.Simplify( SHAPE_POLY_SET::PM_STRICTLY_SIMPLE ); + + return success; + }