From d815ac9341f4dcfe399874a3e30deb7af37722a9 Mon Sep 17 00:00:00 2001 From: bgbsww Date: Thu, 8 Feb 2024 13:57:16 -0500 Subject: [PATCH] Toponaming/Part: Clean up code --- src/Mod/Part/App/FeaturePartFuse.cpp | 38 ++++++++++++++++++---------- 1 file changed, 24 insertions(+), 14 deletions(-) diff --git a/src/Mod/Part/App/FeaturePartFuse.cpp b/src/Mod/Part/App/FeaturePartFuse.cpp index 874a1b0c1b..cec34e5b87 100644 --- a/src/Mod/Part/App/FeaturePartFuse.cpp +++ b/src/Mod/Part/App/FeaturePartFuse.cpp @@ -31,11 +31,14 @@ #endif #include +#include #include #include "FeaturePartFuse.h" +#include "TopoShapeOpCode.h" #include "modelRefine.h" +FC_LOG_LEVEL_INIT("Part",true,true); using namespace Part; @@ -194,37 +197,44 @@ App::DocumentObjectExecReturn *MultiFuse::execute() return App::DocumentObject::StdReturn; #else - std::vector shapes; - for(auto obj : Shapes.getValues()) { + for (auto obj : Shapes.getValues()) { TopoShape sh = Feature::getTopoShape(obj); - if(sh.isNull()) + if (sh.isNull()) { return new App::DocumentObjectExecReturn("Input shape is null"); - if(!sh.hasSubShape(TopAbs_SOLID)) { - if(FC_LOG_INSTANCE.isEnabled(FC_LOGLEVEL_LOG)) + } + if (!sh.hasSubShape(TopAbs_SOLID)) { + if (FC_LOG_INSTANCE.isEnabled(FC_LOGLEVEL_LOG)) { FC_WARN("fusion of non solid: " << obj->getFullName()); - else + } + else { FC_MSG("fusion of non solid: " << obj->getFullName()); + } } shapes.push_back(sh); } - TopoShape res(0,getDocument()->getStringHasher()); - res.makEBoolean(Part::OpCodes::Fuse,shapes); - if (res.isNull()) + TopoShape res(0); + res.makeElementBoolean(Part::OpCodes::Fuse, 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"); + 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() ) { + if (!aChecker.IsValid()) { return new App::DocumentObjectExecReturn("Resulting shape is invalid"); } } - if (this->Refine.getValue()) - res = res.makERefine(); + if (this->Refine.getValue()) { + res = res.makeElementRefine(); + } this->Shape.setValue(res); return Part::Feature::execute(); #endif