-// Copyright (C) 2014-2021 CEA/DEN, EDF R&D
+// Copyright (C) 2014-2023 CEA, EDF
//
// This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Lesser General Public
#include "FeaturesPlugin_BooleanFill.h"
#include <ModelAPI_ResultBody.h>
+#include <ModelAPI_AttributeBoolean.h>
+#include <ModelAPI_AttributeDouble.h>
#include <ModelAPI_AttributeSelectionList.h>
#include <ModelAPI_Tools.h>
#include <algorithm>
#include <map>
+
//=================================================================================================
FeaturesPlugin_BooleanFill::FeaturesPlugin_BooleanFill()
: FeaturesPlugin_Boolean(FeaturesPlugin_Boolean::BOOL_FILL)
keepUnusedSubsOfCompound(GeomShapePtr(), anObjects, aTools, aMakeShapeList);
}
+ // Getting fuzzy parameter.
+ // Used as additional tolerance to eliminate tiny results.
+ // 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;
for (GeomAPI_ShapeHierarchy::iterator anObjectsIt = anObjects.begin();
// compsolid handling
isOk = processCompsolid(GeomAlgoAPI_Tools::BOOL_PARTITION,
anObjects, aParent, aTools.objects(), aPlanes,
+ aFuzzy,
aResultIndex, aResultBaseAlgoList, aResultShapesList,
aResultCompound);
} else {
// process object as is
isOk = processObject(GeomAlgoAPI_Tools::BOOL_PARTITION,
anObject, aTools.objects(), aPlanes,
+ aFuzzy,
aResultIndex, aResultBaseAlgoList, aResultShapesList,
aResultCompound);
}
if (!aResultCompound)
aResultCompound = GeomAlgoAPI_CompoundBuilder::compound(aResultShapesList);
ModelAPI_Tools::loadDeletedShapes(aResultBaseAlgoList,
- aTools.objects(),
- aResultCompound);
+ aTools.objects(),
+ aResultCompound);
// remove the rest results if there were produced in the previous pass
removeResults(aResultIndex);