From: Clarisse Genrault Date: Fri, 17 Mar 2017 09:06:36 +0000 (+0100) Subject: Fix bug on error message for multitranslation (id 2235). X-Git-Tag: V_2.7.0~217 X-Git-Url: http://git.salome-platform.org/gitweb/?a=commitdiff_plain;h=a39de1d3dfee7bf14d5d446575c969e13f1df257;p=modules%2Fshaper.git Fix bug on error message for multitranslation (id 2235). --- diff --git a/src/FeaturesPlugin/FeaturesPlugin_MultiTranslation.cpp b/src/FeaturesPlugin/FeaturesPlugin_MultiTranslation.cpp index 4112b4ace..26023890b 100644 --- a/src/FeaturesPlugin/FeaturesPlugin_MultiTranslation.cpp +++ b/src/FeaturesPlugin/FeaturesPlugin_MultiTranslation.cpp @@ -108,6 +108,12 @@ void FeaturesPlugin_MultiTranslation::performOneDirection() int nbCopies = integer(FeaturesPlugin_MultiTranslation::NB_COPIES_FIRST_DIR_ID())->value(); + if (nbCopies <=0) { + std::string aFeatureError = "Multitranslation builder "; + aFeatureError+=":: the number of copies for the first direction is null or negative."; + setError(aFeatureError); + } + // Moving each object. int aResultIndex = 0; std::list::iterator aContext = aContextes.begin(); @@ -237,6 +243,18 @@ void FeaturesPlugin_MultiTranslation::performTwoDirection() int aSecondNbCopies = integer(FeaturesPlugin_MultiTranslation::NB_COPIES_SECOND_DIR_ID())->value(); + if (aFirstNbCopies <=0) { + std::string aFeatureError = "Multitranslation builder "; + aFeatureError+=":: the number of copies for the first direction is null or negative."; + setError(aFeatureError); + } + + if (aSecondNbCopies <=0) { + std::string aFeatureError = "Multitranslation builder "; + aFeatureError+=":: the number of copies for the second direction is null or negative."; + setError(aFeatureError); + } + // Coord aFirstAxis double x1 = aFirstAxis->dir()->x(); double y1 = aFirstAxis->dir()->y(); diff --git a/src/GeomAlgoAPI/GeomAlgoAPI_ShapeAPI.cpp b/src/GeomAlgoAPI/GeomAlgoAPI_ShapeAPI.cpp index 9765c6456..c593215ec 100644 --- a/src/GeomAlgoAPI/GeomAlgoAPI_ShapeAPI.cpp +++ b/src/GeomAlgoAPI/GeomAlgoAPI_ShapeAPI.cpp @@ -411,6 +411,12 @@ namespace GeomAlgoAPI_ShapeAPI const double theStep, const int theNumber) throw (GeomAlgoAPI_Exception) { + if (theNumber <=0) { + std::string aError = "Multitranslation builder "; + aError+=":: the number of copies for the first direction is null or negative."; + throw GeomAlgoAPI_Exception(aError); + } + ListOfShape aListOfShape; for (int i=0; idir()->x(); double y1 = theFirstAxis->dir()->y();