Salome HOME
fixed usage of fuzzy value as parameter in API
authormbs <martin.bernhard@opencascade.com>
Thu, 26 Jan 2023 11:39:10 +0000 (11:39 +0000)
committerGérald NICOLAS <gerald.nicolas@edf.fr>
Wed, 1 Feb 2023 16:32:07 +0000 (17:32 +0100)
src/FeaturesAPI/FeaturesAPI_BooleanCommon.cpp
src/FeaturesAPI/FeaturesAPI_BooleanCommon.h
src/FeaturesAPI/FeaturesAPI_BooleanCut.cpp
src/FeaturesAPI/FeaturesAPI_BooleanFill.cpp
src/FeaturesAPI/FeaturesAPI_BooleanFuse.cpp
src/FeaturesAPI/FeaturesAPI_BooleanSmash.cpp
src/FeaturesAPI/FeaturesAPI_Intersection.cpp
src/FeaturesAPI/FeaturesAPI_Partition.cpp
src/FeaturesAPI/FeaturesAPI_Union.cpp

index b3db34fbbd08fe4304755ccddf0642a634b08c39..265e7c7fdc6692cc0cbc780ea2e11eefcbe5e781 100644 (file)
@@ -43,12 +43,17 @@ FeaturesAPI_BooleanCommon::FeaturesAPI_BooleanCommon(
 : ModelHighAPI_Interface(theFeature)
 {
   if(initialize()) {
-    bool aUseFuzzy = (theFuzzy.value() > 0);
-    ModelHighAPI_Double aFuzzy = (aUseFuzzy ? theFuzzy : ModelHighAPI_Double(DEFAULT_FUZZY));
-    fillAttribute(FeaturesPlugin_BooleanCommon::CREATION_METHOD_SIMPLE(), mycreationMethod);
-    fillAttribute(theMainObjects, mymainObjects);
-    fillAttribute(aUseFuzzy, myuseFuzzy);
-    fillAttribute(aFuzzy, myfuzzyValue);
+    fillAttribute(FeaturesPlugin_BooleanCommon::CREATION_METHOD_SIMPLE(), VAR_NAME(creationMethod));
+    fillAttribute(theMainObjects, VAR_NAME(mainObjects));
+    fillAttribute(theFuzzy, VAR_NAME(fuzzyParam));
+
+    // Get the evaluated fuzzy parameter from the attribute!!
+    bool aUseFuzzy = (fuzzyParam()->value() > 0);
+    fillAttribute(aUseFuzzy, VAR_NAME(useFuzzy));
+    if (!aUseFuzzy) {
+      ModelHighAPI_Double aFuzzy(DEFAULT_FUZZY);
+      fillAttribute(aFuzzy, VAR_NAME(fuzzyParam));
+    }
 
     execute(false);
   }
@@ -63,13 +68,18 @@ FeaturesAPI_BooleanCommon::FeaturesAPI_BooleanCommon(
 : ModelHighAPI_Interface(theFeature)
 {
   if(initialize()) {
-    bool aUseFuzzy = (theFuzzy.value() > 0);
-    ModelHighAPI_Double aFuzzy = (aUseFuzzy ? theFuzzy : ModelHighAPI_Double(DEFAULT_FUZZY));
-    fillAttribute(FeaturesPlugin_BooleanCommon::CREATION_METHOD_ADVANCED(), mycreationMethod);
-    fillAttribute(theMainObjects, mymainObjects);
-    fillAttribute(theToolObjects, mytoolObjects);
-    fillAttribute(aUseFuzzy, myuseFuzzy);
-    fillAttribute(aFuzzy, myfuzzyValue);
+    fillAttribute(FeaturesPlugin_BooleanCommon::CREATION_METHOD_ADVANCED(), VAR_NAME(creationMethod));
+    fillAttribute(theMainObjects, VAR_NAME(mainObjects));
+    fillAttribute(theToolObjects, VAR_NAME(toolObjects));
+    fillAttribute(theFuzzy, VAR_NAME(fuzzyParam));
+
+    // Get the evaluated fuzzy parameter from the attribute!!
+    bool aUseFuzzy = (fuzzyParam()->value() > 0);
+    fillAttribute(aUseFuzzy, VAR_NAME(useFuzzy));
+    if (!aUseFuzzy) {
+      ModelHighAPI_Double aFuzzy(DEFAULT_FUZZY);
+      fillAttribute(aFuzzy, VAR_NAME(fuzzyParam));
+    }
 
     execute(false);
   }
@@ -85,7 +95,7 @@ FeaturesAPI_BooleanCommon::~FeaturesAPI_BooleanCommon()
 void FeaturesAPI_BooleanCommon::setMainObjects(
   const std::list<ModelHighAPI_Selection>& theMainObjects)
 {
-  fillAttribute(theMainObjects, mymainObjects);
+  fillAttribute(theMainObjects, VAR_NAME(mainObjects));
 
   execute();
 }
@@ -94,8 +104,8 @@ void FeaturesAPI_BooleanCommon::setMainObjects(
 void FeaturesAPI_BooleanCommon::setToolObjects(
   const std::list<ModelHighAPI_Selection>& theToolObjects)
 {
-  fillAttribute(FeaturesPlugin_BooleanCommon::CREATION_METHOD_ADVANCED(), mycreationMethod);
-  fillAttribute(theToolObjects, mytoolObjects);
+  fillAttribute(FeaturesPlugin_BooleanCommon::CREATION_METHOD_ADVANCED(), VAR_NAME(creationMethod));
+  fillAttribute(theToolObjects, VAR_NAME(toolObjects));
 
   execute();
 }
@@ -103,7 +113,7 @@ void FeaturesAPI_BooleanCommon::setToolObjects(
 //==================================================================================================
 void FeaturesAPI_BooleanCommon::setUseFuzzy(bool theUseFuzzy)
 {
-  fillAttribute(theUseFuzzy, myuseFuzzy);
+  fillAttribute(theUseFuzzy, VAR_NAME(useFuzzy));
 
   execute();
 }
@@ -111,7 +121,7 @@ void FeaturesAPI_BooleanCommon::setUseFuzzy(bool theUseFuzzy)
 //==================================================================================================
 void FeaturesAPI_BooleanCommon::setFuzzyValue(const ModelHighAPI_Double& theFuzzy)
 {
-  fillAttribute(theFuzzy, myfuzzyValue);
+  fillAttribute(theFuzzy, VAR_NAME(fuzzyParam));
 
   execute();
 }
@@ -120,9 +130,9 @@ void FeaturesAPI_BooleanCommon::setFuzzyValue(const ModelHighAPI_Double& theFuzz
 void FeaturesAPI_BooleanCommon::setAdvancedMode(const bool theMode)
 {
   if (theMode) {
-    fillAttribute(FeaturesPlugin_BooleanCommon::CREATION_METHOD_ADVANCED(), mycreationMethod);
+    fillAttribute(FeaturesPlugin_BooleanCommon::CREATION_METHOD_ADVANCED(), VAR_NAME(creationMethod));
   } else {
-    fillAttribute(FeaturesPlugin_BooleanCommon::CREATION_METHOD_SIMPLE(), mycreationMethod);
+    fillAttribute(FeaturesPlugin_BooleanCommon::CREATION_METHOD_SIMPLE(), VAR_NAME(creationMethod));
   }
 
   execute();
@@ -163,7 +173,7 @@ void FeaturesAPI_BooleanCommon::dump(ModelHighAPI_Dumper& theDumper) const
 BooleanCommonPtr addCommon(const std::shared_ptr<ModelAPI_Document>& thePart,
                            const std::list<ModelHighAPI_Selection>& theMainObjects,
                            const std::list<ModelHighAPI_Selection>& theToolObjects,
-                           const ModelHighAPI_Double& fuzzyParam,
+                           const ModelHighAPI_Double& theFuzzy,
                            const bool keepSubResults)
 {
   std::shared_ptr<ModelAPI_Feature> aFeature = thePart->addFeature(FeaturesAPI_BooleanCommon::ID());
@@ -171,8 +181,8 @@ BooleanCommonPtr addCommon(const std::shared_ptr<ModelAPI_Document>& thePart,
     aFeature->data()->setVersion("");
   BooleanCommonPtr aCommon;
   if (theToolObjects.empty())
-    aCommon.reset(new FeaturesAPI_BooleanCommon(aFeature, theMainObjects, fuzzyParam));
+    aCommon.reset(new FeaturesAPI_BooleanCommon(aFeature, theMainObjects, theFuzzy));
   else
-    aCommon.reset(new FeaturesAPI_BooleanCommon(aFeature, theMainObjects, theToolObjects, fuzzyParam));
+    aCommon.reset(new FeaturesAPI_BooleanCommon(aFeature, theMainObjects, theToolObjects, theFuzzy));
   return aCommon;
 }
index ae8821c765a79f47dd37d3847eee60c435082f1f..b694997c6463470627337eec5aacef857236aceb 100644 (file)
@@ -67,7 +67,7 @@ public:
               ModelAPI_AttributeSelectionList, /** Tool objects*/,
               useFuzzy, FeaturesPlugin_BooleanCommon::USE_FUZZY_ID(),
               ModelAPI_AttributeBoolean, /** Use Fuzzy parameter*/,
-              fuzzyValue, FeaturesPlugin_BooleanCommon::FUZZY_PARAM_ID(),
+              fuzzyParam, FeaturesPlugin_BooleanCommon::FUZZY_PARAM_ID(),
               ModelAPI_AttributeDouble, /** Fuzzy parameter*/)
 
   /// Set main objects.
index 0dce5cc5619087db12643d885ad335e243051e95..67a2f5cbc4f2c12dac2d6fce7dcadf3c8a454732 100644 (file)
@@ -43,12 +43,17 @@ FeaturesAPI_BooleanCut::FeaturesAPI_BooleanCut(
 : ModelHighAPI_Interface(theFeature)
 {
   if(initialize()) {
-    bool aUseFuzzy = (theFuzzy.value() > 0);
-    ModelHighAPI_Double aFuzzy = (aUseFuzzy ? theFuzzy : ModelHighAPI_Double(DEFAULT_FUZZY));
-    fillAttribute(theMainObjects, mymainObjects);
-    fillAttribute(theToolObjects, mytoolObjects);
-    fillAttribute(aUseFuzzy, myuseFuzzy);
-    fillAttribute(aFuzzy, myfuzzyParam);
+    fillAttribute(theMainObjects, VAR_NAME(mainObjects));
+    fillAttribute(theToolObjects, VAR_NAME(toolObjects));
+    fillAttribute(theFuzzy, VAR_NAME(fuzzyParam));
+
+    // Get the evaluated fuzzy parameter from the attribute!!
+    bool aUseFuzzy = (fuzzyParam()->value() > 0);
+    fillAttribute(aUseFuzzy, VAR_NAME(useFuzzy));
+    if (!aUseFuzzy) {
+      ModelHighAPI_Double aFuzzy(DEFAULT_FUZZY);
+      fillAttribute(aFuzzy, VAR_NAME(fuzzyParam));
+    }
 
     execute(false);
   }
@@ -63,7 +68,7 @@ FeaturesAPI_BooleanCut::~FeaturesAPI_BooleanCut()
 //==================================================================================================
 void FeaturesAPI_BooleanCut::setMainObjects(const std::list<ModelHighAPI_Selection>& theMainObjects)
 {
-  fillAttribute(theMainObjects, mymainObjects);
+  fillAttribute(theMainObjects, VAR_NAME(mainObjects));
 
   execute();
 }
@@ -71,7 +76,7 @@ void FeaturesAPI_BooleanCut::setMainObjects(const std::list<ModelHighAPI_Selecti
 //==================================================================================================
 void FeaturesAPI_BooleanCut::setToolObjects(const std::list<ModelHighAPI_Selection>& theToolObjects)
 {
-  fillAttribute(theToolObjects, mytoolObjects);
+  fillAttribute(theToolObjects, VAR_NAME(toolObjects));
 
   execute();
 }
@@ -79,7 +84,7 @@ void FeaturesAPI_BooleanCut::setToolObjects(const std::list<ModelHighAPI_Selecti
 //==================================================================================================
 void FeaturesAPI_BooleanCut::setUseFuzzy(bool theUseFuzzy)
 {
-  fillAttribute(theUseFuzzy, myuseFuzzy);
+  fillAttribute(theUseFuzzy, VAR_NAME(useFuzzy));
 
   execute();
 }
@@ -87,7 +92,7 @@ void FeaturesAPI_BooleanCut::setUseFuzzy(bool theUseFuzzy)
 //==================================================================================================
 void FeaturesAPI_BooleanCut::setFuzzyValue(const ModelHighAPI_Double& theFuzzy)
 {
-  fillAttribute(theFuzzy, myfuzzyParam);
+  fillAttribute(theFuzzy, VAR_NAME(fuzzyParam));
 
   execute();
 }
@@ -122,11 +127,11 @@ void FeaturesAPI_BooleanCut::dump(ModelHighAPI_Dumper& theDumper) const
 BooleanCutPtr addCut(const std::shared_ptr<ModelAPI_Document>& thePart,
                      const std::list<ModelHighAPI_Selection>& theMainObjects,
                      const std::list<ModelHighAPI_Selection>& theToolObjects,
-                     const ModelHighAPI_Double& fuzzyParam,
+                     const ModelHighAPI_Double& theFuzzy,
                      const bool keepSubResults)
 {
   std::shared_ptr<ModelAPI_Feature> aFeature = thePart->addFeature(FeaturesAPI_BooleanCut::ID());
   if (!keepSubResults)
     aFeature->data()->setVersion("");
-  return BooleanCutPtr(new FeaturesAPI_BooleanCut(aFeature, theMainObjects, theToolObjects, fuzzyParam));
+  return BooleanCutPtr(new FeaturesAPI_BooleanCut(aFeature, theMainObjects, theToolObjects, theFuzzy));
 }
index f1e66c2cf3b1cd919c5c6dd7eb1e97e16bc345e5..4d8651a2646a41fcdec2c97b42e417c5b576522c 100644 (file)
@@ -44,12 +44,17 @@ FeaturesAPI_BooleanFill::FeaturesAPI_BooleanFill(
 : ModelHighAPI_Interface(theFeature)
 {
   if(initialize()) {
-    bool aUseFuzzy = (theFuzzy.value() > 0);
-    ModelHighAPI_Double aFuzzy = (aUseFuzzy ? theFuzzy : ModelHighAPI_Double(DEFAULT_FUZZY));
-    fillAttribute(theMainObjects, mymainObjects);
-    fillAttribute(theToolObjects, mytoolObjects);
-    fillAttribute(aUseFuzzy, myuseFuzzy);
-    fillAttribute(aFuzzy, myfuzzyParam);
+    fillAttribute(theMainObjects, VAR_NAME(mainObjects));
+    fillAttribute(theToolObjects, VAR_NAME(toolObjects));
+    fillAttribute(theFuzzy, VAR_NAME(fuzzyParam));
+
+    // Get the evaluated fuzzy parameter from the attribute!!
+    bool aUseFuzzy = (fuzzyParam()->value() > 0);
+    fillAttribute(aUseFuzzy, VAR_NAME(useFuzzy));
+    if (!aUseFuzzy) {
+      ModelHighAPI_Double aFuzzy(DEFAULT_FUZZY);
+      fillAttribute(aFuzzy, VAR_NAME(fuzzyParam));
+    }
 
     execute(false);
   }
@@ -65,7 +70,7 @@ FeaturesAPI_BooleanFill::~FeaturesAPI_BooleanFill()
 void FeaturesAPI_BooleanFill::setMainObjects(
   const std::list<ModelHighAPI_Selection>& theMainObjects)
 {
-  fillAttribute(theMainObjects, mymainObjects);
+  fillAttribute(theMainObjects, VAR_NAME(mainObjects));
 
   execute();
 }
@@ -74,7 +79,7 @@ void FeaturesAPI_BooleanFill::setMainObjects(
 void FeaturesAPI_BooleanFill::setToolObjects(
   const std::list<ModelHighAPI_Selection>& theToolObjects)
 {
-  fillAttribute(theToolObjects, mytoolObjects);
+  fillAttribute(theToolObjects, VAR_NAME(toolObjects));
 
   execute();
 }
@@ -82,7 +87,7 @@ void FeaturesAPI_BooleanFill::setToolObjects(
 //==================================================================================================
 void FeaturesAPI_BooleanFill::setUseFuzzy(bool theUseFuzzy)
 {
-  fillAttribute(theUseFuzzy, myuseFuzzy);
+  fillAttribute(theUseFuzzy, VAR_NAME(useFuzzy));
 
   execute();
 }
@@ -90,7 +95,7 @@ void FeaturesAPI_BooleanFill::setUseFuzzy(bool theUseFuzzy)
 //==================================================================================================
 void FeaturesAPI_BooleanFill::setFuzzyValue(const ModelHighAPI_Double& theFuzzy)
 {
-  fillAttribute(theFuzzy, myfuzzyParam);
+  fillAttribute(theFuzzy, VAR_NAME(fuzzyParam));
 
   execute();
 }
@@ -125,11 +130,11 @@ void FeaturesAPI_BooleanFill::dump(ModelHighAPI_Dumper& theDumper) const
 BooleanFillPtr addSplit(const std::shared_ptr<ModelAPI_Document>& thePart,
                         const std::list<ModelHighAPI_Selection>& theMainObjects,
                         const std::list<ModelHighAPI_Selection>& theToolObjects,
-                        const ModelHighAPI_Double& fuzzyParam,
+                        const ModelHighAPI_Double& theFuzzy,
                         const bool keepSubResults)
 {
   std::shared_ptr<ModelAPI_Feature> aFeature = thePart->addFeature(FeaturesAPI_BooleanFill::ID());
   if (!keepSubResults)
     aFeature->data()->setVersion("");
-  return BooleanFillPtr(new FeaturesAPI_BooleanFill(aFeature, theMainObjects, theToolObjects, fuzzyParam));
+  return BooleanFillPtr(new FeaturesAPI_BooleanFill(aFeature, theMainObjects, theToolObjects, theFuzzy));
 }
index 013b40075c32d029cec9034ee4543867a219a16e..5b17cb89479fd39d2b17374bad9acb3a80c07d99 100644 (file)
@@ -44,13 +44,18 @@ FeaturesAPI_BooleanFuse::FeaturesAPI_BooleanFuse(
   : ModelHighAPI_Interface(theFeature)
 {
   if (initialize()) {
-    bool aUseFuzzy = (theFuzzy.value() > 0);
-    ModelHighAPI_Double aFuzzy = (aUseFuzzy ? theFuzzy : ModelHighAPI_Double(DEFAULT_FUZZY));
-    fillAttribute(FeaturesPlugin_BooleanFuse::CREATION_METHOD_SIMPLE(), mycreationMethod);
-    fillAttribute(theMainObjects, mymainObjects);
-    fillAttribute(theRemoveEdges, myremoveEdges);
-    fillAttribute(aUseFuzzy, myuseFuzzy);
-    fillAttribute(aFuzzy, myfuzzyParam);
+    fillAttribute(FeaturesPlugin_BooleanFuse::CREATION_METHOD_SIMPLE(), VAR_NAME(creationMethod));
+    fillAttribute(theMainObjects, VAR_NAME(mainObjects));
+    fillAttribute(theRemoveEdges, VAR_NAME(removeEdges));
+    fillAttribute(theFuzzy, VAR_NAME(fuzzyParam));
+
+    // Get the evaluated fuzzy parameter from the attribute!!
+    bool aUseFuzzy = (fuzzyParam()->value() > 0);
+    fillAttribute(aUseFuzzy, VAR_NAME(useFuzzy));
+    if (!aUseFuzzy) {
+      ModelHighAPI_Double aFuzzy(DEFAULT_FUZZY);
+      fillAttribute(aFuzzy, VAR_NAME(fuzzyParam));
+    }
 
     execute(false);
   }
@@ -66,14 +71,19 @@ FeaturesAPI_BooleanFuse::FeaturesAPI_BooleanFuse(
 : ModelHighAPI_Interface(theFeature)
 {
   if(initialize()) {
-    bool aUseFuzzy = (theFuzzy.value() > 0);
-    ModelHighAPI_Double aFuzzy = (aUseFuzzy ? theFuzzy : ModelHighAPI_Double(DEFAULT_FUZZY));
-    fillAttribute(FeaturesPlugin_BooleanFuse::CREATION_METHOD_ADVANCED(), mycreationMethod);
-    fillAttribute(theMainObjects, mymainObjects);
-    fillAttribute(theToolObjects, mytoolObjects);
-    fillAttribute(theRemoveEdges, myremoveEdges);
-    fillAttribute(aUseFuzzy, myuseFuzzy);
-    fillAttribute(aFuzzy, myfuzzyParam);
+    fillAttribute(FeaturesPlugin_BooleanFuse::CREATION_METHOD_ADVANCED(), VAR_NAME(creationMethod));
+    fillAttribute(theMainObjects, VAR_NAME(mainObjects));
+    fillAttribute(theToolObjects, VAR_NAME(toolObjects));
+    fillAttribute(theRemoveEdges, VAR_NAME(removeEdges));
+    fillAttribute(theFuzzy, VAR_NAME(fuzzyParam));
+
+    // Get the evaluated fuzzy parameter from the attribute!!
+    bool aUseFuzzy = (fuzzyParam()->value() > 0);
+    fillAttribute(aUseFuzzy, VAR_NAME(useFuzzy));
+    if (!aUseFuzzy) {
+      ModelHighAPI_Double aFuzzy(DEFAULT_FUZZY);
+      fillAttribute(aFuzzy, VAR_NAME(fuzzyParam));
+    }
 
     execute(false);
   }
@@ -89,7 +99,7 @@ FeaturesAPI_BooleanFuse::~FeaturesAPI_BooleanFuse()
 void FeaturesAPI_BooleanFuse::setMainObjects(
   const std::list<ModelHighAPI_Selection>& theMainObjects)
 {
-  fillAttribute(theMainObjects, mymainObjects);
+  fillAttribute(theMainObjects, VAR_NAME(mainObjects));
 
   execute();
 }
@@ -98,8 +108,8 @@ void FeaturesAPI_BooleanFuse::setMainObjects(
 void FeaturesAPI_BooleanFuse::setToolObjects(
   const std::list<ModelHighAPI_Selection>& theToolObjects)
 {
-  fillAttribute(FeaturesPlugin_BooleanFuse::CREATION_METHOD_ADVANCED(), mycreationMethod);
-  fillAttribute(theToolObjects, mytoolObjects);
+  fillAttribute(FeaturesPlugin_BooleanFuse::CREATION_METHOD_ADVANCED(), VAR_NAME(creationMethod));
+  fillAttribute(theToolObjects, VAR_NAME(toolObjects));
 
   execute();
 }
@@ -107,7 +117,7 @@ void FeaturesAPI_BooleanFuse::setToolObjects(
 //==================================================================================================
 void FeaturesAPI_BooleanFuse::setRemoveEdges(const bool theRemoveEdges)
 {
-  fillAttribute(theRemoveEdges, myremoveEdges);
+  fillAttribute(theRemoveEdges, VAR_NAME(removeEdges));
 
   execute();
 }
@@ -115,7 +125,7 @@ void FeaturesAPI_BooleanFuse::setRemoveEdges(const bool theRemoveEdges)
 //==================================================================================================
 void FeaturesAPI_BooleanFuse::setUseFuzzy(bool theUseFuzzy)
 {
-  fillAttribute(theUseFuzzy, myuseFuzzy);
+  fillAttribute(theUseFuzzy, VAR_NAME(useFuzzy));
 
   execute();
 }
@@ -123,7 +133,7 @@ void FeaturesAPI_BooleanFuse::setUseFuzzy(bool theUseFuzzy)
 //==================================================================================================
 void FeaturesAPI_BooleanFuse::setFuzzyValue(const ModelHighAPI_Double& theFuzzy)
 {
-  fillAttribute(theFuzzy, myfuzzyParam);
+  fillAttribute(theFuzzy, VAR_NAME(fuzzyParam));
 
   execute();
 }
@@ -132,9 +142,9 @@ void FeaturesAPI_BooleanFuse::setFuzzyValue(const ModelHighAPI_Double& theFuzzy)
 void FeaturesAPI_BooleanFuse::setAdvancedMode(const bool theMode)
 {
   if (theMode) {
-    fillAttribute(FeaturesPlugin_BooleanFuse::CREATION_METHOD_ADVANCED(), mycreationMethod);
+    fillAttribute(FeaturesPlugin_BooleanFuse::CREATION_METHOD_ADVANCED(), VAR_NAME(creationMethod));
   } else {
-    fillAttribute(FeaturesPlugin_BooleanFuse::CREATION_METHOD_SIMPLE(), mycreationMethod);
+    fillAttribute(FeaturesPlugin_BooleanFuse::CREATION_METHOD_SIMPLE(), VAR_NAME(creationMethod));
   }
 
   execute();
@@ -182,7 +192,7 @@ BooleanFusePtr addFuse(const std::shared_ptr<ModelAPI_Document>& thePart,
                        const std::list<ModelHighAPI_Selection>& theMainObjects,
                        const std::pair<std::list<ModelHighAPI_Selection>, bool>& theToolObjects,
                        const bool theRemoveEdges,
-                       const ModelHighAPI_Double& fuzzyParam,
+                       const ModelHighAPI_Double& theFuzzy,
                        const bool keepSubResults)
 {
   std::shared_ptr<ModelAPI_Feature> aFeature = thePart->addFeature(FeaturesAPI_BooleanFuse::ID());
@@ -195,10 +205,10 @@ BooleanFusePtr addFuse(const std::shared_ptr<ModelAPI_Document>& thePart,
 
   BooleanFusePtr aFuse;
   if (theToolObjects.first.empty())
-    aFuse.reset(new FeaturesAPI_BooleanFuse(aFeature, theMainObjects, aRemoveEdges, fuzzyParam));
+    aFuse.reset(new FeaturesAPI_BooleanFuse(aFeature, theMainObjects, aRemoveEdges, theFuzzy));
   else {
     aFuse.reset(new FeaturesAPI_BooleanFuse(aFeature, theMainObjects, theToolObjects.first,
-                                            aRemoveEdges, fuzzyParam));
+                                            aRemoveEdges, theFuzzy));
   }
   return aFuse;
 }
index f32c0a2fe6148b01626340894c38fa0c8adc5be1..46a766b3f31b7f7826ff6b5ceb0ba15a36b0d536 100644 (file)
@@ -44,12 +44,17 @@ FeaturesAPI_BooleanSmash::FeaturesAPI_BooleanSmash(
 : ModelHighAPI_Interface(theFeature)
 {
   if(initialize()) {
-    bool aUseFuzzy = (theFuzzy.value() > 0);
-    ModelHighAPI_Double aFuzzy = (aUseFuzzy ? theFuzzy : ModelHighAPI_Double(DEFAULT_FUZZY));
-    fillAttribute(theMainObjects, mymainObjects);
-    fillAttribute(theToolObjects, mytoolObjects);
-    fillAttribute(aUseFuzzy, myuseFuzzy);
-    fillAttribute(aFuzzy, myfuzzyParam);
+    fillAttribute(theMainObjects, VAR_NAME(mainObjects));
+    fillAttribute(theToolObjects, VAR_NAME(toolObjects));
+    fillAttribute(theFuzzy, VAR_NAME(fuzzyParam));
+
+    // Get the evaluated fuzzy parameter from the attribute!!
+    bool aUseFuzzy = (fuzzyParam()->value() > 0);
+    fillAttribute(aUseFuzzy, VAR_NAME(useFuzzy));
+    if (!aUseFuzzy) {
+      ModelHighAPI_Double aFuzzy(DEFAULT_FUZZY);
+      fillAttribute(aFuzzy, VAR_NAME(fuzzyParam));
+    }
 
     execute(false);
   }
@@ -65,7 +70,7 @@ FeaturesAPI_BooleanSmash::~FeaturesAPI_BooleanSmash()
 void FeaturesAPI_BooleanSmash::setMainObjects(
   const std::list<ModelHighAPI_Selection>& theMainObjects)
 {
-  fillAttribute(theMainObjects, mymainObjects);
+  fillAttribute(theMainObjects, VAR_NAME(mainObjects));
 
   execute();
 }
@@ -74,7 +79,7 @@ void FeaturesAPI_BooleanSmash::setMainObjects(
 void FeaturesAPI_BooleanSmash::setToolObjects(
   const std::list<ModelHighAPI_Selection>& theToolObjects)
 {
-  fillAttribute(theToolObjects, mytoolObjects);
+  fillAttribute(theToolObjects, VAR_NAME(toolObjects));
 
   execute();
 }
@@ -82,7 +87,7 @@ void FeaturesAPI_BooleanSmash::setToolObjects(
 //==================================================================================================
 void FeaturesAPI_BooleanSmash::setUseFuzzy(bool theUseFuzzy)
 {
-  fillAttribute(theUseFuzzy, myuseFuzzy);
+  fillAttribute(theUseFuzzy, VAR_NAME(useFuzzy));
 
   execute();
 }
@@ -90,7 +95,7 @@ void FeaturesAPI_BooleanSmash::setUseFuzzy(bool theUseFuzzy)
 //==================================================================================================
 void FeaturesAPI_BooleanSmash::setFuzzyValue(const ModelHighAPI_Double& theFuzzy)
 {
-  fillAttribute(theFuzzy, myfuzzyParam);
+  fillAttribute(theFuzzy, VAR_NAME(fuzzyParam));
 
   execute();
 }
@@ -125,11 +130,11 @@ void FeaturesAPI_BooleanSmash::dump(ModelHighAPI_Dumper& theDumper) const
 BooleanSmashPtr addSmash(const std::shared_ptr<ModelAPI_Document>& thePart,
                          const std::list<ModelHighAPI_Selection>& theMainObjects,
                          const std::list<ModelHighAPI_Selection>& theToolObjects,
-                         const ModelHighAPI_Double& fuzzyParam,
+                         const ModelHighAPI_Double& theFuzzy,
                          const bool keepSubResults)
 {
   std::shared_ptr<ModelAPI_Feature> aFeature = thePart->addFeature(FeaturesAPI_BooleanSmash::ID());
   if (!keepSubResults)
     aFeature->data()->setVersion("");
-  return BooleanSmashPtr(new FeaturesAPI_BooleanSmash(aFeature, theMainObjects, theToolObjects, fuzzyParam));
+  return BooleanSmashPtr(new FeaturesAPI_BooleanSmash(aFeature, theMainObjects, theToolObjects, theFuzzy));
 }
index 99d2ffda06e0081726f7f6b941c500282b6c4024..992f3f1994addded07ed1b0968937f23835b90c9 100644 (file)
@@ -42,11 +42,16 @@ FeaturesAPI_Intersection::FeaturesAPI_Intersection(
 : ModelHighAPI_Interface(theFeature)
 {
   if(initialize()) {
-    bool aUseFuzzy = (theFuzzy.value() > 0);
-    ModelHighAPI_Double aFuzzy = (aUseFuzzy ? theFuzzy : ModelHighAPI_Double(DEFAULT_FUZZY));
-    fillAttribute(theObjects, myobjects);
-    fillAttribute(aUseFuzzy, myuseFuzzy);
-    fillAttribute(aFuzzy, myfuzzyParam);
+    fillAttribute(theObjects, VAR_NAME(objects));
+    fillAttribute(theFuzzy, VAR_NAME(fuzzyParam));
+
+    // Get the evaluated fuzzy parameter from the attribute!!
+    bool aUseFuzzy = (fuzzyParam()->value() > 0);
+    fillAttribute(aUseFuzzy, VAR_NAME(useFuzzy));
+    if (!aUseFuzzy) {
+      ModelHighAPI_Double aFuzzy(DEFAULT_FUZZY);
+      fillAttribute(aFuzzy, VAR_NAME(fuzzyParam));
+    }
 
     execute();
   }
@@ -61,7 +66,7 @@ FeaturesAPI_Intersection::~FeaturesAPI_Intersection()
 //==================================================================================================
 void FeaturesAPI_Intersection::setObjects(const std::list<ModelHighAPI_Selection>& theObjects)
 {
-  fillAttribute(theObjects, myobjects);
+  fillAttribute(theObjects, VAR_NAME(objects));
 
   execute();
 }
@@ -69,7 +74,7 @@ void FeaturesAPI_Intersection::setObjects(const std::list<ModelHighAPI_Selection
 //==================================================================================================
 void FeaturesAPI_Intersection::setUseFuzzy(bool theUseFuzzy)
 {
-  fillAttribute(theUseFuzzy, myuseFuzzy);
+  fillAttribute(theUseFuzzy, VAR_NAME(useFuzzy));
 
   execute();
 }
@@ -77,7 +82,7 @@ void FeaturesAPI_Intersection::setUseFuzzy(bool theUseFuzzy)
 //==================================================================================================
 void FeaturesAPI_Intersection::setFuzzyValue(const ModelHighAPI_Double& theFuzzy)
 {
-  fillAttribute(theFuzzy, myfuzzyParam);
+  fillAttribute(theFuzzy, VAR_NAME(fuzzyParam));
 
   execute();
 }
@@ -107,11 +112,11 @@ void FeaturesAPI_Intersection::dump(ModelHighAPI_Dumper& theDumper) const
 //==================================================================================================
 IntersectionPtr addIntersection(const std::shared_ptr<ModelAPI_Document>& thePart,
                                 const std::list<ModelHighAPI_Selection>& theObjects,
-                                const ModelHighAPI_Double& fuzzyParam,
+                                const ModelHighAPI_Double& theFuzzy,
                                 const bool keepSubResults)
 {
   std::shared_ptr<ModelAPI_Feature> aFeature = thePart->addFeature(FeaturesAPI_Intersection::ID());
   if (!keepSubResults)
     aFeature->data()->setVersion("");
-  return IntersectionPtr(new FeaturesAPI_Intersection(aFeature, theObjects, fuzzyParam));
+  return IntersectionPtr(new FeaturesAPI_Intersection(aFeature, theObjects, theFuzzy));
 }
index 0f482bd32a7f4aa11d1dad64eb6ee6ba449c3574..ae64a0bdb9dd5e6f6fd9524ba1342ecb091f59da 100644 (file)
@@ -41,11 +41,17 @@ FeaturesAPI_Partition::FeaturesAPI_Partition(
 : ModelHighAPI_Interface(theFeature)
 {
   if(initialize()) {
-    bool aUseFuzzy = (theFuzzy.value() > 0);
-    ModelHighAPI_Double aFuzzy = (aUseFuzzy ? theFuzzy : ModelHighAPI_Double(DEFAULT_FUZZY));
-    fillAttribute(theBaseObjects, mybaseObjects);
-    fillAttribute(aUseFuzzy, myuseFuzzy);
-    fillAttribute(aFuzzy, myfuzzyParam);
+    fillAttribute(theBaseObjects, VAR_NAME(baseObjects));
+    fillAttribute(theFuzzy, VAR_NAME(fuzzyParam));
+
+    // Get the evaluated fuzzy parameter from the attribute!!
+    bool aUseFuzzy = (fuzzyParam()->value() > 0);
+    fillAttribute(aUseFuzzy, VAR_NAME(useFuzzy));
+    if (!aUseFuzzy) {
+      ModelHighAPI_Double aFuzzy(DEFAULT_FUZZY);
+      fillAttribute(aFuzzy, VAR_NAME(fuzzyParam));
+    }
+
     execute();
   }
 }
@@ -59,7 +65,7 @@ FeaturesAPI_Partition::~FeaturesAPI_Partition()
 //==================================================================================================
 void FeaturesAPI_Partition::setBase(const std::list<ModelHighAPI_Selection>& theBaseObjects)
 {
-  fillAttribute(theBaseObjects, mybaseObjects);
+  fillAttribute(theBaseObjects, VAR_NAME(baseObjects));
 
   execute();
 }
@@ -67,7 +73,7 @@ void FeaturesAPI_Partition::setBase(const std::list<ModelHighAPI_Selection>& the
 //==================================================================================================
 void FeaturesAPI_Partition::setUseFuzzy(bool theUseFuzzy)
 {
-  fillAttribute(theUseFuzzy, myuseFuzzy);
+  fillAttribute(theUseFuzzy, VAR_NAME(useFuzzy));
 
   execute();
 }
@@ -75,7 +81,7 @@ void FeaturesAPI_Partition::setUseFuzzy(bool theUseFuzzy)
 //==================================================================================================
 void FeaturesAPI_Partition::setFuzzy(const ModelHighAPI_Double& theFuzzy)
 {
-  fillAttribute(theFuzzy, myfuzzyParam);
+  fillAttribute(theFuzzy, VAR_NAME(fuzzyParam));
 
   execute();
 }
@@ -105,11 +111,11 @@ void FeaturesAPI_Partition::dump(ModelHighAPI_Dumper& theDumper) const
 //==================================================================================================
 PartitionPtr addPartition(const std::shared_ptr<ModelAPI_Document>& thePart,
                           const std::list<ModelHighAPI_Selection>& theBaseObjects,
-                          const ModelHighAPI_Double& fuzzyParam,
+                          const ModelHighAPI_Double& theFuzzy,
                           const bool keepSubResults)
 {
   std::shared_ptr<ModelAPI_Feature> aFeature = thePart->addFeature(FeaturesAPI_Partition::ID());
   if (!keepSubResults)
     aFeature->data()->setVersion("");
-  return PartitionPtr(new FeaturesAPI_Partition(aFeature, theBaseObjects, fuzzyParam));
+  return PartitionPtr(new FeaturesAPI_Partition(aFeature, theBaseObjects, theFuzzy));
 }
index 6c7994a12d3d84839b848aff990bf394416af02f..6fb7d6388a525a08f39b178ae7ea6400f7e54647 100644 (file)
@@ -40,11 +40,16 @@ FeaturesAPI_Union::FeaturesAPI_Union(const std::shared_ptr<ModelAPI_Feature>& th
 : ModelHighAPI_Interface(theFeature)
 {
   if(initialize()) {
-    bool aUseFuzzy = (theFuzzy.value() > 0);
-    ModelHighAPI_Double aFuzzy = (aUseFuzzy ? theFuzzy : ModelHighAPI_Double(DEFAULT_FUZZY));
-    fillAttribute(theBaseObjects, mybaseObjects);
-    fillAttribute(aUseFuzzy, myuseFuzzy);
-    fillAttribute(aFuzzy, myfuzzyParam);
+    fillAttribute(theBaseObjects, VAR_NAME(baseObjects));
+    fillAttribute(theFuzzy, VAR_NAME(fuzzyParam));
+
+    // Get the evaluated fuzzy parameter from the attribute!!
+    bool aUseFuzzy = (fuzzyParam()->value() > 0);
+    fillAttribute(aUseFuzzy, VAR_NAME(useFuzzy));
+    if (!aUseFuzzy) {
+      ModelHighAPI_Double aFuzzy(DEFAULT_FUZZY);
+      fillAttribute(aFuzzy, VAR_NAME(fuzzyParam));
+    }
 
     execute();
   }
@@ -59,7 +64,7 @@ FeaturesAPI_Union::~FeaturesAPI_Union()
 //==================================================================================================
 void FeaturesAPI_Union::setBase(const std::list<ModelHighAPI_Selection>& theBaseObjects)
 {
-  fillAttribute(theBaseObjects, mybaseObjects);
+  fillAttribute(theBaseObjects, VAR_NAME(baseObjects));
 
   execute();
 }
@@ -67,7 +72,7 @@ void FeaturesAPI_Union::setBase(const std::list<ModelHighAPI_Selection>& theBase
 //==================================================================================================
 void FeaturesAPI_Union::setUseFuzzy(bool theUseFuzzy)
 {
-  fillAttribute(theUseFuzzy, myuseFuzzy);
+  fillAttribute(theUseFuzzy, VAR_NAME(useFuzzy));
 
   execute();
 }
@@ -75,7 +80,7 @@ void FeaturesAPI_Union::setUseFuzzy(bool theUseFuzzy)
 //==================================================================================================
 void FeaturesAPI_Union::setFuzzyValue(const ModelHighAPI_Double& theFuzzy)
 {
-  fillAttribute(theFuzzy, myfuzzyParam);
+  fillAttribute(theFuzzy, VAR_NAME(fuzzyParam));
 
   execute();
 }
@@ -105,11 +110,11 @@ void FeaturesAPI_Union::dump(ModelHighAPI_Dumper& theDumper) const
 //==================================================================================================
 UnionPtr addUnion(const std::shared_ptr<ModelAPI_Document>& thePart,
                   const std::list<ModelHighAPI_Selection>& theBaseObjects,
-                  const ModelHighAPI_Double& fuzzyParam,
+                  const ModelHighAPI_Double& theFuzzy,
                   const bool keepSubResults)
 {
   std::shared_ptr<ModelAPI_Feature> aFeature = thePart->addFeature(FeaturesAPI_Union::ID());
   if (!keepSubResults)
     aFeature->data()->setVersion("");
-  return UnionPtr(new FeaturesAPI_Union(aFeature, theBaseObjects, fuzzyParam));
+  return UnionPtr(new FeaturesAPI_Union(aFeature, theBaseObjects, theFuzzy));
 }