Forum archiveIssue archiveModeling Data and Algorithms

Archived discussion

How to split a solid by some faces?

Modeling Data and AlgorithmsThu, 03/06/2025 - 12:460 replies

Browse this forum
QuestionAuthor

I hope to use some constructed faces to divide the solid into multiple parts. How should I do this? Which interface should I use? Currently, I am using the BOPAlgo_Splitter interface to implement this. In the example below, the result doesn't seem to be normal, and there are many warnings. Could you explain the reasons behind these warnings? This way, I can learn more details about BOP.Thanks. Also,Could you tell me how to display the source code in a code block format? I am sorry.I dont know how to do it.Thanks.

TopoDS_Shape split(const TopoDS_Shape& arg, const std::vector& fs) { BOPAlgo_Splitter aSplitter; aSplitter.SetRunParallel(true);

TopTools_ListOfShape aLSObjects; // Objects
TopTools_ListOfShape aLSTools; // Tools
aLSObjects.Append(arg);
for (auto& face : fs)
    aLSTools.Append(face);
aSplitter.SetArguments(aLSObjects);
aSplitter.SetTools(aLSTools);
aSplitter.Perform();

//if (aSplitter.HasErrors())
//  return TopoDS_Shape();

//if (aSplitter.HasWarnings())
//  DecomposeShape::showBOPWarnings(&aSplitter);

const TopoDS_Shape& aResult = aSplitter.Shape();
return aResult;

}

Discussion

No archived replies

Posts are displayed in their archived order.