FeaturePartCommon code move in

This commit is contained in:
Zheng, Lei
2024-01-26 16:40:05 -05:00
committed by Chris Hennes
parent e4e1b0b221
commit 05a7bae6cb

View File

@@ -80,6 +80,7 @@ short MultiCommon::mustExecute() const
App::DocumentObjectExecReturn *MultiCommon::execute()
{
#ifndef FC_USE_TNP_FIX
std::vector<TopoDS_Shape> s;
std::vector<App::DocumentObject*> obj = Shapes.getValues();
@@ -194,4 +195,39 @@ App::DocumentObjectExecReturn *MultiCommon::execute()
}
return App::DocumentObject::StdReturn;
#else
std::vector<TopoShape> shapes;
for (auto obj : Shapes.getValues()) {
TopoShape sh = Feature::getTopoShape(obj);
if (sh.isNull()) {
return new App::DocumentObjectExecReturn("Input shape is null");
}
shapes.push_back(sh);
}
TopoShape res {};
res.makeElementBoolean(Part::OpCodes::Common, shapes);
if (res.isNull()) {
throw Base::RuntimeError("Resulting shape is null");
}
Base::Reference<ParameterGrp> hGrp = App::GetApplication()
.GetUserParameter()
.GetGroup("BaseApp")
->GetGroup("Preferences")
->GetGroup("Mod/Part/Boolean");
if (hGrp->GetBool("CheckModel", false)) {
BRepCheck_Analyzer aChecker(res.getShape());
if (!aChecker.IsValid()) {
return new App::DocumentObjectExecReturn("Resulting shape is invalid");
}
}
if (this->Refine.getValue()) {
res = res.makeElementRefine();
}
this->Shape.setValue(res);
return Part::Feature::execute();
#endif
}