-// Copyright (C) 2017-2019 CEA/DEN, EDF R&D
+// Copyright (C) 2017-2023 CEA, EDF
//
// This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Lesser General Public
#include <FeaturesAPI_MultiRotation.h>
+#include <ModelHighAPI_Double.h>
#include <ModelHighAPI_Dumper.h>
#include <ModelHighAPI_Tools.h>
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<ModelAPI_Document>& thePart,
- const std::list<ModelHighAPI_Selection>& theMainObjects,
- const ModelHighAPI_Selection& theAxis,
- const ModelHighAPI_Integer& theNumber)
-{
- std::shared_ptr<ModelAPI_Feature> aFeature =
- thePart->addFeature(FeaturesAPI_MultiRotation::ID());
- return MultiRotationPtr(new FeaturesAPI_MultiRotation(aFeature, theMainObjects,
- theAxis, theNumber));
+ theDumper << ")" << std::endl;
}
//==================================================================================================
const std::list<ModelHighAPI_Selection>& theMainObjects,
const ModelHighAPI_Selection& theAxis,
const ModelHighAPI_Double& theStep,
- const ModelHighAPI_Integer& theNumber)
+ const ModelHighAPI_Integer& theNumber,
+ const bool keepSubResults)
{
std::shared_ptr<ModelAPI_Feature> 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;
}