From 174bdd9cd6d2bff68cda773fd88d654fa26a26e6 Mon Sep 17 00:00:00 2001 From: mbs Date: Thu, 26 Jan 2023 11:39:10 +0000 Subject: [PATCH] fixed usage of fuzzy value as parameter in API --- src/FeaturesAPI/FeaturesAPI_BooleanCommon.cpp | 56 ++++++++++------- src/FeaturesAPI/FeaturesAPI_BooleanCommon.h | 2 +- src/FeaturesAPI/FeaturesAPI_BooleanCut.cpp | 29 +++++---- src/FeaturesAPI/FeaturesAPI_BooleanFill.cpp | 29 +++++---- src/FeaturesAPI/FeaturesAPI_BooleanFuse.cpp | 62 +++++++++++-------- src/FeaturesAPI/FeaturesAPI_BooleanSmash.cpp | 29 +++++---- src/FeaturesAPI/FeaturesAPI_Intersection.cpp | 25 +++++--- src/FeaturesAPI/FeaturesAPI_Partition.cpp | 26 +++++--- src/FeaturesAPI/FeaturesAPI_Union.cpp | 25 +++++--- 9 files changed, 167 insertions(+), 116 deletions(-) diff --git a/src/FeaturesAPI/FeaturesAPI_BooleanCommon.cpp b/src/FeaturesAPI/FeaturesAPI_BooleanCommon.cpp index b3db34fbb..265e7c7fd 100644 --- a/src/FeaturesAPI/FeaturesAPI_BooleanCommon.cpp +++ b/src/FeaturesAPI/FeaturesAPI_BooleanCommon.cpp @@ -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& 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& 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& thePart, const std::list& theMainObjects, const std::list& theToolObjects, - const ModelHighAPI_Double& fuzzyParam, + const ModelHighAPI_Double& theFuzzy, const bool keepSubResults) { std::shared_ptr aFeature = thePart->addFeature(FeaturesAPI_BooleanCommon::ID()); @@ -171,8 +181,8 @@ BooleanCommonPtr addCommon(const std::shared_ptr& 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; } diff --git a/src/FeaturesAPI/FeaturesAPI_BooleanCommon.h b/src/FeaturesAPI/FeaturesAPI_BooleanCommon.h index ae8821c76..b694997c6 100644 --- a/src/FeaturesAPI/FeaturesAPI_BooleanCommon.h +++ b/src/FeaturesAPI/FeaturesAPI_BooleanCommon.h @@ -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. diff --git a/src/FeaturesAPI/FeaturesAPI_BooleanCut.cpp b/src/FeaturesAPI/FeaturesAPI_BooleanCut.cpp index 0dce5cc56..67a2f5cbc 100644 --- a/src/FeaturesAPI/FeaturesAPI_BooleanCut.cpp +++ b/src/FeaturesAPI/FeaturesAPI_BooleanCut.cpp @@ -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& theMainObjects) { - fillAttribute(theMainObjects, mymainObjects); + fillAttribute(theMainObjects, VAR_NAME(mainObjects)); execute(); } @@ -71,7 +76,7 @@ void FeaturesAPI_BooleanCut::setMainObjects(const std::list& theToolObjects) { - fillAttribute(theToolObjects, mytoolObjects); + fillAttribute(theToolObjects, VAR_NAME(toolObjects)); execute(); } @@ -79,7 +84,7 @@ void FeaturesAPI_BooleanCut::setToolObjects(const std::list& thePart, const std::list& theMainObjects, const std::list& theToolObjects, - const ModelHighAPI_Double& fuzzyParam, + const ModelHighAPI_Double& theFuzzy, const bool keepSubResults) { std::shared_ptr 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)); } diff --git a/src/FeaturesAPI/FeaturesAPI_BooleanFill.cpp b/src/FeaturesAPI/FeaturesAPI_BooleanFill.cpp index f1e66c2cf..4d8651a26 100644 --- a/src/FeaturesAPI/FeaturesAPI_BooleanFill.cpp +++ b/src/FeaturesAPI/FeaturesAPI_BooleanFill.cpp @@ -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& 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& 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& thePart, const std::list& theMainObjects, const std::list& theToolObjects, - const ModelHighAPI_Double& fuzzyParam, + const ModelHighAPI_Double& theFuzzy, const bool keepSubResults) { std::shared_ptr 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)); } diff --git a/src/FeaturesAPI/FeaturesAPI_BooleanFuse.cpp b/src/FeaturesAPI/FeaturesAPI_BooleanFuse.cpp index 013b40075..5b17cb894 100644 --- a/src/FeaturesAPI/FeaturesAPI_BooleanFuse.cpp +++ b/src/FeaturesAPI/FeaturesAPI_BooleanFuse.cpp @@ -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& 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& 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& thePart, const std::list& theMainObjects, const std::pair, bool>& theToolObjects, const bool theRemoveEdges, - const ModelHighAPI_Double& fuzzyParam, + const ModelHighAPI_Double& theFuzzy, const bool keepSubResults) { std::shared_ptr aFeature = thePart->addFeature(FeaturesAPI_BooleanFuse::ID()); @@ -195,10 +205,10 @@ BooleanFusePtr addFuse(const std::shared_ptr& 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; } diff --git a/src/FeaturesAPI/FeaturesAPI_BooleanSmash.cpp b/src/FeaturesAPI/FeaturesAPI_BooleanSmash.cpp index f32c0a2fe..46a766b3f 100644 --- a/src/FeaturesAPI/FeaturesAPI_BooleanSmash.cpp +++ b/src/FeaturesAPI/FeaturesAPI_BooleanSmash.cpp @@ -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& 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& 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& thePart, const std::list& theMainObjects, const std::list& theToolObjects, - const ModelHighAPI_Double& fuzzyParam, + const ModelHighAPI_Double& theFuzzy, const bool keepSubResults) { std::shared_ptr 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)); } diff --git a/src/FeaturesAPI/FeaturesAPI_Intersection.cpp b/src/FeaturesAPI/FeaturesAPI_Intersection.cpp index 99d2ffda0..992f3f199 100644 --- a/src/FeaturesAPI/FeaturesAPI_Intersection.cpp +++ b/src/FeaturesAPI/FeaturesAPI_Intersection.cpp @@ -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& theObjects) { - fillAttribute(theObjects, myobjects); + fillAttribute(theObjects, VAR_NAME(objects)); execute(); } @@ -69,7 +74,7 @@ void FeaturesAPI_Intersection::setObjects(const std::list& thePart, const std::list& theObjects, - const ModelHighAPI_Double& fuzzyParam, + const ModelHighAPI_Double& theFuzzy, const bool keepSubResults) { std::shared_ptr 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)); } diff --git a/src/FeaturesAPI/FeaturesAPI_Partition.cpp b/src/FeaturesAPI/FeaturesAPI_Partition.cpp index 0f482bd32..ae64a0bdb 100644 --- a/src/FeaturesAPI/FeaturesAPI_Partition.cpp +++ b/src/FeaturesAPI/FeaturesAPI_Partition.cpp @@ -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& theBaseObjects) { - fillAttribute(theBaseObjects, mybaseObjects); + fillAttribute(theBaseObjects, VAR_NAME(baseObjects)); execute(); } @@ -67,7 +73,7 @@ void FeaturesAPI_Partition::setBase(const std::list& 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& thePart, const std::list& theBaseObjects, - const ModelHighAPI_Double& fuzzyParam, + const ModelHighAPI_Double& theFuzzy, const bool keepSubResults) { std::shared_ptr 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)); } diff --git a/src/FeaturesAPI/FeaturesAPI_Union.cpp b/src/FeaturesAPI/FeaturesAPI_Union.cpp index 6c7994a12..6fb7d6388 100644 --- a/src/FeaturesAPI/FeaturesAPI_Union.cpp +++ b/src/FeaturesAPI/FeaturesAPI_Union.cpp @@ -40,11 +40,16 @@ 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(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& theBaseObjects) { - fillAttribute(theBaseObjects, mybaseObjects); + fillAttribute(theBaseObjects, VAR_NAME(baseObjects)); execute(); } @@ -67,7 +72,7 @@ void FeaturesAPI_Union::setBase(const std::list& 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& thePart, const std::list& theBaseObjects, - const ModelHighAPI_Double& fuzzyParam, + const ModelHighAPI_Double& theFuzzy, const bool keepSubResults) { std::shared_ptr 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)); } -- 2.39.2