#include <ModelHighAPI_Selection.h>
#include <ModelHighAPI_Tools.h>
+
+static const double DEFAULT_FUZZY = 1.e-5;
+
+
//==================================================================================================
FeaturesAPI_BooleanCommon::FeaturesAPI_BooleanCommon(
const std::shared_ptr<ModelAPI_Feature>& theFeature)
: 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);
}
: 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);
}
execute();
}
+//==================================================================================================
+void FeaturesAPI_BooleanCommon::setUseFuzzy(bool theUseFuzzy)
+{
+ fillAttribute(theUseFuzzy, myuseFuzzy);
+
+ execute();
+}
+
//==================================================================================================
void FeaturesAPI_BooleanCommon::setFuzzyValue(const ModelHighAPI_Double& theFuzzy)
{
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;
theDumper << ", " << aTools;
}
- theDumper << ", fuzzyParam = " << aFuzzy;
+ if (aUseFuzzy)
+ theDumper << ", fuzzyParam = " << aFuzzy;
if (!aBase->data()->version().empty())
theDumper << ", keepSubResults = True";
FEATURESAPI_EXPORT
FeaturesAPI_BooleanCommon(const std::shared_ptr<ModelAPI_Feature>& theFeature,
const std::list<ModelHighAPI_Selection>& 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<ModelAPI_Feature>& theFeature,
const std::list<ModelHighAPI_Selection>& theMainObjects,
const std::list<ModelHighAPI_Selection>& 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*/)
FEATURESAPI_EXPORT
void setToolObjects(const std::list<ModelHighAPI_Selection>& theToolObjects);
+ /// Set use fuzzy parameter.
+ FEATURESAPI_EXPORT
+ void setUseFuzzy(bool theUseFuzzy);
+
/// Set fuzzy parameter.
FEATURESAPI_EXPORT
void setFuzzyValue(const ModelHighAPI_Double& theFuzzy);
const std::shared_ptr<ModelAPI_Document>& part,
const std::list<ModelHighAPI_Selection>& objects,
const std::list<ModelHighAPI_Selection>& tools = std::list<ModelHighAPI_Selection>(),
- const ModelHighAPI_Double& fuzzyParam = ModelHighAPI_Double(1.e-8),
+ const ModelHighAPI_Double& fuzzyParam = ModelHighAPI_Double(-1),
const bool keepSubResults = false);
#endif // FeaturesAPI_BooleanCommon_H_
#include <ModelHighAPI_Selection.h>
#include <ModelHighAPI_Tools.h>
+
+static const double DEFAULT_FUZZY = 1.e-5;
+
+
//==================================================================================================
FeaturesAPI_BooleanCut::FeaturesAPI_BooleanCut(const std::shared_ptr<ModelAPI_Feature>& theFeature)
: ModelHighAPI_Interface(theFeature)
: 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);
}
execute();
}
+//==================================================================================================
+void FeaturesAPI_BooleanCut::setUseFuzzy(bool theUseFuzzy)
+{
+ fillAttribute(theUseFuzzy, myuseFuzzy);
+
+ execute();
+}
+
//==================================================================================================
void FeaturesAPI_BooleanCut::setFuzzyValue(const ModelHighAPI_Double& theFuzzy)
{
aBase->selectionList(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";
FeaturesAPI_BooleanCut(const std::shared_ptr<ModelAPI_Feature>& theFeature,
const std::list<ModelHighAPI_Selection>& theMainObjects,
const std::list<ModelHighAPI_Selection>& 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 */)
FEATURESAPI_EXPORT
void setToolObjects(const std::list<ModelHighAPI_Selection>& theToolObjects);
+ /// Set use fuzzy parameter.
+ FEATURESAPI_EXPORT
+ void setUseFuzzy(bool theUseFuzzy);
+
/// Set fuzzy parameter.
FEATURESAPI_EXPORT
void setFuzzyValue(const ModelHighAPI_Double& theFuzzy);
BooleanCutPtr addCut(const std::shared_ptr<ModelAPI_Document>& thePart,
const std::list<ModelHighAPI_Selection>& theMainObjects,
const std::list<ModelHighAPI_Selection>& theToolObjects,
- const ModelHighAPI_Double& fuzzyParam = ModelHighAPI_Double(1.e-8),
+ const ModelHighAPI_Double& fuzzyParam = ModelHighAPI_Double(-1),
const bool keepSubResults = false);
#endif // FeaturesAPI_BooleanCut_H_
#include <ModelHighAPI_Selection.h>
#include <ModelHighAPI_Tools.h>
+
+static const double DEFAULT_FUZZY = 1.e-5;
+
+
//==================================================================================================
FeaturesAPI_BooleanFill::FeaturesAPI_BooleanFill(
const std::shared_ptr<ModelAPI_Feature>& theFeature)
: 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);
}
execute();
}
+//==================================================================================================
+void FeaturesAPI_BooleanFill::setUseFuzzy(bool theUseFuzzy)
+{
+ fillAttribute(theUseFuzzy, myuseFuzzy);
+
+ execute();
+}
+
//==================================================================================================
void FeaturesAPI_BooleanFill::setFuzzyValue(const ModelHighAPI_Double& theFuzzy)
{
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";
FeaturesAPI_BooleanFill(const std::shared_ptr<ModelAPI_Feature>& theFeature,
const std::list<ModelHighAPI_Selection>& theMainObjects,
const std::list<ModelHighAPI_Selection>& 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 */)
FEATURESAPI_EXPORT
void setToolObjects(const std::list<ModelHighAPI_Selection>& theToolObjects);
+ /// Set use fuzzy parameter.
+ FEATURESAPI_EXPORT
+ void setUseFuzzy(bool theUseFuzzy);
+
/// Set fuzzy parameter.
FEATURESAPI_EXPORT
void setFuzzyValue(const ModelHighAPI_Double& theFuzzy);
BooleanFillPtr addSplit(const std::shared_ptr<ModelAPI_Document>& thePart,
const std::list<ModelHighAPI_Selection>& theMainObjects,
const std::list<ModelHighAPI_Selection>& theToolObjects,
- const ModelHighAPI_Double& fuzzyParam = ModelHighAPI_Double(1.e-8),
+ const ModelHighAPI_Double& fuzzyParam = ModelHighAPI_Double(-1),
const bool keepSubResults = false);
#endif // FeaturesAPI_BooleanFill_H_
#include <ModelHighAPI_Selection.h>
#include <ModelHighAPI_Tools.h>
+
+static const double DEFAULT_FUZZY = 1.e-5;
+
+
//==================================================================================================
FeaturesAPI_BooleanFuse::FeaturesAPI_BooleanFuse(
const std::shared_ptr<ModelAPI_Feature>& theFeature)
: 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);
}
: 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);
}
execute();
}
+//==================================================================================================
+void FeaturesAPI_BooleanFuse::setUseFuzzy(bool theUseFuzzy)
+{
+ fillAttribute(theUseFuzzy, myuseFuzzy);
+
+ execute();
+}
+
//==================================================================================================
void FeaturesAPI_BooleanFuse::setFuzzyValue(const ModelHighAPI_Double& theFuzzy)
{
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;
theDumper << ", removeEdges = True";
}
- if (aFuzzy != 1.e-8) {
+ if (aUseFuzzy)
theDumper << ", fuzzyParam = " << aFuzzy;
- }
if (!aBase->data()->version().empty())
theDumper << ", keepSubResults = True";
FeaturesAPI_BooleanFuse(const std::shared_ptr<ModelAPI_Feature>& theFeature,
const std::list<ModelHighAPI_Selection>& 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
const std::list<ModelHighAPI_Selection>& theMainObjects,
const std::list<ModelHighAPI_Selection>& 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(),
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 */)
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);
const std::list<ModelHighAPI_Selection>& objects,
const std::pair<std::list<ModelHighAPI_Selection>, 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_
#include <ModelHighAPI_Selection.h>
#include <ModelHighAPI_Tools.h>
+
+static const double DEFAULT_FUZZY = 1.e-5;
+
+
//==================================================================================================
FeaturesAPI_BooleanSmash::FeaturesAPI_BooleanSmash(
const std::shared_ptr<ModelAPI_Feature>& theFeature)
: 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);
}
execute();
}
+//==================================================================================================
+void FeaturesAPI_BooleanSmash::setUseFuzzy(bool theUseFuzzy)
+{
+ fillAttribute(theUseFuzzy, myuseFuzzy);
+
+ execute();
+}
+
//==================================================================================================
void FeaturesAPI_BooleanSmash::setFuzzyValue(const ModelHighAPI_Double& theFuzzy)
{
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";
FeaturesAPI_BooleanSmash(const std::shared_ptr<ModelAPI_Feature>& theFeature,
const std::list<ModelHighAPI_Selection>& theMainObjects,
const std::list<ModelHighAPI_Selection>& 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 */)
FEATURESAPI_EXPORT
void setToolObjects(const std::list<ModelHighAPI_Selection>& theToolObjects);
+ /// Set use fuzzy parameter.
+ FEATURESAPI_EXPORT
+ void setUseFuzzy(bool theUseFuzzy);
+
/// Set fuzzy parameter.
FEATURESAPI_EXPORT
void setFuzzyValue(const ModelHighAPI_Double& theFuzzy);
BooleanSmashPtr addSmash(const std::shared_ptr<ModelAPI_Document>& thePart,
const std::list<ModelHighAPI_Selection>& theMainObjects,
const std::list<ModelHighAPI_Selection>& theToolObjects,
- const ModelHighAPI_Double& fuzzyParam = ModelHighAPI_Double(1.e-8),
+ const ModelHighAPI_Double& fuzzyParam = ModelHighAPI_Double(-1),
const bool keepSubResults = false);
#endif // FeaturesAPI_BooleanSmash_H_
#include <ModelHighAPI_Dumper.h>
#include <ModelHighAPI_Tools.h>
+
+static const double DEFAULT_FUZZY = 1.e-5;
+
+
//==================================================================================================
FeaturesAPI_Intersection::FeaturesAPI_Intersection(
const std::shared_ptr<ModelAPI_Feature>& theFeature)
: 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();
}
execute();
}
+//==================================================================================================
+void FeaturesAPI_Intersection::setUseFuzzy(bool theUseFuzzy)
+{
+ fillAttribute(theUseFuzzy, myuseFuzzy);
+
+ execute();
+}
+
//==================================================================================================
void FeaturesAPI_Intersection::setFuzzyValue(const ModelHighAPI_Double& theFuzzy)
{
AttributeSelectionListPtr anAttrObjects =
aBase->selectionList(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";
FEATURESAPI_EXPORT
explicit FeaturesAPI_Intersection(const std::shared_ptr<ModelAPI_Feature>& theFeature,
const std::list<ModelHighAPI_Selection>& 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 */)
FEATURESAPI_EXPORT
void setObjects(const std::list<ModelHighAPI_Selection>& theObjects);
+ /// Set use fuzzy parameter.
+ FEATURESAPI_EXPORT
+ void setUseFuzzy(bool theUseFuzzy);
+
/// Set fuzzy parameter.
FEATURESAPI_EXPORT
void setFuzzyValue(const ModelHighAPI_Double& theFuzzy);
FEATURESAPI_EXPORT
IntersectionPtr addIntersection(const std::shared_ptr<ModelAPI_Document>& part,
const std::list<ModelHighAPI_Selection>& 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_
#include <ModelHighAPI_Dumper.h>
#include <ModelHighAPI_Tools.h>
+
+static const double DEFAULT_FUZZY = 1.e-5;
+
+
//==================================================================================================
FeaturesAPI_Partition::FeaturesAPI_Partition(const std::shared_ptr<ModelAPI_Feature>& theFeature)
: ModelHighAPI_Interface(theFeature)
: 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();
}
}
execute();
}
+//==================================================================================================
+void FeaturesAPI_Partition::setUseFuzzy(bool theUseFuzzy)
+{
+ fillAttribute(theUseFuzzy, myuseFuzzy);
+
+ execute();
+}
+
//==================================================================================================
void FeaturesAPI_Partition::setFuzzy(const ModelHighAPI_Double& theFuzzy)
{
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";
FEATURESAPI_EXPORT
explicit FeaturesAPI_Partition(const std::shared_ptr<ModelAPI_Feature>& theFeature,
const std::list<ModelHighAPI_Selection>& 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 */)
FEATURESAPI_EXPORT
void setBase(const std::list<ModelHighAPI_Selection>& 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);
FEATURESAPI_EXPORT
PartitionPtr addPartition(const std::shared_ptr<ModelAPI_Document>& thePart,
const std::list<ModelHighAPI_Selection>& 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_
#include <ModelHighAPI_Dumper.h>
#include <ModelHighAPI_Tools.h>
+
+static const double DEFAULT_FUZZY = 1.e-5;
+
+
//================================================================================================
FeaturesAPI_Union::FeaturesAPI_Union(const std::shared_ptr<ModelAPI_Feature>& theFeature)
: ModelHighAPI_Interface(theFeature)
: 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();
}
execute();
}
+//==================================================================================================
+void FeaturesAPI_Union::setUseFuzzy(bool theUseFuzzy)
+{
+ fillAttribute(theUseFuzzy, myuseFuzzy);
+
+ execute();
+}
+
//==================================================================================================
void FeaturesAPI_Union::setFuzzyValue(const ModelHighAPI_Double& theFuzzy)
{
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";
FEATURESAPI_EXPORT
explicit FeaturesAPI_Union(const std::shared_ptr<ModelAPI_Feature>& theFeature,
const std::list<ModelHighAPI_Selection>& 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 */)
FEATURESAPI_EXPORT
void setBase(const std::list<ModelHighAPI_Selection>& theBaseObjects);
+ /// Set use fuzzy parameter.
+ FEATURESAPI_EXPORT
+ void setUseFuzzy(bool theUseFuzzy);
+
/// Set fuzzy parameter.
FEATURESAPI_EXPORT
void setFuzzyValue(const ModelHighAPI_Double& theFuzzy);
FEATURESAPI_EXPORT
UnionPtr addUnion(const std::shared_ptr<ModelAPI_Document>& thePart,
const std::list<ModelHighAPI_Selection>& 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_
#include <ModelAPI_Data.h>
#include <ModelAPI_Document.h>
+#include <ModelAPI_AttributeBoolean.h>
#include <ModelAPI_AttributeDouble.h>
#include <ModelAPI_AttributeReference.h>
#include <ModelAPI_AttributeInteger.h>
#include <algorithm>
#include <map>
+
+static const double DEFAULT_FUZZY = 1.e-5;
+
+
//=================================================================================================
FeaturesPlugin_Boolean::FeaturesPlugin_Boolean(const OperationType theOperationType)
: myOperationType(theOperationType)
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());
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()
{
#include "FeaturesPlugin_BooleanCommon.h"
#include <ModelAPI_ResultBody.h>
+#include <ModelAPI_AttributeBoolean.h>
#include <ModelAPI_AttributeDouble.h>
#include <ModelAPI_AttributeInteger.h>
#include <ModelAPI_AttributeSelectionList.h>
#include <GeomAlgoAPI_Tools.h>
+static const double DEFAULT_FUZZY = 1.e-5;
+
+
//==================================================================================================
FeaturesPlugin_BooleanCommon::FeaturesPlugin_BooleanCommon()
: FeaturesPlugin_Boolean(FeaturesPlugin_Boolean::BOOL_COMMON)
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()));
}
// 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();
#include "FeaturesPlugin_BooleanCut.h"
#include <ModelAPI_ResultBody.h>
+#include <ModelAPI_AttributeBoolean.h>
#include <ModelAPI_AttributeDouble.h>
#include <ModelAPI_AttributeSelectionList.h>
#include <ModelAPI_Tools.h>
// 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;
#include "FeaturesPlugin_BooleanFill.h"
#include <ModelAPI_ResultBody.h>
+#include <ModelAPI_AttributeBoolean.h>
#include <ModelAPI_AttributeDouble.h>
#include <ModelAPI_AttributeSelectionList.h>
#include <ModelAPI_Tools.h>
// 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;
#include <GeomAPI_ShapeIterator.h>
+static const double DEFAULT_FUZZY = 1.e-5;
+
+
//==================================================================================================
static void explodeCompound(const GeomShapePtr& theShape, ListOfShape& theResult)
{
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());
// 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();
#include "FeaturesPlugin_BooleanSmash.h"
#include <ModelAPI_ResultBody.h>
+#include <ModelAPI_AttributeBoolean.h>
#include <ModelAPI_AttributeDouble.h>
#include <ModelAPI_AttributeSelectionList.h>
#include <ModelAPI_Tools.h>
#include <GeomAPI_ShapeIterator.h>
+static const double DEFAULT_FUZZY = 1.e-5;
+
+
//==================================================================================================
FeaturesPlugin_BooleanSmash::FeaturesPlugin_BooleanSmash()
: FeaturesPlugin_Boolean(FeaturesPlugin_Boolean::BOOL_SMASH)
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()));
}
// 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<GeomAlgoAPI_MakeShapeList> aMakeShapeList(new GeomAlgoAPI_MakeShapeList());
if (!aShapesToAdd.empty()) {
#include <ModelAPI_Document.h>
#include <ModelAPI_BodyBuilder.h>
#include <ModelAPI_ResultBody.h>
+#include <ModelAPI_AttributeBoolean.h>
#include <ModelAPI_AttributeDouble.h>
#include <ModelAPI_AttributeSelectionList.h>
#include <ModelAPI_Tools.h>
static const std::string INTERSECTION_VERSION_1("v9.5");
+static const double DEFAULT_FUZZY = 1.e-5;
+
//=================================================================================================
FeaturesPlugin_Intersection::FeaturesPlugin_Intersection()
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());
}
// 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;
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()
{
#include <sstream>
+static const double DEFAULT_FUZZY = 1.e-5;
+
+
//=================================================================================================
FeaturesPlugin_Partition::FeaturesPlugin_Partition()
{
{
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()));
}
// 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());
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()
{
#include <GeomAPI_ShapeExplorer.h>
#include <GeomAPI_ShapeIterator.h>
+#include <ModelAPI_AttributeBoolean.h>>
#include <ModelAPI_AttributeDouble.h>
#include <ModelAPI_AttributeSelectionList.h>
#include <ModelAPI_ResultBody.h>
#include <ModelAPI_Tools.h>
+static const double DEFAULT_FUZZY = 1.e-5;
+
+
//=================================================================================================
FeaturesPlugin_Union::FeaturesPlugin_Union()
{
{
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()));
}
// 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;
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()
{
</multi_selector>
</box>
</toolbox>
- <groupbox>
+ <optionalbox id="use_fuzzy">
<doublevalue id="fuzzy_param"
label="Fuzzy parameter"
tooltip="Additional tolerance to eliminate tiny result."
min="1.e-7"
max="10"
- step="1.e-7"
- default="1.e-7">
+ step="1.e-5"
+ default="1.e-5">
<validator id="GeomValidators_Positive"/>
</doublevalue>
- </groupbox>
+ </optionalbox>
<validator id="FeaturesPlugin_ValidatorBooleanCommonArguments"
parameters="main_objects,tool_objects"/>
</source>
</multi_selector>
</box>
</toolbox>
- <groupbox>
+ <optionalbox id="use_fuzzy">
<doublevalue id="fuzzy_param"
label="Fuzzy parameter"
tooltip="Additional tolerance to eliminate tiny result."
min="1.e-7"
max="10"
- step="1.e-7"
- default="1.e-7">
+ step="1.e-5"
+ default="1.e-5">
<validator id="GeomValidators_Positive"/>
</doublevalue>
- </groupbox>
+ </optionalbox>
<boolvalue id="remove_intersection_edges"
label="Remove intersection edges"
tooltip="Remove intersection edges if they laying on the same surface"
<validator id="PartSet_DifferentObjects"/>
<validator id="FeaturesPlugin_ValidatorBooleanSmashSelection"/>
</multi_selector>
- <groupbox>
+ <optionalbox id="use_fuzzy">
<doublevalue id="fuzzy_param"
label="Fuzzy parameter"
tooltip="Additional tolerance to eliminate tiny result."
min="1.e-7"
max="10"
- step="1.e-7"
- default="1.e-7">
+ step="1.e-5"
+ default="1.e-5">
<validator id="GeomValidators_Positive"/>
</doublevalue>
- </groupbox>
+ </optionalbox>
<validator id="FeaturesPlugin_ValidatorBooleanArguments" parameters="main_objects,tool_objects"/>
</source>
<validator id="PartSet_DifferentObjects"/>
<validator id="FeaturesPlugin_ValidatorBooleanSelection"/>
</multi_selector>
- <groupbox>
+ <optionalbox id="use_fuzzy">
<doublevalue id="fuzzy_param"
label="Fuzzy parameter"
tooltip="Additional tolerance to eliminate tiny result."
min="1.e-7"
max="10"
- step="1.e-7"
- default="1.e-7">
+ step="1.e-5"
+ default="1.e-5">
<validator id="GeomValidators_Positive"/>
</doublevalue>
- </groupbox>
+ </optionalbox>
<validator id="FeaturesPlugin_ValidatorBooleanArguments" parameters="main_objects,tool_objects"/>
</source>
<validator id="PartSet_DifferentObjects"/>
<validator id="FeaturesPlugin_ValidatorBooleanSelection"/>
</multi_selector>
- <groupbox>
+ <optionalbox id="use_fuzzy">
<doublevalue id="fuzzy_param"
label="Fuzzy parameter"
tooltip="Additional tolerance to eliminate tiny result."
default="1.e-5">
<validator id="GeomValidators_Positive"/>
</doublevalue>
- </groupbox>
+ </optionalbox>
<validator id="FeaturesPlugin_ValidatorBooleanArguments" parameters="main_objects,tool_objects"/>
<validator id="GeomValidators_NotSelfIntersected" parameters="main_objects,tool_objects"/>
</source>
| :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.
<validator id="PartSet_DifferentObjects"/>
<validator id="FeaturesPlugin_IntersectionSelection"/>
</multi_selector>
- <groupbox>
+ <optionalbox id="use_fuzzy">
<doublevalue id="fuzzy_param"
label="Fuzzy parameter"
tooltip="Additional tolerance to eliminate tiny result."
min="1.e-7"
max="10"
- step="1.e-7"
- default="1.e-7">
+ step="1.e-5"
+ default="1.e-5">
<validator id="GeomValidators_Positive"/>
</doublevalue>
- </groupbox>
+ </optionalbox>
</source>
clear_in_neutral_point="false">
<validator id="FeaturesPlugin_ValidatorPartitionSelection" parameters="Plane"/>
</multi_selector>
- <groupbox>
+ <optionalbox id="use_fuzzy">
<doublevalue id="fuzzy_param"
label="Fuzzy parameter"
tooltip="Additional tolerance to eliminate tiny result."
min="1.e-7"
max="10"
- step="1.e-7"
- default="1.e-7">
+ step="1.e-5"
+ default="1.e-5">
<validator id="GeomValidators_Positive"/>
</doublevalue>
- </groupbox>
+ </optionalbox>
<validator id="GeomValidators_MinObjectsSelected" parameters="base_objects,1"/>
</source>
concealment="true">
<validator id="FeaturesPlugin_ValidatorUnionSelection"/>
</multi_selector>
- <groupbox>
+ <optionalbox id="use_fuzzy">
<doublevalue id="fuzzy_param"
label="Fuzzy parameter"
tooltip="Additional tolerance to eliminate tiny result."
min="1.e-7"
max="10"
- step="1.e-7"
- default="1.e-7">
+ step="1.e-5"
+ default="1.e-5">
<validator id="GeomValidators_Positive"/>
</doublevalue>
- </groupbox>
+ </optionalbox>
<validator id="GeomValidators_MinObjectsSelected" parameters="base_objects,2"/>
<validator id="FeaturesPlugin_ValidatorUnionArguments"/>
</source>
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);
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);
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);
}
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.
/// \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.
/// \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,
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,
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;
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();
}
}
aPaveFiller->SetArguments(aListOfShape);
- if (theFuzzy >= 1.e-7) aPaveFiller->SetFuzzyValue(theFuzzy);
+ if (theFuzzy > 0) aPaveFiller->SetFuzzyValue(theFuzzy);
aPaveFiller->Perform();
if (aPaveFiller->HasErrors())
return;
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;