From a37b268611b7759d0588d74ca51107cd44f2d843 Mon Sep 17 00:00:00 2001 From: azv Date: Thu, 7 Jun 2018 15:30:25 +0300 Subject: [PATCH] Make Filling user friendly when reporting errors --- src/BuildPlugin/BuildPlugin_Filling.cpp | 7 ++++++- src/GeomAlgoAPI/GeomAlgoAPI_Filling.cpp | 8 ++++++-- 2 files changed, 12 insertions(+), 3 deletions(-) diff --git a/src/BuildPlugin/BuildPlugin_Filling.cpp b/src/BuildPlugin/BuildPlugin_Filling.cpp index 7e2c884ce..4aff9c942 100644 --- a/src/BuildPlugin/BuildPlugin_Filling.cpp +++ b/src/BuildPlugin/BuildPlugin_Filling.cpp @@ -137,7 +137,12 @@ bool BuildPlugin_Filling::isAlgorithmFailed( { if (!theAlgorithm->isDone()) { static const std::string aFeatureError = "Error: filling algorithm failed."; - setError(aFeatureError); + std::string anAlgoError = theAlgorithm->getError(); + if (anAlgoError.empty()) + anAlgoError = aFeatureError; + else + anAlgoError = aFeatureError + " " + anAlgoError; + setError(anAlgoError); return true; } if (theAlgorithm->shape()->isNull()) { diff --git a/src/GeomAlgoAPI/GeomAlgoAPI_Filling.cpp b/src/GeomAlgoAPI/GeomAlgoAPI_Filling.cpp index 0dc3861f5..f08f44a4f 100644 --- a/src/GeomAlgoAPI/GeomAlgoAPI_Filling.cpp +++ b/src/GeomAlgoAPI/GeomAlgoAPI_Filling.cpp @@ -101,14 +101,18 @@ void GeomAlgoAPI_Filling::buildByEdges() Handle(GeomFill_Line) aLine = new GeomFill_Line(aNbCurves); // check myMaxDegree >= aCurves.size() - 1 to be able to interpolate a surface - if (myMaxDegree + 1 < aNbCurves) + if (myMaxDegree + 1 < aNbCurves) { + myError = "Unable to interpolate surface, Max deg + 1 should be greater or equal than number of sections."; return; + } // perform filling by sections GeomFill_AppSurf anAppSurf(myMinDegree, myMaxDegree, myTol3D, myTol2D, myNbIter); anAppSurf.Perform(aLine, aSection); - if (!anAppSurf.IsDone()) + if (!anAppSurf.IsDone()) { + myError = "Approximation algorithm failed."; return; + } // build calculated surface Standard_Integer UDegree, VDegree, NbUPoles, NbVPoles, NbUKnots, NbVKnots; -- 2.39.2