]> SALOME platform Git repositories - modules/shaper.git/blobdiff - src/FeaturesAPI/FeaturesAPI_BooleanFuse.cpp
Salome HOME
support fuzzy parameter in all boolean operations
[modules/shaper.git] / src / FeaturesAPI / FeaturesAPI_BooleanFuse.cpp
index 5d3ceffed4d120e5e7d769b1d2e1b7b85ec53574..2fd8df0936e0f384b0850cdd417592d1d0e12a24 100644 (file)
@@ -35,13 +35,15 @@ FeaturesAPI_BooleanFuse::FeaturesAPI_BooleanFuse(
 FeaturesAPI_BooleanFuse::FeaturesAPI_BooleanFuse(
   const std::shared_ptr<ModelAPI_Feature>& theFeature,
   const std::list<ModelHighAPI_Selection>& theMainObjects,
-  const bool theRemoveEdges)
+  const bool theRemoveEdges,
+  const ModelHighAPI_Double& theFuzzy)
   : ModelHighAPI_Interface(theFeature)
 {
   if (initialize()) {
     fillAttribute(FeaturesPlugin_BooleanFuse::CREATION_METHOD_SIMPLE(), mycreationMethod);
     fillAttribute(theMainObjects, mymainObjects);
     fillAttribute(theRemoveEdges, myremoveEdges);
+    fillAttribute(theFuzzy, myfuzzyParam);
 
     execute(false);
   }
@@ -52,7 +54,8 @@ FeaturesAPI_BooleanFuse::FeaturesAPI_BooleanFuse(
   const std::shared_ptr<ModelAPI_Feature>& theFeature,
   const std::list<ModelHighAPI_Selection>& theMainObjects,
   const std::list<ModelHighAPI_Selection>& theToolObjects,
-  const bool theRemoveEdges)
+  const bool theRemoveEdges,
+  const ModelHighAPI_Double& theFuzzy)
 : ModelHighAPI_Interface(theFeature)
 {
   if(initialize()) {
@@ -60,6 +63,7 @@ FeaturesAPI_BooleanFuse::FeaturesAPI_BooleanFuse(
     fillAttribute(theMainObjects, mymainObjects);
     fillAttribute(theToolObjects, mytoolObjects);
     fillAttribute(theRemoveEdges, myremoveEdges);
+    fillAttribute(theFuzzy, myfuzzyParam);
 
     execute(false);
   }
@@ -98,6 +102,14 @@ void FeaturesAPI_BooleanFuse::setRemoveEdges(const bool theRemoveEdges)
   execute();
 }
 
+//==================================================================================================
+void FeaturesAPI_BooleanFuse::setFuzzyValue(const ModelHighAPI_Double& theFuzzy)
+{
+  fillAttribute(theFuzzy, myfuzzyParam);
+
+  execute();
+}
+
 //==================================================================================================
 void FeaturesAPI_BooleanFuse::setAdvancedMode(const bool theMode)
 {
@@ -125,6 +137,7 @@ void FeaturesAPI_BooleanFuse::dump(ModelHighAPI_Dumper& theDumper) const
     aBase->selectionList(FeaturesPlugin_BooleanFuse::TOOL_LIST_ID());
   AttributeBooleanPtr aRemoveEdges =
     aBase->boolean(FeaturesPlugin_BooleanFuse::REMOVE_INTERSECTION_EDGES_ID());
+  double aFuzzy = aBase->real(FeaturesPlugin_BooleanFuse::FUZZY_PARAM_ID())->value();
 
   theDumper << "(" << aDocName << ", " << anObjects;
 
@@ -136,6 +149,10 @@ void FeaturesAPI_BooleanFuse::dump(ModelHighAPI_Dumper& theDumper) const
     theDumper << ", removeEdges = True";
   }
 
+  if (aFuzzy != 1.e-8) {
+    theDumper << ", fuzzyParam = " << aFuzzy;
+  }
+
   if (!aBase->data()->version().empty())
     theDumper << ", keepSubResults = True";
 
@@ -147,6 +164,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 bool keepSubResults)
 {
   std::shared_ptr<ModelAPI_Feature> aFeature = thePart->addFeature(FeaturesAPI_BooleanFuse::ID());
@@ -159,10 +177,10 @@ BooleanFusePtr addFuse(const std::shared_ptr<ModelAPI_Document>& thePart,
 
   BooleanFusePtr aFuse;
   if (theToolObjects.first.empty())
-    aFuse.reset(new FeaturesAPI_BooleanFuse(aFeature, theMainObjects, aRemoveEdges));
+    aFuse.reset(new FeaturesAPI_BooleanFuse(aFeature, theMainObjects, aRemoveEdges, fuzzyParam));
   else {
     aFuse.reset(new FeaturesAPI_BooleanFuse(aFeature, theMainObjects, theToolObjects.first,
-                                            aRemoveEdges));
+                                            aRemoveEdges, fuzzyParam));
   }
   return aFuse;
 }