Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Example of concurrent use of BRepAlgo_Section
const double zStep = 20.;
const TopoDS_Shape shape;// Assign some shape here
std::vector<std::future<void>> vecFuture;
for (double z = zmin; z < zmax; z += zStep) {
auto future = std::async([=]{
constexpr bool flagPerformNow = true;
const gp_Pln plane(gp_Ax3(gp_Pnt(0, 0, z), gp_Dir(0, 0, 1)));
BRepAlgo_Section algoSection(shape, plane, !flagPerformNow);
algoSection.Approximation(true);
algoSection.Build();
if (algoSection.IsDone()) {
// Do someting with algoSection.Shape() ...
}
});
vecFuture.push_back(std::move(future));
}
for (auto& future : vecFuture)
future.wait();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment