Commit e4fdc870 authored by Dennis Gläser's avatar Dennis Gläser
Browse files

[occ][brep] add convenience function for fuse

parent 4a8eb499
......@@ -55,6 +55,7 @@
// Algorithm for boolean operations on shapes
#include <BRepAlgoAPI_BuilderAlgo.hxx>
#include <BRepAlgoAPI_Fuse.hxx>
#include <BRepAlgoAPI_Common.hxx>
#include <BRepAlgoAPI_Cut.hxx>
......@@ -365,11 +366,31 @@ namespace OCCUtilities {
fragments.SetFuzzyValue(eps);
fragments.Build();
if (!fragments.IsDone())
throw std::runtime_error(std::string("Could not perform segment fragmentation"));
throw std::runtime_error(std::string("Could not perform fragmentation"));
return fragments.Shape();
}
//! Convenience function to get the shape resulting from the union of a set of objects
template<class ctype>
TopoDS_Shape fuse(const std::vector<TopoDS_Shape>& objects, ctype eps)
{
TopTools_ListOfShape shapes;
for (const auto& shape : objects)
shapes.Append(shape);
BRepAlgoAPI_Fuse fuse;
fuse.SetRunParallel(false);
fuse.SetArguments(shapes);
fuse.SetTools(shapes);
fuse.SetFuzzyValue(eps);
fuse.Build();
if (!fuse.IsDone())
throw std::runtime_error(std::string("Could not perform union"));
return fuse.Shape();
}
/*!
* \brief Determines the overlap edges between two sets of edges.
* \param edges1 the first set of edges
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment