diff --git a/src/Mod/Part/App/FeaturePartCommon.cpp b/src/Mod/Part/App/FeaturePartCommon.cpp index 9832b8925c..2a4fbb9778 100644 --- a/src/Mod/Part/App/FeaturePartCommon.cpp +++ b/src/Mod/Part/App/FeaturePartCommon.cpp @@ -80,6 +80,7 @@ short MultiCommon::mustExecute() const App::DocumentObjectExecReturn *MultiCommon::execute() { +#ifndef FC_USE_TNP_FIX std::vector s; std::vector obj = Shapes.getValues(); @@ -194,4 +195,39 @@ App::DocumentObjectExecReturn *MultiCommon::execute() } return App::DocumentObject::StdReturn; +#else + std::vector 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 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 }