work on #17497 - recursively cut shapes in a compound iindividually to work around OCCT limitation

This commit is contained in:
Eric Price
2024-10-27 20:53:28 +01:00
parent 6f8abe880c
commit 27c9c9d0ac
2 changed files with 39 additions and 0 deletions

View File

@@ -30,7 +30,9 @@
#include <BRepBndLib.hxx>
#include <Bnd_Box.hxx>
#include <BRepCheck_Analyzer.hxx>
#include <BRep_Builder.hxx>
#include <TopoDS_Shape.hxx>
#include <TopoDS_Iterator.hxx>
#include <Precision.hxx>
#include <FuzzyHelper.h>
@@ -78,3 +80,33 @@ void FCBRepAlgoAPIHelper::setAutoFuzzy(BRepAlgoAPI_BuilderAlgo* op) {
BRepBndLib::Add(it.Value(), bounds);
op->SetFuzzyValue(Part::FuzzyHelper::getBooleanFuzzy() * sqrt(bounds.SquareExtent()) * Precision::Confusion());
}
void FCBRepAlgoAPI_BooleanOperation::Build(const Message_ProgressRange& theRange) {
if (myOperation==BOPAlgo_CUT && myArguments.Size()==1 && myArguments.First().ShapeType() == TopAbs_COMPOUND) {
myOriginalArguments = myArguments;
myShape = RecursiveCutCompound(myOriginalArguments.First(), theRange);
} else {
return BRepAlgoAPI_BooleanOperation::Build(theRange);
}
}
const TopoDS_Shape FCBRepAlgoAPI_BooleanOperation::RecursiveCutCompound(const TopoDS_Shape& theArgument, const Message_ProgressRange& theRange) {
BRep_Builder builder;
TopoDS_Compound comp;
builder.MakeCompound(comp);
TopoDS_Iterator it(theArgument);
for (; it.More(); it.Next()) {
TopTools_ListOfShape currentArguments;
currentArguments.Append(it.Value());
myArguments = currentArguments;
Build(theRange);
if (IsDone()) {
builder.Add(comp, myShape);
} else {
return TopoDS_Shape();
}
}
return comp;
}