X-Git-Url: http://git.salome-platform.org/gitweb/?a=blobdiff_plain;f=src%2FFeaturesAPI%2FFeaturesAPI_MultiRotation.cpp;h=cb00985a23620e4142c30a54c52517615a5d2a8c;hb=2576167d524fef734f4b8cc40bd79a96b2a0fb6a;hp=8e59da5f22c912ffd96c0f85c3c4e8cf402cf0fa;hpb=97917d3698f5a2f7fc9596e7c755ff8f6751e373;p=modules%2Fshaper.git diff --git a/src/FeaturesAPI/FeaturesAPI_MultiRotation.cpp b/src/FeaturesAPI/FeaturesAPI_MultiRotation.cpp index 8e59da5f2..cb00985a2 100644 --- a/src/FeaturesAPI/FeaturesAPI_MultiRotation.cpp +++ b/src/FeaturesAPI/FeaturesAPI_MultiRotation.cpp @@ -1,4 +1,4 @@ -// Copyright (C) 2017-2019 CEA/DEN, EDF R&D +// Copyright (C) 2017-2022 CEA/DEN, EDF R&D // // This library is free software; you can redistribute it and/or // modify it under the terms of the GNU Lesser General Public @@ -23,6 +23,7 @@ #include +#include #include #include @@ -132,19 +133,10 @@ void FeaturesAPI_MultiRotation::dump(ModelHighAPI_Dumper& theDumper) const aBase->integer(FeaturesPlugin_MultiRotation::NB_COPIES_ANGULAR_ID()); theDumper << ", " << anAttrNumberAngular; - theDumper << ")" << std::endl; -} + if (!aBase->data()->version().empty()) + theDumper << ", keepSubResults = True"; -//================================================================================================== -MultiRotationPtr addMultiRotation(const std::shared_ptr& thePart, - const std::list& theMainObjects, - const ModelHighAPI_Selection& theAxis, - const ModelHighAPI_Integer& theNumber) -{ - std::shared_ptr aFeature = - thePart->addFeature(FeaturesAPI_MultiRotation::ID()); - return MultiRotationPtr(new FeaturesAPI_MultiRotation(aFeature, theMainObjects, - theAxis, theNumber)); + theDumper << ")" << std::endl; } //================================================================================================== @@ -152,10 +144,30 @@ MultiRotationPtr addMultiRotation(const std::shared_ptr& theP const std::list& theMainObjects, const ModelHighAPI_Selection& theAxis, const ModelHighAPI_Double& theStep, - const ModelHighAPI_Integer& theNumber) + const ModelHighAPI_Integer& theNumber, + const bool keepSubResults) { std::shared_ptr aFeature = thePart->addFeature(FeaturesAPI_MultiRotation::ID()); - return MultiRotationPtr(new FeaturesAPI_MultiRotation(aFeature, theMainObjects, - theAxis, theStep, theNumber)); + if (!keepSubResults) + aFeature->data()->setVersion(""); + + MultiRotationPtr aResult; + if (theNumber.string().empty()) { + // rotate for the whole circle + double aStepVal = theStep.value(); + std::wstring aStepStr = theStep.string(); + std::wostringstream aStepValAsStr; + aStepValAsStr << aStepVal; + + ModelHighAPI_Integer aNumber = aStepStr == aStepValAsStr.str() + ? ModelHighAPI_Integer((int)aStepVal) + : ModelHighAPI_Integer(aStepStr); + aResult.reset(new FeaturesAPI_MultiRotation(aFeature, theMainObjects, theAxis, aNumber)); + } + else { + aResult.reset(new FeaturesAPI_MultiRotation(aFeature, theMainObjects, + theAxis, theStep, theNumber)); + } + return aResult; }