Salome HOME
Change the paradigm of versioning of Boolean Operations on the Python API level.
[modules/shaper.git] / src / FeaturesAPI / FeaturesAPI_Union.cpp
index 7c960b13582f3762b8bec38aa28e6810caff9c62..bc8bc1859a8f1a13701ba0f53db3ab10bf17b505 100644 (file)
@@ -68,8 +68,9 @@ void FeaturesAPI_Union::dump(ModelHighAPI_Dumper& theDumper) const
 
   theDumper << aBase << " = model.addUnion(" << aDocName << ", " << anAttrObjects;
 
-  if (aVersion && aVersion->isInitialized())
-    theDumper << ", " << aVersion->value();
+  if (aVersion && aVersion->isInitialized() &&
+      aVersion->value() == FeaturesPlugin_VersionedBoolean::THE_VERSION_1)
+    theDumper << ", keepSubResults = True";
 
   theDumper << ")" << std::endl;
 }
@@ -77,8 +78,10 @@ void FeaturesAPI_Union::dump(ModelHighAPI_Dumper& theDumper) const
 //==================================================================================================
 UnionPtr addUnion(const std::shared_ptr<ModelAPI_Document>& thePart,
                   const std::list<ModelHighAPI_Selection>& theBaseObjects,
-                  const int theVersion)
+                  const bool keepSubResults)
 {
+  int aVersion = keepSubResults ? FeaturesPlugin_VersionedBoolean::THE_VERSION_1
+                                : FeaturesPlugin_VersionedBoolean::THE_VERSION_0;
   std::shared_ptr<ModelAPI_Feature> aFeature = thePart->addFeature(FeaturesAPI_Union::ID());
-  return UnionPtr(new FeaturesAPI_Union(aFeature, theBaseObjects, theVersion));
+  return UnionPtr(new FeaturesAPI_Union(aFeature, theBaseObjects, aVersion));
 }