diff --git a/3d-viewer/3d_canvas/board_adapter.cpp b/3d-viewer/3d_canvas/board_adapter.cpp index 316ca5559c..6497c984c2 100644 --- a/3d-viewer/3d_canvas/board_adapter.cpp +++ b/3d-viewer/3d_canvas/board_adapter.cpp @@ -426,8 +426,10 @@ void BOARD_ADAPTER::InitSettings( REPORTER* aStatusReporter, REPORTER* aWarningR if( aStatusReporter ) aStatusReporter->Report( _( "Build board body" ) ); - if( !createBoardPolygon() ) - aWarningReporter->Report( _( "Board outline is not closed" ), RPT_SEVERITY_WARNING ); + wxString msg; + + if( !createBoardPolygon( &msg ) ) + aWarningReporter->Report( _( "Board outline is not closed: " ) + msg, RPT_SEVERITY_WARNING ); else aWarningReporter->Report( wxEmptyString ); @@ -454,13 +456,13 @@ void BOARD_ADAPTER::InitSettings( REPORTER* aStatusReporter, REPORTER* aWarningR } -bool BOARD_ADAPTER::createBoardPolygon() +bool BOARD_ADAPTER::createBoardPolygon( wxString* aErrorMsg ) { m_board_poly.RemoveAllContours(); wxString errmsg; - return m_board->GetBoardPolygonOutlines( m_board_poly, &errmsg ); + return m_board->GetBoardPolygonOutlines( m_board_poly, aErrorMsg ); } diff --git a/3d-viewer/3d_canvas/board_adapter.h b/3d-viewer/3d_canvas/board_adapter.h index dbccded218..b1e607c44a 100644 --- a/3d-viewer/3d_canvas/board_adapter.h +++ b/3d-viewer/3d_canvas/board_adapter.h @@ -569,7 +569,7 @@ class BOARD_ADAPTER * * @return false if the outline could not be created */ - bool createBoardPolygon(); + bool createBoardPolygon( wxString* aErrorMsg ); void createLayers( REPORTER* aStatusReporter ); void destroyLayers(); diff --git a/common/reporter.cpp b/common/reporter.cpp index d657f60aa9..86fc52f82e 100644 --- a/common/reporter.cpp +++ b/common/reporter.cpp @@ -199,6 +199,9 @@ void INFOBAR_REPORTER::Finalize() case RPT_SEVERITY_IGNORE: icon = wxICON_INFORMATION; break; } + if( m_message.EndsWith( "\n" ) ) + m_message = m_message.Left( m_message.Length() - 1 ); + if( HasMessage() ) m_infoBar->QueueShowMessage( m_message, icon ); else diff --git a/pcbnew/class_board.cpp b/pcbnew/class_board.cpp index f8dc3fd202..fd7f3a5a49 100644 --- a/pcbnew/class_board.cpp +++ b/pcbnew/class_board.cpp @@ -1813,11 +1813,11 @@ extern bool BuildBoardPolygonOutlines( BOARD* aBoard, SHAPE_POLY_SET& aOutlines, wxPoint* aErrorLocation = nullptr ); -bool BOARD::GetBoardPolygonOutlines( SHAPE_POLY_SET& aOutlines, wxString* aErrorText, wxPoint* aErrorLocation ) +bool BOARD::GetBoardPolygonOutlines( SHAPE_POLY_SET& aOutlines, wxString* aErrorText, + wxPoint* aErrorLocation ) { - bool success = BuildBoardPolygonOutlines( this, aOutlines, aErrorText, - GetDesignSettings().m_MaxError, aErrorLocation ); + GetDesignSettings().m_MaxError, aErrorLocation ); // Make polygon strictly simple to avoid issues (especially in 3D viewer) aOutlines.Simplify( SHAPE_POLY_SET::PM_STRICTLY_SIMPLE ); diff --git a/pcbnew/class_board.h b/pcbnew/class_board.h index d230e3b2fd..3460ac295b 100644 --- a/pcbnew/class_board.h +++ b/pcbnew/class_board.h @@ -621,8 +621,8 @@ public: * * @return true if success, false if a contour is not valid */ - bool GetBoardPolygonOutlines( SHAPE_POLY_SET& aOutlines, - wxString* aErrorText = nullptr, wxPoint* aErrorLocation = nullptr ); + bool GetBoardPolygonOutlines( SHAPE_POLY_SET& aOutlines, wxString* aErrorText = nullptr, + wxPoint* aErrorLocation = nullptr ); /** * Function ConvertBrdLayerToPolygonalContours diff --git a/pcbnew/convert_drawsegment_list_to_polygon.cpp b/pcbnew/convert_drawsegment_list_to_polygon.cpp index 28e8e24825..aaf04b2119 100644 --- a/pcbnew/convert_drawsegment_list_to_polygon.cpp +++ b/pcbnew/convert_drawsegment_list_to_polygon.cpp @@ -488,9 +488,9 @@ bool ConvertOutlineToPolygon( std::vector& aSegList, SHAPE_POLY_SE { if( aErrorText ) { - msg.Printf( _( "Unable to find segment with an endpoint of (%s, %s)." ), - StringFromValue( EDA_UNITS::MILLIMETRES, prevPt.x, true ), - StringFromValue( EDA_UNITS::MILLIMETRES, prevPt.y, true ) ); + msg.Printf( _( "Unable to find edge with an endpoint of (%s, %s)." ), + StringFromValue( EDA_UNITS::MILLIMETRES, prevPt.x, true ), + StringFromValue( EDA_UNITS::MILLIMETRES, prevPt.y, true ) ); *aErrorText << msg << "\n"; } @@ -694,7 +694,7 @@ bool ConvertOutlineToPolygon( std::vector& aSegList, SHAPE_POLY_SE { if( aErrorText ) { - msg.Printf( _( "Unable to find segment with an endpoint of (%s, %s)." ), + msg.Printf( _( "Unable to find edge with an endpoint of (%s, %s)." ), StringFromValue( EDA_UNITS::MILLIMETRES, prevPt.x, true ), StringFromValue( EDA_UNITS::MILLIMETRES, prevPt.y, true ) ); @@ -758,8 +758,8 @@ bool ConvertOutlineToPolygon( std::vector& aSegList, SHAPE_POLY_SE * Any closed outline inside the main outline is a hole * All contours should be closed, i.e. valid closed polygon vertices */ -bool BuildBoardPolygonOutlines( BOARD* aBoard, SHAPE_POLY_SET& aOutlines, - wxString* aErrorText, unsigned int aTolerance, wxPoint* aErrorLocation ) +bool BuildBoardPolygonOutlines( BOARD* aBoard, SHAPE_POLY_SET& aOutlines, wxString* aErrorText, + unsigned int aTolerance, wxPoint* aErrorLocation ) { PCB_TYPE_COLLECTOR items; bool success = false; @@ -783,6 +783,10 @@ bool BuildBoardPolygonOutlines( BOARD* aBoard, SHAPE_POLY_SET& aOutlines, success = ConvertOutlineToPolygon( segList, aOutlines, aErrorText, aTolerance, aErrorLocation ); } + else + { + *aErrorText = _( "No edges found on Edge.Cuts layer." ); + } if( !success || !aOutlines.OutlineCount() ) {