From: mbs Date: Thu, 19 Jan 2023 10:19:41 +0000 (+0000) Subject: added checkbox in UI for optional fuzzy parameter X-Git-Tag: V9_11_0a1~25 X-Git-Url: http://git.salome-platform.org/gitweb/?a=commitdiff_plain;h=57f95f226733dbd01fcd42c4b1f842c71560b7d7;p=modules%2Fshaper.git added checkbox in UI for optional fuzzy parameter --- diff --git a/src/FeaturesAPI/FeaturesAPI_BooleanCommon.cpp b/src/FeaturesAPI/FeaturesAPI_BooleanCommon.cpp index 7b8fe4217..c54ffa2cc 100644 --- a/src/FeaturesAPI/FeaturesAPI_BooleanCommon.cpp +++ b/src/FeaturesAPI/FeaturesAPI_BooleanCommon.cpp @@ -23,6 +23,10 @@ #include #include + +static const double DEFAULT_FUZZY = 1.e-5; + + //================================================================================================== FeaturesAPI_BooleanCommon::FeaturesAPI_BooleanCommon( const std::shared_ptr& theFeature) @@ -39,9 +43,12 @@ 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(theFuzzy, myfuzzyValue); + fillAttribute(aUseFuzzy, myuseFuzzy); + fillAttribute(aFuzzy, myfuzzyValue); execute(false); } @@ -56,10 +63,13 @@ 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(theFuzzy, myfuzzyValue); + fillAttribute(aUseFuzzy, myuseFuzzy); + fillAttribute(aFuzzy, myfuzzyValue); execute(false); } @@ -90,6 +100,14 @@ void FeaturesAPI_BooleanCommon::setToolObjects( execute(); } +//================================================================================================== +void FeaturesAPI_BooleanCommon::setUseFuzzy(bool theUseFuzzy) +{ + fillAttribute(theUseFuzzy, myuseFuzzy); + + execute(); +} + //================================================================================================== void FeaturesAPI_BooleanCommon::setFuzzyValue(const ModelHighAPI_Double& theFuzzy) { @@ -123,6 +141,7 @@ void FeaturesAPI_BooleanCommon::dump(ModelHighAPI_Dumper& theDumper) const aBase->selectionList(FeaturesPlugin_BooleanCommon::OBJECT_LIST_ID()); AttributeSelectionListPtr aTools = aBase->selectionList(FeaturesPlugin_BooleanCommon::TOOL_LIST_ID()); + bool aUseFuzzy = aBase->boolean(FeaturesPlugin_BooleanCommon::USE_FUZZY_ID())->value(); double aFuzzy = aBase->real(FeaturesPlugin_BooleanCommon::FUZZY_PARAM_ID())->value(); theDumper << "(" << aDocName << ", " << anObjects; @@ -131,7 +150,8 @@ void FeaturesAPI_BooleanCommon::dump(ModelHighAPI_Dumper& theDumper) const theDumper << ", " << aTools; } - theDumper << ", fuzzyParam = " << aFuzzy; + if (aUseFuzzy) + theDumper << ", fuzzyParam = " << aFuzzy; if (!aBase->data()->version().empty()) theDumper << ", keepSubResults = True"; diff --git a/src/FeaturesAPI/FeaturesAPI_BooleanCommon.h b/src/FeaturesAPI/FeaturesAPI_BooleanCommon.h index b5daab109..ae8821c76 100644 --- a/src/FeaturesAPI/FeaturesAPI_BooleanCommon.h +++ b/src/FeaturesAPI/FeaturesAPI_BooleanCommon.h @@ -45,26 +45,28 @@ public: FEATURESAPI_EXPORT FeaturesAPI_BooleanCommon(const std::shared_ptr& theFeature, const std::list& theMainObjects, - const ModelHighAPI_Double& theFuzzy = ModelHighAPI_Double(1.e-8)); + const ModelHighAPI_Double& theFuzzy = ModelHighAPI_Double(-1)); /// Constructor with values. FEATURESAPI_EXPORT FeaturesAPI_BooleanCommon(const std::shared_ptr& theFeature, const std::list& theMainObjects, const std::list& theToolObjects, - const ModelHighAPI_Double& theFuzzy = ModelHighAPI_Double(1.e-8)); + const ModelHighAPI_Double& theFuzzy = ModelHighAPI_Double(-1)); /// Destructor. FEATURESAPI_EXPORT virtual ~FeaturesAPI_BooleanCommon(); - INTERFACE_4(FeaturesPlugin_BooleanCommon::ID(), + INTERFACE_5(FeaturesPlugin_BooleanCommon::ID(), creationMethod, FeaturesPlugin_BooleanCommon::CREATION_METHOD(), ModelAPI_AttributeString, /** Creation method */, mainObjects, FeaturesPlugin_BooleanCommon::OBJECT_LIST_ID(), ModelAPI_AttributeSelectionList, /** Main objects */, toolObjects, FeaturesPlugin_BooleanCommon::TOOL_LIST_ID(), ModelAPI_AttributeSelectionList, /** Tool objects*/, + useFuzzy, FeaturesPlugin_BooleanCommon::USE_FUZZY_ID(), + ModelAPI_AttributeBoolean, /** Use Fuzzy parameter*/, fuzzyValue, FeaturesPlugin_BooleanCommon::FUZZY_PARAM_ID(), ModelAPI_AttributeDouble, /** Fuzzy parameter*/) @@ -76,6 +78,10 @@ public: FEATURESAPI_EXPORT void setToolObjects(const std::list& theToolObjects); + /// Set use fuzzy parameter. + FEATURESAPI_EXPORT + void setUseFuzzy(bool theUseFuzzy); + /// Set fuzzy parameter. FEATURESAPI_EXPORT void setFuzzyValue(const ModelHighAPI_Double& theFuzzy); @@ -98,7 +104,7 @@ FEATURESAPI_EXPORT BooleanCommonPtr addCommon( const std::shared_ptr& part, const std::list& objects, const std::list& tools = std::list(), - const ModelHighAPI_Double& fuzzyParam = ModelHighAPI_Double(1.e-8), + const ModelHighAPI_Double& fuzzyParam = ModelHighAPI_Double(-1), const bool keepSubResults = false); #endif // FeaturesAPI_BooleanCommon_H_ diff --git a/src/FeaturesAPI/FeaturesAPI_BooleanCut.cpp b/src/FeaturesAPI/FeaturesAPI_BooleanCut.cpp index 8bb3e9e40..1b3f10dcc 100644 --- a/src/FeaturesAPI/FeaturesAPI_BooleanCut.cpp +++ b/src/FeaturesAPI/FeaturesAPI_BooleanCut.cpp @@ -23,6 +23,10 @@ #include #include + +static const double DEFAULT_FUZZY = 1.e-5; + + //================================================================================================== FeaturesAPI_BooleanCut::FeaturesAPI_BooleanCut(const std::shared_ptr& theFeature) : ModelHighAPI_Interface(theFeature) @@ -39,9 +43,12 @@ 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(theFuzzy, myfuzzyParam); + fillAttribute(aUseFuzzy, myuseFuzzy); + fillAttribute(aFuzzy, myfuzzyParam); execute(false); } @@ -69,6 +76,14 @@ void FeaturesAPI_BooleanCut::setToolObjects(const std::listselectionList(FeaturesPlugin_BooleanCut::OBJECT_LIST_ID()); AttributeSelectionListPtr aTools = aBase->selectionList(FeaturesPlugin_BooleanCut::TOOL_LIST_ID()); + bool aUseFuzzy = aBase->boolean(FeaturesPlugin_BooleanCut::USE_FUZZY_ID())->value(); double aFuzzy = aBase->real(FeaturesPlugin_BooleanCut::FUZZY_PARAM_ID())->value(); theDumper << "(" << aDocName << ", " << anObjects << ", " << aTools; - theDumper << ", fuzzyParam = " << aFuzzy; + if (aUseFuzzy) + theDumper << ", fuzzyParam = " << aFuzzy; if (!aBase->data()->version().empty()) theDumper << ", keepSubResults = True"; diff --git a/src/FeaturesAPI/FeaturesAPI_BooleanCut.h b/src/FeaturesAPI/FeaturesAPI_BooleanCut.h index 09f673743..cc44d0957 100644 --- a/src/FeaturesAPI/FeaturesAPI_BooleanCut.h +++ b/src/FeaturesAPI/FeaturesAPI_BooleanCut.h @@ -46,17 +46,19 @@ public: FeaturesAPI_BooleanCut(const std::shared_ptr& theFeature, const std::list& theMainObjects, const std::list& theToolObjects, - const ModelHighAPI_Double& theFuzzy = ModelHighAPI_Double(1.e-8)); + const ModelHighAPI_Double& theFuzzy = ModelHighAPI_Double(-1)); /// Destructor. FEATURESAPI_EXPORT virtual ~FeaturesAPI_BooleanCut(); - INTERFACE_3(FeaturesPlugin_BooleanCut::ID(), + INTERFACE_4(FeaturesPlugin_BooleanCut::ID(), mainObjects, FeaturesPlugin_BooleanCut::OBJECT_LIST_ID(), ModelAPI_AttributeSelectionList, /** Main objects */, toolObjects, FeaturesPlugin_BooleanCut::TOOL_LIST_ID(), ModelAPI_AttributeSelectionList, /** Tool objects*/, + useFuzzy, FeaturesPlugin_BooleanCut::USE_FUZZY_ID(), + ModelAPI_AttributeBoolean, /** Use Fuzzy parameter*/, fuzzyParam, FeaturesPlugin_BooleanCut::FUZZY_PARAM_ID(), ModelAPI_AttributeDouble, /** Fuzzy parameter */) @@ -68,6 +70,10 @@ public: FEATURESAPI_EXPORT void setToolObjects(const std::list& theToolObjects); + /// Set use fuzzy parameter. + FEATURESAPI_EXPORT + void setUseFuzzy(bool theUseFuzzy); + /// Set fuzzy parameter. FEATURESAPI_EXPORT void setFuzzyValue(const ModelHighAPI_Double& theFuzzy); @@ -86,7 +92,7 @@ FEATURESAPI_EXPORT BooleanCutPtr addCut(const std::shared_ptr& thePart, const std::list& theMainObjects, const std::list& theToolObjects, - const ModelHighAPI_Double& fuzzyParam = ModelHighAPI_Double(1.e-8), + const ModelHighAPI_Double& fuzzyParam = ModelHighAPI_Double(-1), const bool keepSubResults = false); #endif // FeaturesAPI_BooleanCut_H_ diff --git a/src/FeaturesAPI/FeaturesAPI_BooleanFill.cpp b/src/FeaturesAPI/FeaturesAPI_BooleanFill.cpp index 09d4a4774..ed635775d 100644 --- a/src/FeaturesAPI/FeaturesAPI_BooleanFill.cpp +++ b/src/FeaturesAPI/FeaturesAPI_BooleanFill.cpp @@ -23,6 +23,10 @@ #include #include + +static const double DEFAULT_FUZZY = 1.e-5; + + //================================================================================================== FeaturesAPI_BooleanFill::FeaturesAPI_BooleanFill( const std::shared_ptr& theFeature) @@ -40,9 +44,12 @@ 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(theFuzzy, myfuzzyParam); + fillAttribute(aUseFuzzy, myuseFuzzy); + fillAttribute(aFuzzy, myfuzzyParam); execute(false); } @@ -72,6 +79,14 @@ void FeaturesAPI_BooleanFill::setToolObjects( execute(); } +//================================================================================================== +void FeaturesAPI_BooleanFill::setUseFuzzy(bool theUseFuzzy) +{ + fillAttribute(theUseFuzzy, myuseFuzzy); + + execute(); +} + //================================================================================================== void FeaturesAPI_BooleanFill::setFuzzyValue(const ModelHighAPI_Double& theFuzzy) { @@ -92,11 +107,13 @@ void FeaturesAPI_BooleanFill::dump(ModelHighAPI_Dumper& theDumper) const aBase->selectionList(FeaturesPlugin_BooleanFill::OBJECT_LIST_ID()); AttributeSelectionListPtr aTools = aBase->selectionList(FeaturesPlugin_BooleanFill::TOOL_LIST_ID()); + bool aUseFuzzy = aBase->boolean(FeaturesPlugin_BooleanFill::USE_FUZZY_ID())->value(); double aFuzzy = aBase->real(FeaturesPlugin_BooleanFill::FUZZY_PARAM_ID())->value(); theDumper << "(" << aDocName << ", " << anObjects << ", " << aTools; - theDumper << ", fuzzyParam = " << aFuzzy; + if (aUseFuzzy) + theDumper << ", fuzzyParam = " << aFuzzy; if (!aBase->data()->version().empty()) theDumper << ", keepSubResults = True"; diff --git a/src/FeaturesAPI/FeaturesAPI_BooleanFill.h b/src/FeaturesAPI/FeaturesAPI_BooleanFill.h index 35743ffc9..fd31f84d7 100644 --- a/src/FeaturesAPI/FeaturesAPI_BooleanFill.h +++ b/src/FeaturesAPI/FeaturesAPI_BooleanFill.h @@ -46,17 +46,19 @@ public: FeaturesAPI_BooleanFill(const std::shared_ptr& theFeature, const std::list& theMainObjects, const std::list& theToolObjects, - const ModelHighAPI_Double& theFuzzy = ModelHighAPI_Double(1.e-8)); + const ModelHighAPI_Double& theFuzzy = ModelHighAPI_Double(-1)); /// Destructor. FEATURESAPI_EXPORT virtual ~FeaturesAPI_BooleanFill(); - INTERFACE_3(FeaturesPlugin_BooleanFill::ID(), + INTERFACE_4(FeaturesPlugin_BooleanFill::ID(), mainObjects, FeaturesPlugin_BooleanFill::OBJECT_LIST_ID(), ModelAPI_AttributeSelectionList, /** Main objects */, toolObjects, FeaturesPlugin_BooleanFill::TOOL_LIST_ID(), ModelAPI_AttributeSelectionList, /** Tool objects*/, + useFuzzy, FeaturesPlugin_BooleanFill::USE_FUZZY_ID(), + ModelAPI_AttributeBoolean, /** Use Fuzzy parameter*/, fuzzyParam, FeaturesPlugin_BooleanFill::FUZZY_PARAM_ID(), ModelAPI_AttributeDouble, /** Fuzzy parameter */) @@ -68,6 +70,10 @@ public: FEATURESAPI_EXPORT void setToolObjects(const std::list& theToolObjects); + /// Set use fuzzy parameter. + FEATURESAPI_EXPORT + void setUseFuzzy(bool theUseFuzzy); + /// Set fuzzy parameter. FEATURESAPI_EXPORT void setFuzzyValue(const ModelHighAPI_Double& theFuzzy); @@ -86,7 +92,7 @@ FEATURESAPI_EXPORT BooleanFillPtr addSplit(const std::shared_ptr& thePart, const std::list& theMainObjects, const std::list& theToolObjects, - const ModelHighAPI_Double& fuzzyParam = ModelHighAPI_Double(1.e-8), + const ModelHighAPI_Double& fuzzyParam = ModelHighAPI_Double(-1), const bool keepSubResults = false); #endif // FeaturesAPI_BooleanFill_H_ diff --git a/src/FeaturesAPI/FeaturesAPI_BooleanFuse.cpp b/src/FeaturesAPI/FeaturesAPI_BooleanFuse.cpp index 2fd8df093..accab6d10 100644 --- a/src/FeaturesAPI/FeaturesAPI_BooleanFuse.cpp +++ b/src/FeaturesAPI/FeaturesAPI_BooleanFuse.cpp @@ -23,6 +23,10 @@ #include #include + +static const double DEFAULT_FUZZY = 1.e-5; + + //================================================================================================== FeaturesAPI_BooleanFuse::FeaturesAPI_BooleanFuse( const std::shared_ptr& theFeature) @@ -40,10 +44,13 @@ 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(theFuzzy, myfuzzyParam); + fillAttribute(aUseFuzzy, myuseFuzzy); + fillAttribute(aFuzzy, myfuzzyParam); execute(false); } @@ -59,11 +66,14 @@ 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(theFuzzy, myfuzzyParam); + fillAttribute(aUseFuzzy, myuseFuzzy); + fillAttribute(aFuzzy, myfuzzyParam); execute(false); } @@ -102,6 +112,14 @@ void FeaturesAPI_BooleanFuse::setRemoveEdges(const bool theRemoveEdges) execute(); } +//================================================================================================== +void FeaturesAPI_BooleanFuse::setUseFuzzy(bool theUseFuzzy) +{ + fillAttribute(theUseFuzzy, myuseFuzzy); + + execute(); +} + //================================================================================================== void FeaturesAPI_BooleanFuse::setFuzzyValue(const ModelHighAPI_Double& theFuzzy) { @@ -137,6 +155,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()); + bool aUseFuzzy = aBase->boolean(FeaturesPlugin_BooleanFuse::USE_FUZZY_ID())->value(); double aFuzzy = aBase->real(FeaturesPlugin_BooleanFuse::FUZZY_PARAM_ID())->value(); theDumper << "(" << aDocName << ", " << anObjects; @@ -149,9 +168,8 @@ void FeaturesAPI_BooleanFuse::dump(ModelHighAPI_Dumper& theDumper) const theDumper << ", removeEdges = True"; } - if (aFuzzy != 1.e-8) { + if (aUseFuzzy) theDumper << ", fuzzyParam = " << aFuzzy; - } if (!aBase->data()->version().empty()) theDumper << ", keepSubResults = True"; diff --git a/src/FeaturesAPI/FeaturesAPI_BooleanFuse.h b/src/FeaturesAPI/FeaturesAPI_BooleanFuse.h index 04da890e6..ffe594d67 100644 --- a/src/FeaturesAPI/FeaturesAPI_BooleanFuse.h +++ b/src/FeaturesAPI/FeaturesAPI_BooleanFuse.h @@ -46,7 +46,7 @@ public: FeaturesAPI_BooleanFuse(const std::shared_ptr& theFeature, const std::list& theMainObjects, const bool theRemoveEdges = false, - const ModelHighAPI_Double& theFuzzy = ModelHighAPI_Double(1.e-8)); + const ModelHighAPI_Double& theFuzzy = ModelHighAPI_Double(-1)); /// Constructor with values. FEATURESAPI_EXPORT @@ -54,13 +54,13 @@ public: const std::list& theMainObjects, const std::list& theToolObjects, const bool theRemoveEdges = false, - const ModelHighAPI_Double& theFuzzy = ModelHighAPI_Double(1.e-8)); + const ModelHighAPI_Double& theFuzzy = ModelHighAPI_Double(-1)); /// Destructor. FEATURESAPI_EXPORT virtual ~FeaturesAPI_BooleanFuse(); - INTERFACE_5(FeaturesPlugin_BooleanFuse::ID(), + INTERFACE_6(FeaturesPlugin_BooleanFuse::ID(), creationMethod, FeaturesPlugin_BooleanFuse::CREATION_METHOD(), ModelAPI_AttributeString, /** Creation method */, mainObjects, FeaturesPlugin_BooleanFuse::OBJECT_LIST_ID(), @@ -69,6 +69,8 @@ public: ModelAPI_AttributeSelectionList, /** Tool objects*/, removeEdges, FeaturesPlugin_BooleanFuse::REMOVE_INTERSECTION_EDGES_ID(), ModelAPI_AttributeBoolean, /** Remove edges */, + useFuzzy, FeaturesPlugin_BooleanFuse::USE_FUZZY_ID(), + ModelAPI_AttributeBoolean, /** Use Fuzzy parameter*/, fuzzyParam, FeaturesPlugin_BooleanFuse::FUZZY_PARAM_ID(), ModelAPI_AttributeDouble, /** Fuzzy parameter */) @@ -84,6 +86,10 @@ public: FEATURESAPI_EXPORT void setRemoveEdges(const bool theRemoveEdges); + /// Set use fuzzy parameter. + FEATURESAPI_EXPORT + void setUseFuzzy(bool theUseFuzzy); + /// Set fuzzy parameter. FEATURESAPI_EXPORT void setFuzzyValue(const ModelHighAPI_Double& theFuzzy); @@ -110,7 +116,7 @@ FEATURESAPI_EXPORT BooleanFusePtr addFuse( const std::list& objects, const std::pair, bool>& tools = DUMMY_TOOLS, const bool removeEdges = false, - const ModelHighAPI_Double& fuzzyParam = ModelHighAPI_Double(1.e-8), + const ModelHighAPI_Double& fuzzyParam = ModelHighAPI_Double(-1), const bool keepSubResults = false); #endif // FeaturesAPI_BooleanFuse_H_ diff --git a/src/FeaturesAPI/FeaturesAPI_BooleanSmash.cpp b/src/FeaturesAPI/FeaturesAPI_BooleanSmash.cpp index 7c5ce1722..94eb7d6d4 100644 --- a/src/FeaturesAPI/FeaturesAPI_BooleanSmash.cpp +++ b/src/FeaturesAPI/FeaturesAPI_BooleanSmash.cpp @@ -23,6 +23,10 @@ #include #include + +static const double DEFAULT_FUZZY = 1.e-5; + + //================================================================================================== FeaturesAPI_BooleanSmash::FeaturesAPI_BooleanSmash( const std::shared_ptr& theFeature) @@ -40,9 +44,12 @@ 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(theFuzzy, myfuzzyParam); + fillAttribute(aUseFuzzy, myuseFuzzy); + fillAttribute(aFuzzy, myfuzzyParam); execute(false); } @@ -72,6 +79,14 @@ void FeaturesAPI_BooleanSmash::setToolObjects( execute(); } +//================================================================================================== +void FeaturesAPI_BooleanSmash::setUseFuzzy(bool theUseFuzzy) +{ + fillAttribute(theUseFuzzy, myuseFuzzy); + + execute(); +} + //================================================================================================== void FeaturesAPI_BooleanSmash::setFuzzyValue(const ModelHighAPI_Double& theFuzzy) { @@ -92,11 +107,13 @@ void FeaturesAPI_BooleanSmash::dump(ModelHighAPI_Dumper& theDumper) const aBase->selectionList(FeaturesPlugin_BooleanSmash::OBJECT_LIST_ID()); AttributeSelectionListPtr aTools = aBase->selectionList(FeaturesPlugin_BooleanSmash::TOOL_LIST_ID()); + bool aUseFuzzy = aBase->boolean(FeaturesPlugin_BooleanSmash::USE_FUZZY_ID())->value(); double aFuzzy = aBase->real(FeaturesPlugin_BooleanSmash::FUZZY_PARAM_ID())->value(); theDumper << "(" << aDocName << ", " << anObjects << ", " << aTools; - theDumper << ", fuzzyParam = " << aFuzzy; + if (aUseFuzzy) + theDumper << ", fuzzyParam = " << aFuzzy; if (!aBase->data()->version().empty()) theDumper << ", keepSubResults = True"; diff --git a/src/FeaturesAPI/FeaturesAPI_BooleanSmash.h b/src/FeaturesAPI/FeaturesAPI_BooleanSmash.h index 188079af7..11d224057 100644 --- a/src/FeaturesAPI/FeaturesAPI_BooleanSmash.h +++ b/src/FeaturesAPI/FeaturesAPI_BooleanSmash.h @@ -46,17 +46,19 @@ public: FeaturesAPI_BooleanSmash(const std::shared_ptr& theFeature, const std::list& theMainObjects, const std::list& theToolObjects, - const ModelHighAPI_Double& theFuzzy = ModelHighAPI_Double(1.e-8)); + const ModelHighAPI_Double& theFuzzy = ModelHighAPI_Double(-1)); /// Destructor. FEATURESAPI_EXPORT virtual ~FeaturesAPI_BooleanSmash(); - INTERFACE_3(FeaturesPlugin_BooleanSmash::ID(), + INTERFACE_4(FeaturesPlugin_BooleanSmash::ID(), mainObjects, FeaturesPlugin_BooleanSmash::OBJECT_LIST_ID(), ModelAPI_AttributeSelectionList, /** Main objects */, toolObjects, FeaturesPlugin_BooleanSmash::TOOL_LIST_ID(), ModelAPI_AttributeSelectionList, /** Tool objects*/, + useFuzzy, FeaturesPlugin_BooleanSmash::USE_FUZZY_ID(), + ModelAPI_AttributeBoolean, /** Use Fuzzy parameter*/, fuzzyParam, FeaturesPlugin_BooleanSmash::FUZZY_PARAM_ID(), ModelAPI_AttributeDouble, /** Fuzzy parameter */) @@ -68,6 +70,10 @@ public: FEATURESAPI_EXPORT void setToolObjects(const std::list& theToolObjects); + /// Set use fuzzy parameter. + FEATURESAPI_EXPORT + void setUseFuzzy(bool theUseFuzzy); + /// Set fuzzy parameter. FEATURESAPI_EXPORT void setFuzzyValue(const ModelHighAPI_Double& theFuzzy); @@ -86,7 +92,7 @@ FEATURESAPI_EXPORT BooleanSmashPtr addSmash(const std::shared_ptr& thePart, const std::list& theMainObjects, const std::list& theToolObjects, - const ModelHighAPI_Double& fuzzyParam = ModelHighAPI_Double(1.e-8), + const ModelHighAPI_Double& fuzzyParam = ModelHighAPI_Double(-1), const bool keepSubResults = false); #endif // FeaturesAPI_BooleanSmash_H_ diff --git a/src/FeaturesAPI/FeaturesAPI_Intersection.cpp b/src/FeaturesAPI/FeaturesAPI_Intersection.cpp index 6ceafb170..76806c3c4 100644 --- a/src/FeaturesAPI/FeaturesAPI_Intersection.cpp +++ b/src/FeaturesAPI/FeaturesAPI_Intersection.cpp @@ -22,6 +22,10 @@ #include #include + +static const double DEFAULT_FUZZY = 1.e-5; + + //================================================================================================== FeaturesAPI_Intersection::FeaturesAPI_Intersection( const std::shared_ptr& theFeature) @@ -38,8 +42,11 @@ 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(theFuzzy, myfuzzyParam); + fillAttribute(aUseFuzzy, myuseFuzzy); + fillAttribute(aFuzzy, myfuzzyParam); execute(); } @@ -59,6 +66,14 @@ void FeaturesAPI_Intersection::setObjects(const std::listselectionList(FeaturesPlugin_Intersection::OBJECT_LIST_ID()); + bool aUseFuzzy = aBase->boolean(FeaturesPlugin_Intersection::USE_FUZZY_ID())->value(); double aFuzzy = aBase->real(FeaturesPlugin_Intersection::FUZZY_PARAM_ID())->value(); theDumper << aBase << " = model.addIntersection(" << aDocName << ", " << anAttrObjects; - theDumper << ", fuzzyParam = " << aFuzzy; + if (aUseFuzzy) + theDumper << ", fuzzyParam = " << aFuzzy; if (!aBase->data()->version().empty()) theDumper << ", keepSubResults = True"; diff --git a/src/FeaturesAPI/FeaturesAPI_Intersection.h b/src/FeaturesAPI/FeaturesAPI_Intersection.h index f69daaff6..653962c2a 100644 --- a/src/FeaturesAPI/FeaturesAPI_Intersection.h +++ b/src/FeaturesAPI/FeaturesAPI_Intersection.h @@ -45,15 +45,17 @@ public: FEATURESAPI_EXPORT explicit FeaturesAPI_Intersection(const std::shared_ptr& theFeature, const std::list& theObjects, - const ModelHighAPI_Double& aFuzzy = ModelHighAPI_Double(1.e-8)); + const ModelHighAPI_Double& aFuzzy = ModelHighAPI_Double(-1)); /// Destructor. FEATURESAPI_EXPORT virtual ~FeaturesAPI_Intersection(); - INTERFACE_2(FeaturesPlugin_Intersection::ID(), + INTERFACE_3(FeaturesPlugin_Intersection::ID(), objects, FeaturesPlugin_Intersection::OBJECT_LIST_ID(), ModelAPI_AttributeSelectionList, /** Objects */, + useFuzzy, FeaturesPlugin_Intersection::USE_FUZZY_ID(), + ModelAPI_AttributeBoolean, /** Use Fuzzy parameter*/, fuzzyParam, FeaturesPlugin_Intersection::FUZZY_PARAM_ID(), ModelAPI_AttributeDouble, /** Fuzzy parameter */) @@ -61,6 +63,10 @@ public: FEATURESAPI_EXPORT void setObjects(const std::list& theObjects); + /// Set use fuzzy parameter. + FEATURESAPI_EXPORT + void setUseFuzzy(bool theUseFuzzy); + /// Set fuzzy parameter. FEATURESAPI_EXPORT void setFuzzyValue(const ModelHighAPI_Double& theFuzzy); @@ -78,7 +84,7 @@ typedef std::shared_ptr IntersectionPtr; FEATURESAPI_EXPORT IntersectionPtr addIntersection(const std::shared_ptr& part, const std::list& objects, - const ModelHighAPI_Double& fuzzyParam = ModelHighAPI_Double(1.e-8), + const ModelHighAPI_Double& fuzzyParam = ModelHighAPI_Double(-1), const bool keepSubResults = false); #endif // FeaturesAPI_Intersection_H_ diff --git a/src/FeaturesAPI/FeaturesAPI_Partition.cpp b/src/FeaturesAPI/FeaturesAPI_Partition.cpp index c7ca9aa40..d4e84c69d 100644 --- a/src/FeaturesAPI/FeaturesAPI_Partition.cpp +++ b/src/FeaturesAPI/FeaturesAPI_Partition.cpp @@ -22,6 +22,10 @@ #include #include + +static const double DEFAULT_FUZZY = 1.e-5; + + //================================================================================================== FeaturesAPI_Partition::FeaturesAPI_Partition(const std::shared_ptr& theFeature) : ModelHighAPI_Interface(theFeature) @@ -37,8 +41,11 @@ 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(theFuzzy, myfuzzyParam); + fillAttribute(aUseFuzzy, myuseFuzzy); + fillAttribute(aFuzzy, myfuzzyParam); execute(); } } @@ -57,6 +64,14 @@ void FeaturesAPI_Partition::setBase(const std::list& the execute(); } +//================================================================================================== +void FeaturesAPI_Partition::setUseFuzzy(bool theUseFuzzy) +{ + fillAttribute(theUseFuzzy, myuseFuzzy); + + execute(); +} + //================================================================================================== void FeaturesAPI_Partition::setFuzzy(const ModelHighAPI_Double& theFuzzy) { @@ -73,11 +88,13 @@ void FeaturesAPI_Partition::dump(ModelHighAPI_Dumper& theDumper) const AttributeSelectionListPtr anAttrObjects = aBase->selectionList(FeaturesPlugin_Partition::BASE_OBJECTS_ID()); + bool aUseFuzzy = aBase->boolean(FeaturesPlugin_Partition::USE_FUZZY_ID())->value(); double aFuzzy = aBase->real(FeaturesPlugin_Partition::FUZZY_PARAM_ID())->value(); theDumper << aBase << " = model.addPartition(" << aDocName << ", " << anAttrObjects; - theDumper << ", fuzzyParam = " << aFuzzy; + if (aUseFuzzy) + theDumper << ", fuzzyParam = " << aFuzzy; if (!aBase->data()->version().empty()) theDumper << ", keepSubResults = True"; diff --git a/src/FeaturesAPI/FeaturesAPI_Partition.h b/src/FeaturesAPI/FeaturesAPI_Partition.h index 3e533ff93..224470897 100644 --- a/src/FeaturesAPI/FeaturesAPI_Partition.h +++ b/src/FeaturesAPI/FeaturesAPI_Partition.h @@ -45,15 +45,17 @@ public: FEATURESAPI_EXPORT explicit FeaturesAPI_Partition(const std::shared_ptr& theFeature, const std::list& theBaseObjects, - const ModelHighAPI_Double& theFuzzy = ModelHighAPI_Double(1.e-8)); + const ModelHighAPI_Double& theFuzzy = ModelHighAPI_Double(-1)); /// Destructor. FEATURESAPI_EXPORT virtual ~FeaturesAPI_Partition(); - INTERFACE_2(FeaturesPlugin_Partition::ID(), + INTERFACE_3(FeaturesPlugin_Partition::ID(), baseObjects, FeaturesPlugin_Partition::BASE_OBJECTS_ID(), ModelAPI_AttributeSelectionList, /** Base objects */, + useFuzzy, FeaturesPlugin_Partition::USE_FUZZY_ID(), + ModelAPI_AttributeBoolean, /** Use Fuzzy parameter*/, fuzzyParam, FeaturesPlugin_Partition::FUZZY_PARAM_ID(), ModelAPI_AttributeDouble, /** Fuzzy parameter */) @@ -61,6 +63,10 @@ public: FEATURESAPI_EXPORT void setBase(const std::list& theBaseObjects); + /// Set use fuzzy parameter. + FEATURESAPI_EXPORT + void setUseFuzzy(bool theUseFuzzy); + /// Modify fuzzy parameter attribute of the feature. FEATURESAPI_EXPORT void setFuzzy(const ModelHighAPI_Double& theFuzzy); @@ -78,7 +84,7 @@ typedef std::shared_ptr PartitionPtr; FEATURESAPI_EXPORT PartitionPtr addPartition(const std::shared_ptr& thePart, const std::list& theBaseObjects, - const ModelHighAPI_Double& fuzzyParam = ModelHighAPI_Double(1.e-8), + const ModelHighAPI_Double& fuzzyParam = ModelHighAPI_Double(-1), const bool keepSubResults = false); #endif // FeaturesAPI_Partition_H_ diff --git a/src/FeaturesAPI/FeaturesAPI_Union.cpp b/src/FeaturesAPI/FeaturesAPI_Union.cpp index 30e4234b2..81ca4d231 100644 --- a/src/FeaturesAPI/FeaturesAPI_Union.cpp +++ b/src/FeaturesAPI/FeaturesAPI_Union.cpp @@ -22,6 +22,10 @@ #include #include + +static const double DEFAULT_FUZZY = 1.e-5; + + //================================================================================================ FeaturesAPI_Union::FeaturesAPI_Union(const std::shared_ptr& theFeature) : ModelHighAPI_Interface(theFeature) @@ -36,8 +40,11 @@ FeaturesAPI_Union::FeaturesAPI_Union(const std::shared_ptr& th : ModelHighAPI_Interface(theFeature) { if(initialize()) { + bool aUseFuzzy = (theFuzzy.value() > 0); + ModelHighAPI_Double aFuzzy = (aUseFuzzy ? theFuzzy : ModelHighAPI_Double(DEFAULT_FUZZY)); fillAttribute(theBaseObjects, mybaseObjects); - fillAttribute(theFuzzy, myfuzzyParam); + fillAttribute(aUseFuzzy, myuseFuzzy); + fillAttribute(aFuzzy, myfuzzyParam); execute(); } @@ -57,6 +64,14 @@ void FeaturesAPI_Union::setBase(const std::list& theBase execute(); } +//================================================================================================== +void FeaturesAPI_Union::setUseFuzzy(bool theUseFuzzy) +{ + fillAttribute(theUseFuzzy, myuseFuzzy); + + execute(); +} + //================================================================================================== void FeaturesAPI_Union::setFuzzyValue(const ModelHighAPI_Double& theFuzzy) { @@ -73,11 +88,13 @@ void FeaturesAPI_Union::dump(ModelHighAPI_Dumper& theDumper) const AttributeSelectionListPtr anAttrObjects = aBase->selectionList(FeaturesPlugin_Union::BASE_OBJECTS_ID()); + bool aUseFuzzy = aBase->boolean(FeaturesPlugin_Union::USE_FUZZY_ID())->value(); double aFuzzy = aBase->real(FeaturesPlugin_Union::FUZZY_PARAM_ID())->value(); theDumper << aBase << " = model.addUnion(" << aDocName << ", " << anAttrObjects; - theDumper << ", fuzzyParam = " << aFuzzy; + if (aUseFuzzy) + theDumper << ", fuzzyParam = " << aFuzzy; if (!aBase->data()->version().empty()) theDumper << ", keepSubResults = True"; diff --git a/src/FeaturesAPI/FeaturesAPI_Union.h b/src/FeaturesAPI/FeaturesAPI_Union.h index 022d14130..de5696385 100644 --- a/src/FeaturesAPI/FeaturesAPI_Union.h +++ b/src/FeaturesAPI/FeaturesAPI_Union.h @@ -45,15 +45,17 @@ public: FEATURESAPI_EXPORT explicit FeaturesAPI_Union(const std::shared_ptr& theFeature, const std::list& theBaseObjects, - const ModelHighAPI_Double& theFuzzy = ModelHighAPI_Double(1.e-8)); + const ModelHighAPI_Double& theFuzzy = ModelHighAPI_Double(-1)); /// Destructor. FEATURESAPI_EXPORT virtual ~FeaturesAPI_Union(); - INTERFACE_2(FeaturesPlugin_Union::ID(), + INTERFACE_3(FeaturesPlugin_Union::ID(), baseObjects, FeaturesPlugin_Union::BASE_OBJECTS_ID(), ModelAPI_AttributeSelectionList, /** Base objects */, + useFuzzy, FeaturesPlugin_Union::USE_FUZZY_ID(), + ModelAPI_AttributeBoolean, /** Use Fuzzy parameter*/, fuzzyParam, FeaturesPlugin_Union::FUZZY_PARAM_ID(), ModelAPI_AttributeDouble, /** Fuzzy parameter */) @@ -61,6 +63,10 @@ public: FEATURESAPI_EXPORT void setBase(const std::list& theBaseObjects); + /// Set use fuzzy parameter. + FEATURESAPI_EXPORT + void setUseFuzzy(bool theUseFuzzy); + /// Set fuzzy parameter. FEATURESAPI_EXPORT void setFuzzyValue(const ModelHighAPI_Double& theFuzzy); @@ -78,7 +84,7 @@ typedef std::shared_ptr UnionPtr; FEATURESAPI_EXPORT UnionPtr addUnion(const std::shared_ptr& thePart, const std::list& theBaseObjects, - const ModelHighAPI_Double& fuzzyParam = ModelHighAPI_Double(1.e-8), + const ModelHighAPI_Double& fuzzyParam = ModelHighAPI_Double(-1), const bool keepSubResults = false); #endif // FeaturesAPI_Union_H_ diff --git a/src/FeaturesPlugin/FeaturesPlugin_Boolean.cpp b/src/FeaturesPlugin/FeaturesPlugin_Boolean.cpp index 82f08f182..55e8e3527 100644 --- a/src/FeaturesPlugin/FeaturesPlugin_Boolean.cpp +++ b/src/FeaturesPlugin/FeaturesPlugin_Boolean.cpp @@ -21,6 +21,7 @@ #include #include +#include #include #include #include @@ -46,6 +47,10 @@ #include #include + +static const double DEFAULT_FUZZY = 1.e-5; + + //================================================================================================= FeaturesPlugin_Boolean::FeaturesPlugin_Boolean(const OperationType theOperationType) : myOperationType(theOperationType) @@ -58,11 +63,10 @@ void FeaturesPlugin_Boolean::initAttributes() data()->addAttribute(FeaturesPlugin_Boolean::OBJECT_LIST_ID(), ModelAPI_AttributeSelectionList::typeId()); data()->addAttribute(FeaturesPlugin_Boolean::TOOL_LIST_ID(), ModelAPI_AttributeSelectionList::typeId()); + data()->addAttribute(FeaturesPlugin_Boolean::USE_FUZZY_ID(), ModelAPI_AttributeBoolean::typeId()); data()->addAttribute(FeaturesPlugin_Boolean::FUZZY_PARAM_ID(), ModelAPI_AttributeDouble::typeId()); - // Initialize the fuzzy parameter with a value below Precision::Confusion() to indicate, - // that the internal algorithms should use their default fuzzy value, if none was specified - // by the user. - real(FUZZY_PARAM_ID())->setValue(1.e-8); + boolean(USE_FUZZY_ID())->setValue(false); // Do NOT use the fuzzy parameter by default. + real(FUZZY_PARAM_ID())->setValue(DEFAULT_FUZZY); ModelAPI_Session::get()->validators()->registerNotObligatory(getKind(), OBJECT_LIST_ID()); ModelAPI_Session::get()->validators()->registerNotObligatory(getKind(), TOOL_LIST_ID()); diff --git a/src/FeaturesPlugin/FeaturesPlugin_Boolean.h b/src/FeaturesPlugin/FeaturesPlugin_Boolean.h index fc88bcbab..24f26b20e 100644 --- a/src/FeaturesPlugin/FeaturesPlugin_Boolean.h +++ b/src/FeaturesPlugin/FeaturesPlugin_Boolean.h @@ -51,6 +51,13 @@ public: return MY_TOOL_LIST_ID; } + /// Attribute name of use fuzzy parameter. + inline static const std::string& USE_FUZZY_ID() + { + static const std::string MY_USE_FUZZY_ID("use_fuzzy"); + return MY_USE_FUZZY_ID; + } + /// Attribute name of fuzzy parameter. inline static const std::string& FUZZY_PARAM_ID() { diff --git a/src/FeaturesPlugin/FeaturesPlugin_BooleanCommon.cpp b/src/FeaturesPlugin/FeaturesPlugin_BooleanCommon.cpp index b3d4e4c53..6d32408d7 100644 --- a/src/FeaturesPlugin/FeaturesPlugin_BooleanCommon.cpp +++ b/src/FeaturesPlugin/FeaturesPlugin_BooleanCommon.cpp @@ -20,6 +20,7 @@ #include "FeaturesPlugin_BooleanCommon.h" #include +#include #include #include #include @@ -40,6 +41,9 @@ #include +static const double DEFAULT_FUZZY = 1.e-5; + + //================================================================================================== FeaturesPlugin_BooleanCommon::FeaturesPlugin_BooleanCommon() : FeaturesPlugin_Boolean(FeaturesPlugin_Boolean::BOOL_COMMON) @@ -54,12 +58,10 @@ void FeaturesPlugin_BooleanCommon::initAttributes() data()->addAttribute(OBJECT_LIST_ID(), ModelAPI_AttributeSelectionList::typeId()); data()->addAttribute(TOOL_LIST_ID(), ModelAPI_AttributeSelectionList::typeId()); + data()->addAttribute(USE_FUZZY_ID(), ModelAPI_AttributeBoolean::typeId()); data()->addAttribute(FUZZY_PARAM_ID(), ModelAPI_AttributeDouble::typeId()); - - // Initialize the fuzzy parameter with a value below Precision::Confusion() to indicate, - // that the internal algorithms should use their default fuzzy value, if none was specified - // by the user. - real(FUZZY_PARAM_ID())->setValue(1.e-8); + boolean(USE_FUZZY_ID())->setValue(false); // Do NOT use the fuzzy parameter by default. + real(FUZZY_PARAM_ID())->setValue(DEFAULT_FUZZY); initVersion(BOP_VERSION_9_4(), selectionList(OBJECT_LIST_ID()), selectionList(TOOL_LIST_ID())); } @@ -97,7 +99,9 @@ void FeaturesPlugin_BooleanCommon::execute() // Getting fuzzy parameter. // Used as additional tolerance to eliminate tiny results. - double aFuzzy = real(FUZZY_PARAM_ID())->value(); + // Using -1 as fuzzy value in the GeomAlgoAPI means to ignore it during the boolean operation! + bool aUseFuzzy = boolean(USE_FUZZY_ID())->value(); + double aFuzzy = (aUseFuzzy ? real(FUZZY_PARAM_ID())->value() : -1); // version of COMMON feature const std::string aCommonVersion = data()->version(); diff --git a/src/FeaturesPlugin/FeaturesPlugin_BooleanCut.cpp b/src/FeaturesPlugin/FeaturesPlugin_BooleanCut.cpp index 50de25d0c..1aaa84a0f 100644 --- a/src/FeaturesPlugin/FeaturesPlugin_BooleanCut.cpp +++ b/src/FeaturesPlugin/FeaturesPlugin_BooleanCut.cpp @@ -20,6 +20,7 @@ #include "FeaturesPlugin_BooleanCut.h" #include +#include #include #include #include @@ -82,7 +83,9 @@ void FeaturesPlugin_BooleanCut::execute() // Getting fuzzy parameter. // Used as additional tolerance to eliminate tiny results. - double aFuzzy = real(FUZZY_PARAM_ID())->value(); + // Using -1 as fuzzy value in the GeomAlgoAPI means to ignore it during the boolean operation! + bool aUseFuzzy = boolean(USE_FUZZY_ID())->value(); + double aFuzzy = (aUseFuzzy ? real(FUZZY_PARAM_ID())->value() : -1); // For solids cut each object with all tools. bool isOk = true; diff --git a/src/FeaturesPlugin/FeaturesPlugin_BooleanFill.cpp b/src/FeaturesPlugin/FeaturesPlugin_BooleanFill.cpp index 247fd3561..3c1c67d60 100644 --- a/src/FeaturesPlugin/FeaturesPlugin_BooleanFill.cpp +++ b/src/FeaturesPlugin/FeaturesPlugin_BooleanFill.cpp @@ -20,6 +20,7 @@ #include "FeaturesPlugin_BooleanFill.h" #include +#include #include #include #include @@ -93,7 +94,9 @@ void FeaturesPlugin_BooleanFill::execute() // Getting fuzzy parameter. // Used as additional tolerance to eliminate tiny results. - double aFuzzy = real(FUZZY_PARAM_ID())->value(); + // Using -1 as fuzzy value in the GeomAlgoAPI means to ignore it during the boolean operation! + bool aUseFuzzy = boolean(USE_FUZZY_ID())->value(); + double aFuzzy = (aUseFuzzy ? real(FUZZY_PARAM_ID())->value() : -1); // For solids cut each object with all tools. bool isOk = true; diff --git a/src/FeaturesPlugin/FeaturesPlugin_BooleanFuse.cpp b/src/FeaturesPlugin/FeaturesPlugin_BooleanFuse.cpp index a10fead97..5b080a180 100644 --- a/src/FeaturesPlugin/FeaturesPlugin_BooleanFuse.cpp +++ b/src/FeaturesPlugin/FeaturesPlugin_BooleanFuse.cpp @@ -41,6 +41,9 @@ #include +static const double DEFAULT_FUZZY = 1.e-5; + + //================================================================================================== static void explodeCompound(const GeomShapePtr& theShape, ListOfShape& theResult) { @@ -72,11 +75,10 @@ void FeaturesPlugin_BooleanFuse::initAttributes() data()->addAttribute(OBJECT_LIST_ID(), ModelAPI_AttributeSelectionList::typeId()); data()->addAttribute(TOOL_LIST_ID(), ModelAPI_AttributeSelectionList::typeId()); + data()->addAttribute(FeaturesPlugin_Boolean::USE_FUZZY_ID(), ModelAPI_AttributeBoolean::typeId()); data()->addAttribute(FUZZY_PARAM_ID(), ModelAPI_AttributeDouble::typeId()); - // Initialize the fuzzy parameter with a value below Precision::Confusion() to indicate, - // that the internal algorithms should use their default fuzzy value, if none was specified - // by the user. - real(FUZZY_PARAM_ID())->setValue(1.e-8); + boolean(USE_FUZZY_ID())->setValue(false); // Do NOT use the fuzzy parameter by default. + real(FUZZY_PARAM_ID())->setValue(DEFAULT_FUZZY); data()->addAttribute(REMOVE_INTERSECTION_EDGES_ID(), ModelAPI_AttributeBoolean::typeId()); @@ -126,7 +128,9 @@ void FeaturesPlugin_BooleanFuse::execute() // Getting fuzzy parameter. // Used as additional tolerance to eliminate tiny results. - double aFuzzy = real(FUZZY_PARAM_ID())->value(); + // Using -1 as fuzzy value in the GeomAlgoAPI means to ignore it during the boolean operation! + bool aUseFuzzy = boolean(USE_FUZZY_ID())->value(); + double aFuzzy = (aUseFuzzy ? real(FUZZY_PARAM_ID())->value() : -1); // version of FUSE feature const std::string aFuseVersion = data()->version(); diff --git a/src/FeaturesPlugin/FeaturesPlugin_BooleanSmash.cpp b/src/FeaturesPlugin/FeaturesPlugin_BooleanSmash.cpp index 9f1aca998..92aff415c 100644 --- a/src/FeaturesPlugin/FeaturesPlugin_BooleanSmash.cpp +++ b/src/FeaturesPlugin/FeaturesPlugin_BooleanSmash.cpp @@ -20,6 +20,7 @@ #include "FeaturesPlugin_BooleanSmash.h" #include +#include #include #include #include @@ -35,6 +36,9 @@ #include +static const double DEFAULT_FUZZY = 1.e-5; + + //================================================================================================== FeaturesPlugin_BooleanSmash::FeaturesPlugin_BooleanSmash() : FeaturesPlugin_Boolean(FeaturesPlugin_Boolean::BOOL_SMASH) @@ -47,11 +51,10 @@ void FeaturesPlugin_BooleanSmash::initAttributes() data()->addAttribute(OBJECT_LIST_ID(), ModelAPI_AttributeSelectionList::typeId()); data()->addAttribute(TOOL_LIST_ID(), ModelAPI_AttributeSelectionList::typeId()); + data()->addAttribute(USE_FUZZY_ID(), ModelAPI_AttributeBoolean::typeId()); data()->addAttribute(FUZZY_PARAM_ID(), ModelAPI_AttributeDouble::typeId()); - // Initialize the fuzzy parameter with a value below Precision::Confusion() to indicate, - // that the internal algorithms should use their default fuzzy value, if none was specified - // by the user. - real(FUZZY_PARAM_ID())->setValue(1.e-8); + boolean(USE_FUZZY_ID())->setValue(false); // Do NOT use the fuzzy parameter by default. + real(FUZZY_PARAM_ID())->setValue(DEFAULT_FUZZY); initVersion(BOP_VERSION_9_4(), selectionList(OBJECT_LIST_ID()), selectionList(TOOL_LIST_ID())); } @@ -110,7 +113,9 @@ void FeaturesPlugin_BooleanSmash::execute() // Getting fuzzy parameter. // Used as additional tolerance to eliminate tiny results. - double aFuzzy = real(FUZZY_PARAM_ID())->value(); + // Using -1 as fuzzy value in the GeomAlgoAPI means to ignore it during the boolean operation! + bool aUseFuzzy = boolean(USE_FUZZY_ID())->value(); + double aFuzzy = (aUseFuzzy ? real(FUZZY_PARAM_ID())->value() : -1); std::shared_ptr aMakeShapeList(new GeomAlgoAPI_MakeShapeList()); if (!aShapesToAdd.empty()) { diff --git a/src/FeaturesPlugin/FeaturesPlugin_Intersection.cpp b/src/FeaturesPlugin/FeaturesPlugin_Intersection.cpp index 42dff80df..e76619bfe 100644 --- a/src/FeaturesPlugin/FeaturesPlugin_Intersection.cpp +++ b/src/FeaturesPlugin/FeaturesPlugin_Intersection.cpp @@ -23,6 +23,7 @@ #include #include #include +#include #include #include #include @@ -36,6 +37,8 @@ static const std::string INTERSECTION_VERSION_1("v9.5"); +static const double DEFAULT_FUZZY = 1.e-5; + //================================================================================================= FeaturesPlugin_Intersection::FeaturesPlugin_Intersection() @@ -48,11 +51,10 @@ void FeaturesPlugin_Intersection::initAttributes() AttributePtr anObjectsAttr = data()->addAttribute(OBJECT_LIST_ID(), ModelAPI_AttributeSelectionList::typeId()); + data()->addAttribute(USE_FUZZY_ID(), ModelAPI_AttributeBoolean::typeId()); data()->addAttribute(FUZZY_PARAM_ID(), ModelAPI_AttributeDouble::typeId()); - // Initialize the fuzzy parameter with a value below Precision::Confusion() to indicate, - // that the internal algorithms should use their default fuzzy value, if none was specified - // by the user. - real(FUZZY_PARAM_ID())->setValue(1.e-8); + boolean(USE_FUZZY_ID())->setValue(false); // Do NOT use the fuzzy parameter by default. + real(FUZZY_PARAM_ID())->setValue(DEFAULT_FUZZY); initVersion(INTERSECTION_VERSION_1, anObjectsAttr, AttributePtr()); } @@ -70,7 +72,9 @@ void FeaturesPlugin_Intersection::execute() // Getting fuzzy parameter. // Used as additional tolerance to eliminate tiny results. - double aFuzzy = real(FUZZY_PARAM_ID())->value(); + // Using -1 as fuzzy value in the GeomAlgoAPI means to ignore it during the boolean operation! + bool aUseFuzzy = boolean(USE_FUZZY_ID())->value(); + double aFuzzy = (aUseFuzzy ? real(FUZZY_PARAM_ID())->value() : -1); int aResultIndex = 0; diff --git a/src/FeaturesPlugin/FeaturesPlugin_Intersection.h b/src/FeaturesPlugin/FeaturesPlugin_Intersection.h index 08e3e7a72..67ed1b0a7 100644 --- a/src/FeaturesPlugin/FeaturesPlugin_Intersection.h +++ b/src/FeaturesPlugin/FeaturesPlugin_Intersection.h @@ -48,6 +48,13 @@ public: return MY_OBJECT_LIST_ID; } + /// Attribute name of use fuzzy parameter. + inline static const std::string& USE_FUZZY_ID() + { + static const std::string MY_USE_FUZZY_ID("use_fuzzy"); + return MY_USE_FUZZY_ID; + } + /// Attribute name of fuzzy parameter. inline static const std::string& FUZZY_PARAM_ID() { diff --git a/src/FeaturesPlugin/FeaturesPlugin_Partition.cpp b/src/FeaturesPlugin/FeaturesPlugin_Partition.cpp index 7e1a77c7a..e8788e76a 100644 --- a/src/FeaturesPlugin/FeaturesPlugin_Partition.cpp +++ b/src/FeaturesPlugin/FeaturesPlugin_Partition.cpp @@ -50,6 +50,9 @@ #include +static const double DEFAULT_FUZZY = 1.e-5; + + //================================================================================================= FeaturesPlugin_Partition::FeaturesPlugin_Partition() { @@ -60,11 +63,10 @@ void FeaturesPlugin_Partition::initAttributes() { data()->addAttribute(BASE_OBJECTS_ID(), ModelAPI_AttributeSelectionList::typeId()); + data()->addAttribute(USE_FUZZY_ID(), ModelAPI_AttributeBoolean::typeId()); data()->addAttribute(FUZZY_PARAM_ID(), ModelAPI_AttributeDouble::typeId()); - // Initialize the fuzzy parameter with a value below Precision::Confusion() to indicate, - // that the internal algorithms should use their default fuzzy value, if none was specified - // by the user. - real(FUZZY_PARAM_ID())->setValue(1.e-8); + boolean(USE_FUZZY_ID())->setValue(false); // Do NOT use the fuzzy parameter by default. + real(FUZZY_PARAM_ID())->setValue(DEFAULT_FUZZY); initVersion(BOP_VERSION_9_4(), selectionList(BASE_OBJECTS_ID())); } @@ -85,7 +87,9 @@ void FeaturesPlugin_Partition::execute() // Getting fuzzy parameter. // Used as additional tolerance to eliminate tiny results. - double aFuzzy = real(FUZZY_PARAM_ID())->value(); + // Using -1 as fuzzy value in the GeomAlgoAPI means to ignore it during the boolean operation! + bool aUseFuzzy = boolean(USE_FUZZY_ID())->value(); + double aFuzzy = (aUseFuzzy ? real(FUZZY_PARAM_ID())->value() : -1); ListOfShape aBaseObjects = anObjects.objects(); aBaseObjects.insert(aBaseObjects.end(), aPlanes.begin(), aPlanes.end()); diff --git a/src/FeaturesPlugin/FeaturesPlugin_Partition.h b/src/FeaturesPlugin/FeaturesPlugin_Partition.h index 1448ff724..40f5dc4f3 100644 --- a/src/FeaturesPlugin/FeaturesPlugin_Partition.h +++ b/src/FeaturesPlugin/FeaturesPlugin_Partition.h @@ -46,6 +46,13 @@ public: return MY_BASE_OBJECTS_ID; } + /// Attribute name of use fuzzy parameter. + inline static const std::string& USE_FUZZY_ID() + { + static const std::string MY_USE_FUZZY_ID("use_fuzzy"); + return MY_USE_FUZZY_ID; + } + /// Attribute name of fuzzy parameter. inline static const std::string& FUZZY_PARAM_ID() { diff --git a/src/FeaturesPlugin/FeaturesPlugin_Union.cpp b/src/FeaturesPlugin/FeaturesPlugin_Union.cpp index 9627e7bf0..dcc3f7dde 100644 --- a/src/FeaturesPlugin/FeaturesPlugin_Union.cpp +++ b/src/FeaturesPlugin/FeaturesPlugin_Union.cpp @@ -29,12 +29,16 @@ #include #include +#include > #include #include #include #include +static const double DEFAULT_FUZZY = 1.e-5; + + //================================================================================================= FeaturesPlugin_Union::FeaturesPlugin_Union() { @@ -45,11 +49,10 @@ void FeaturesPlugin_Union::initAttributes() { data()->addAttribute(BASE_OBJECTS_ID(), ModelAPI_AttributeSelectionList::typeId()); + data()->addAttribute(USE_FUZZY_ID(), ModelAPI_AttributeBoolean::typeId()); data()->addAttribute(FUZZY_PARAM_ID(), ModelAPI_AttributeDouble::typeId()); - // Initialize the fuzzy parameter with a value below Precision::Confusion() to indicate, - // that the internal algorithms should use their default fuzzy value, if none was specified - // by the user. - real(FUZZY_PARAM_ID())->setValue(1.e-8); + boolean(USE_FUZZY_ID())->setValue(false); // Do NOT use the fuzzy parameter by default. + real(FUZZY_PARAM_ID())->setValue(DEFAULT_FUZZY); initVersion(BOP_VERSION_9_4(), selectionList(BASE_OBJECTS_ID())); } @@ -71,7 +74,9 @@ void FeaturesPlugin_Union::execute() // Getting fuzzy parameter. // Used as additional tolerance to eliminate tiny results. - double aFuzzy = real(FUZZY_PARAM_ID())->value(); + // Using -1 as fuzzy value in the GeomAlgoAPI means to ignore it during the boolean operation! + bool aUseFuzzy = boolean(USE_FUZZY_ID())->value(); + double aFuzzy = (aUseFuzzy ? real(FUZZY_PARAM_ID())->value() : -1); std::string anError; int aResultIndex = 0; diff --git a/src/FeaturesPlugin/FeaturesPlugin_Union.h b/src/FeaturesPlugin/FeaturesPlugin_Union.h index 52688310a..8490d0174 100644 --- a/src/FeaturesPlugin/FeaturesPlugin_Union.h +++ b/src/FeaturesPlugin/FeaturesPlugin_Union.h @@ -43,6 +43,13 @@ public: return MY_BASE_OBJECTS_ID; } + /// Attribute name of use fuzzy parameter. + inline static const std::string& USE_FUZZY_ID() + { + static const std::string MY_USE_FUZZY_ID("use_fuzzy"); + return MY_USE_FUZZY_ID; + } + /// Attribute name of fuzzy parameter. inline static const std::string& FUZZY_PARAM_ID() { diff --git a/src/FeaturesPlugin/boolean_common_widget.xml b/src/FeaturesPlugin/boolean_common_widget.xml index c34682a3d..52d6ca7ea 100644 --- a/src/FeaturesPlugin/boolean_common_widget.xml +++ b/src/FeaturesPlugin/boolean_common_widget.xml @@ -38,17 +38,17 @@ - + + step="1.e-5" + default="1.e-5"> - + diff --git a/src/FeaturesPlugin/boolean_fuse_widget.xml b/src/FeaturesPlugin/boolean_fuse_widget.xml index 1e9635a60..e312f2b49 100644 --- a/src/FeaturesPlugin/boolean_fuse_widget.xml +++ b/src/FeaturesPlugin/boolean_fuse_widget.xml @@ -38,17 +38,17 @@ - + + step="1.e-5" + default="1.e-5"> - + - + + step="1.e-5" + default="1.e-5"> - + diff --git a/src/FeaturesPlugin/boolean_split_widget.xml b/src/FeaturesPlugin/boolean_split_widget.xml index 7db9399c1..50130dbb9 100644 --- a/src/FeaturesPlugin/boolean_split_widget.xml +++ b/src/FeaturesPlugin/boolean_split_widget.xml @@ -19,16 +19,16 @@ - + + step="1.e-5" + default="1.e-5"> - + diff --git a/src/FeaturesPlugin/boolean_widget.xml b/src/FeaturesPlugin/boolean_widget.xml index 222e8007e..7967f1775 100644 --- a/src/FeaturesPlugin/boolean_widget.xml +++ b/src/FeaturesPlugin/boolean_widget.xml @@ -19,7 +19,7 @@ - + - + diff --git a/src/FeaturesPlugin/doc/booleanArguments.rst b/src/FeaturesPlugin/doc/booleanArguments.rst index 1de32398b..68579bdfc 100644 --- a/src/FeaturesPlugin/doc/booleanArguments.rst +++ b/src/FeaturesPlugin/doc/booleanArguments.rst @@ -69,7 +69,4 @@ Construction planes (mentioned PLANE) can be used in several operations, but not | :ref:`featureUnion` | | | +-------------------------+---------------------------+-------------------------+ -The fuzzy parameter of each boolean operation is used as an additional tolerance to eliminate tiny results. - -*Note*: If a value is given, which is smaller than the lowest meaningful tolerance of 1.e-7, the boolean operation -will use the default internal fuzzy parameter. +The optional fuzzy parameter of each boolean operation is used as an additional tolerance to eliminate tiny results. diff --git a/src/FeaturesPlugin/doc/images/Common.png b/src/FeaturesPlugin/doc/images/Common.png index 0aaf5351e..bacf8c642 100644 Binary files a/src/FeaturesPlugin/doc/images/Common.png and b/src/FeaturesPlugin/doc/images/Common.png differ diff --git a/src/FeaturesPlugin/doc/images/Cut.png b/src/FeaturesPlugin/doc/images/Cut.png index d971a74b2..8bb664a18 100644 Binary files a/src/FeaturesPlugin/doc/images/Cut.png and b/src/FeaturesPlugin/doc/images/Cut.png differ diff --git a/src/FeaturesPlugin/doc/images/Fuse.png b/src/FeaturesPlugin/doc/images/Fuse.png index bf281ea0b..1572c81d4 100644 Binary files a/src/FeaturesPlugin/doc/images/Fuse.png and b/src/FeaturesPlugin/doc/images/Fuse.png differ diff --git a/src/FeaturesPlugin/doc/images/Partition.png b/src/FeaturesPlugin/doc/images/Partition.png index 02499b2b9..8de6a3531 100644 Binary files a/src/FeaturesPlugin/doc/images/Partition.png and b/src/FeaturesPlugin/doc/images/Partition.png differ diff --git a/src/FeaturesPlugin/doc/images/Smash.png b/src/FeaturesPlugin/doc/images/Smash.png index 1bcebe216..8b7e8d516 100644 Binary files a/src/FeaturesPlugin/doc/images/Smash.png and b/src/FeaturesPlugin/doc/images/Smash.png differ diff --git a/src/FeaturesPlugin/doc/images/Split_panel.png b/src/FeaturesPlugin/doc/images/Split_panel.png index 7d80c5f84..43dd5c81a 100644 Binary files a/src/FeaturesPlugin/doc/images/Split_panel.png and b/src/FeaturesPlugin/doc/images/Split_panel.png differ diff --git a/src/FeaturesPlugin/doc/images/boolean_common_advanced_property_panel.png b/src/FeaturesPlugin/doc/images/boolean_common_advanced_property_panel.png index 879ea0075..58ae7c34c 100644 Binary files a/src/FeaturesPlugin/doc/images/boolean_common_advanced_property_panel.png and b/src/FeaturesPlugin/doc/images/boolean_common_advanced_property_panel.png differ diff --git a/src/FeaturesPlugin/doc/images/boolean_common_simple_property_panel.png b/src/FeaturesPlugin/doc/images/boolean_common_simple_property_panel.png index 0a592579c..93efa401a 100644 Binary files a/src/FeaturesPlugin/doc/images/boolean_common_simple_property_panel.png and b/src/FeaturesPlugin/doc/images/boolean_common_simple_property_panel.png differ diff --git a/src/FeaturesPlugin/doc/images/boolean_cut_property_panel.png b/src/FeaturesPlugin/doc/images/boolean_cut_property_panel.png index 696067fd4..441e1a395 100644 Binary files a/src/FeaturesPlugin/doc/images/boolean_cut_property_panel.png and b/src/FeaturesPlugin/doc/images/boolean_cut_property_panel.png differ diff --git a/src/FeaturesPlugin/doc/images/boolean_fuse_advanced_property_panel.png b/src/FeaturesPlugin/doc/images/boolean_fuse_advanced_property_panel.png index 4dd19cba0..b1961e5d3 100644 Binary files a/src/FeaturesPlugin/doc/images/boolean_fuse_advanced_property_panel.png and b/src/FeaturesPlugin/doc/images/boolean_fuse_advanced_property_panel.png differ diff --git a/src/FeaturesPlugin/doc/images/boolean_fuse_simple_property_panel.png b/src/FeaturesPlugin/doc/images/boolean_fuse_simple_property_panel.png index 069eb59da..72f6939d0 100644 Binary files a/src/FeaturesPlugin/doc/images/boolean_fuse_simple_property_panel.png and b/src/FeaturesPlugin/doc/images/boolean_fuse_simple_property_panel.png differ diff --git a/src/FeaturesPlugin/doc/images/intersection_property_panel.png b/src/FeaturesPlugin/doc/images/intersection_property_panel.png index b439ac3e4..f497cdd2b 100644 Binary files a/src/FeaturesPlugin/doc/images/intersection_property_panel.png and b/src/FeaturesPlugin/doc/images/intersection_property_panel.png differ diff --git a/src/FeaturesPlugin/intersection_widget.xml b/src/FeaturesPlugin/intersection_widget.xml index bafcf1328..6a9c834cb 100644 --- a/src/FeaturesPlugin/intersection_widget.xml +++ b/src/FeaturesPlugin/intersection_widget.xml @@ -9,15 +9,15 @@ - + + step="1.e-5" + default="1.e-5"> - + diff --git a/src/FeaturesPlugin/partition_widget.xml b/src/FeaturesPlugin/partition_widget.xml index 6a2eda743..a6baaa549 100644 --- a/src/FeaturesPlugin/partition_widget.xml +++ b/src/FeaturesPlugin/partition_widget.xml @@ -7,16 +7,16 @@ clear_in_neutral_point="false"> - + + step="1.e-5" + default="1.e-5"> - + diff --git a/src/FeaturesPlugin/union_widget.xml b/src/FeaturesPlugin/union_widget.xml index f8676877b..c5ae191cf 100644 --- a/src/FeaturesPlugin/union_widget.xml +++ b/src/FeaturesPlugin/union_widget.xml @@ -7,17 +7,17 @@ concealment="true"> - + + step="1.e-5" + default="1.e-5"> - + diff --git a/src/GeomAlgoAPI/GeomAlgoAPI_Boolean.cpp b/src/GeomAlgoAPI/GeomAlgoAPI_Boolean.cpp index 6e3c60df1..8bbbe4dfa 100644 --- a/src/GeomAlgoAPI/GeomAlgoAPI_Boolean.cpp +++ b/src/GeomAlgoAPI/GeomAlgoAPI_Boolean.cpp @@ -32,7 +32,7 @@ GeomAlgoAPI_Boolean::GeomAlgoAPI_Boolean(const GeomShapePtr theObject, const GeomShapePtr theTool, const GeomAlgoAPI_Tools::BOPType theOperationType, - const double theFuzzy/*= 1.e-8*/) + const double theFuzzy/*= -1*/) { ListOfShape aListWithObject, aListWithTool; aListWithObject.push_back(theObject); @@ -44,7 +44,7 @@ GeomAlgoAPI_Boolean::GeomAlgoAPI_Boolean(const GeomShapePtr theObject, GeomAlgoAPI_Boolean::GeomAlgoAPI_Boolean(const GeomShapePtr theObject, const ListOfShape& theTools, const GeomAlgoAPI_Tools::BOPType theOperationType, - const double theFuzzy/*= 1.e-8*/) + const double theFuzzy/*= -1*/) { ListOfShape aListWithObject; aListWithObject.push_back(theObject); @@ -55,7 +55,7 @@ GeomAlgoAPI_Boolean::GeomAlgoAPI_Boolean(const GeomShapePtr theObject, GeomAlgoAPI_Boolean::GeomAlgoAPI_Boolean(const ListOfShape& theObjects, const ListOfShape& theTools, const GeomAlgoAPI_Tools::BOPType theOperationType, - const double theFuzzy/*= 1.e-8*/) + const double theFuzzy/*= -1*/) { build(theObjects, theTools, theOperationType, theFuzzy); } @@ -116,9 +116,9 @@ void GeomAlgoAPI_Boolean::build(const ListOfShape& theObjects, aBuilder->SetRunParallel(bRunParallel); // Set fuzzy value to eliminate thin results - // => Either use the value set by the user (greater or equal than minimum valid value 1.e-7) + // => Either use the value set by the user (if positive) // => or use the old default value of 1.e-5 - Standard_Real aFuzzy = (theFuzzy >= 1.e-7 ? theFuzzy : 1.e-5); + Standard_Real aFuzzy = (theFuzzy > 0 ? theFuzzy : 1.e-5); aBuilder->SetFuzzyValue(aFuzzy); // Building and getting result. diff --git a/src/GeomAlgoAPI/GeomAlgoAPI_Boolean.h b/src/GeomAlgoAPI/GeomAlgoAPI_Boolean.h index 0182ff054..c5e46c11a 100644 --- a/src/GeomAlgoAPI/GeomAlgoAPI_Boolean.h +++ b/src/GeomAlgoAPI/GeomAlgoAPI_Boolean.h @@ -38,24 +38,24 @@ public: /// \param[in] theTool the tool object. /// \param[in] theOperationType type of boolean operation. /// \param[in] theFuzzy additional tolerance value. - /// If the fuzzy value is below the minimum tolerance value (1.e-7), the - /// boolean operation will use a default additional tolerance value of 1.e-5. + /// If the fuzzy value is non-positive, the boolean operation will use a default + // additional tolerance value of 1.e-5. GEOMALGOAPI_EXPORT GeomAlgoAPI_Boolean(const GeomShapePtr theObject, const GeomShapePtr theTool, const GeomAlgoAPI_Tools::BOPType theOperationType, - const double theFuzzy = 1.e-8); + const double theFuzzy = -1); /// Constructor. /// \param[in] theObject the main object. /// \param[in] theTools list of tools. /// \param[in] theOperationType type of boolean operation. /// \param[in] theFuzzy additional tolerance value. - /// If the fuzzy value is below the minimum tolerance value (1.e-7), the - /// boolean operation will use a default additional tolerance value of 1.e-5. + /// If the fuzzy value is non-positive, the boolean operation will use a default + // additional tolerance value of 1.e-5. GEOMALGOAPI_EXPORT GeomAlgoAPI_Boolean(const GeomShapePtr theObject, const ListOfShape& theTools, const GeomAlgoAPI_Tools::BOPType theOperationType, - const double theFuzzy = 1.e-8); + const double theFuzzy = -1); /// Constructor. @@ -63,12 +63,12 @@ public: /// \param[in] theTools list of tools. /// \param[in] theOperationType type of boolean operation. /// \param[in] theFuzzy additional tolerance value. - /// If the fuzzy value is below the minimum tolerance value (1.e-7), the - /// boolean operation will use a default additional tolerance value of 1.e-5. + /// If the fuzzy value is non-positive, the boolean operation will use a default + // additional tolerance value of 1.e-5. GEOMALGOAPI_EXPORT GeomAlgoAPI_Boolean(const ListOfShape& theObjects, const ListOfShape& theTools, const GeomAlgoAPI_Tools::BOPType theOperationType, - const double theFuzzy = 1.e-8); + const double theFuzzy = -1); /// Redefinition of the generic method for the Fuse problem: OCCT 30481 GEOMALGOAPI_EXPORT virtual void modified(const GeomShapePtr theOldShape, diff --git a/src/GeomAlgoAPI/GeomAlgoAPI_Intersection.cpp b/src/GeomAlgoAPI/GeomAlgoAPI_Intersection.cpp index 8ab6a1b07..35942f9bd 100644 --- a/src/GeomAlgoAPI/GeomAlgoAPI_Intersection.cpp +++ b/src/GeomAlgoAPI/GeomAlgoAPI_Intersection.cpp @@ -67,7 +67,7 @@ void GeomAlgoAPI_Intersection::build(const ListOfShape& theObjects, const double aDSFiller->SetRunParallel(false); aDSFiller->SetNonDestructive(false); aDSFiller->SetGlue(BOPAlgo_GlueOff); - if (theFuzzy >= 1.e-7) aDSFiller->SetFuzzyValue(theFuzzy); + if (theFuzzy > 0) aDSFiller->SetFuzzyValue(theFuzzy); // optimization for the issue #2399 BOPAlgo_SectionAttribute theSecAttr(Standard_True, @@ -83,7 +83,7 @@ void GeomAlgoAPI_Intersection::build(const ListOfShape& theObjects, const double anOperation->SetArguments(anObjects); anOperation->SetRunParallel(false); anOperation->SetCheckInverted(true); - if (theFuzzy >= 1.e-7) anOperation->SetFuzzyValue(theFuzzy); + if (theFuzzy > 0) anOperation->SetFuzzyValue(theFuzzy); anOperation->PerformWithFiller(*aDSFiller); // it references a filler fields, so keep the filler myFiller = 0; diff --git a/src/GeomAlgoAPI/GeomAlgoAPI_Partition.cpp b/src/GeomAlgoAPI/GeomAlgoAPI_Partition.cpp index fe49e167a..dae505c08 100644 --- a/src/GeomAlgoAPI/GeomAlgoAPI_Partition.cpp +++ b/src/GeomAlgoAPI/GeomAlgoAPI_Partition.cpp @@ -202,7 +202,7 @@ void GeomAlgoAPI_Partition::build(const ListOfShape& theObjects, Standard_Boolean bRunParallel = Standard_True; anOperation->SetRunParallel(bRunParallel); - if (theFuzzy >= 1.e-7) anOperation->SetFuzzyValue(theFuzzy); + if (theFuzzy > 0) anOperation->SetFuzzyValue(theFuzzy); // Building and getting result. anOperation->Perform(); diff --git a/src/GeomAlgoAPI/GeomAlgoAPI_PaveFiller.cpp b/src/GeomAlgoAPI/GeomAlgoAPI_PaveFiller.cpp index 3801c8064..27af42e71 100644 --- a/src/GeomAlgoAPI/GeomAlgoAPI_PaveFiller.cpp +++ b/src/GeomAlgoAPI/GeomAlgoAPI_PaveFiller.cpp @@ -56,7 +56,7 @@ void GeomAlgoAPI_PaveFiller::build(const ListOfShape& theListOfShape, } } aPaveFiller->SetArguments(aListOfShape); - if (theFuzzy >= 1.e-7) aPaveFiller->SetFuzzyValue(theFuzzy); + if (theFuzzy > 0) aPaveFiller->SetFuzzyValue(theFuzzy); aPaveFiller->Perform(); if (aPaveFiller->HasErrors()) return; @@ -65,7 +65,7 @@ void GeomAlgoAPI_PaveFiller::build(const ListOfShape& theListOfShape, this->setImpl(aBuilder); this->setBuilderType(OCCT_BOPAlgo_Builder); aBuilder->SetArguments(aListOfShape); - if (theFuzzy >= 1.e-7) aBuilder->SetFuzzyValue(theFuzzy); + if (theFuzzy > 0) aBuilder->SetFuzzyValue(theFuzzy); aBuilder->PerformWithFiller(*aPaveFiller); if (aBuilder->HasErrors()) return;