diff --git a/src/Mod/Part/App/TopoShape.cpp b/src/Mod/Part/App/TopoShape.cpp index 86e50b98e..490ba3c78 100644 --- a/src/Mod/Part/App/TopoShape.cpp +++ b/src/Mod/Part/App/TopoShape.cpp @@ -1771,17 +1771,24 @@ TopoDS_Shape TopoShape::removeSplitter() const Standard_Failure::Raise("Cannot remove splitter from empty shape"); if (_Shape.ShapeType() == TopAbs_SOLID) { - const TopoDS_Solid& solid = TopoDS::Solid(_Shape); - ModelRefine::FaceUniter uniter(solid); - if (uniter.process()) { - TopoDS_Solid solidMod; - if (!uniter.getSolid(solidMod)) - Standard_Failure::Raise("Getting solid failed"); - return solidMod; - } - else { - Standard_Failure::Raise("Removing splitter failed"); + const TopoDS_Solid &solid = TopoDS::Solid(_Shape); + BRepTools_ReShape reshape; + TopExp_Explorer it; + for (it.Init(solid, TopAbs_SHELL); it.More(); it.Next()) { + const TopoDS_Shell ¤tShell = TopoDS::Shell(it.Current()); + ModelRefine::FaceUniter uniter(currentShell); + if (uniter.process()) { + if (uniter.isModified()) { + const TopoDS_Shell &newShell = uniter.getShell(); + reshape.Replace(currentShell, newShell); + } + } + else { + Standard_Failure::Raise("Removing splitter failed"); + return _Shape; + } } + return reshape.Apply(solid); } else if (_Shape.ShapeType() == TopAbs_SHELL) { const TopoDS_Shell& shell = TopoDS::Shell(_Shape); @@ -1801,13 +1808,20 @@ TopoDS_Shape TopoShape::removeSplitter() const TopExp_Explorer xp; // solids for (xp.Init(_Shape, TopAbs_SOLID); xp.More(); xp.Next()) { - const TopoDS_Solid& solid = TopoDS::Solid(xp.Current()); - ModelRefine::FaceUniter uniter(solid); - if (uniter.process()) { - TopoDS_Solid solidMod; - if (uniter.getSolid(solidMod)) - builder.Add(comp, solidMod); + const TopoDS_Solid &solid = TopoDS::Solid(xp.Current()); + BRepTools_ReShape reshape; + TopExp_Explorer it; + for (it.Init(solid, TopAbs_SHELL); it.More(); it.Next()) { + const TopoDS_Shell ¤tShell = TopoDS::Shell(it.Current()); + ModelRefine::FaceUniter uniter(currentShell); + if (uniter.process()) { + if (uniter.isModified()) { + const TopoDS_Shell &newShell = uniter.getShell(); + reshape.Replace(currentShell, newShell); + } + } } + builder.Add(comp, reshape.Apply(solid)); } // free shells for (xp.Init(_Shape, TopAbs_SHELL, TopAbs_SOLID); xp.More(); xp.Next()) { diff --git a/src/Mod/Part/App/modelRefine.cpp b/src/Mod/Part/App/modelRefine.cpp index 72b6c6486..1b66050c2 100644 --- a/src/Mod/Part/App/modelRefine.cpp +++ b/src/Mod/Part/App/modelRefine.cpp @@ -436,19 +436,11 @@ FaceTypedCylinder& ModelRefine::getCylinderObject() ///////////////////////////////////////////////////////////////////////////////////////////////////////// -FaceUniter::FaceUniter(const TopoDS_Shell &shellIn) +FaceUniter::FaceUniter(const TopoDS_Shell &shellIn) : modifiedSignal(false) { workShell = shellIn; } -FaceUniter::FaceUniter(const TopoDS_Solid &solidIn) -{ - //get first shell - TopExp_Explorer it; - it.Init(solidIn, TopAbs_SHELL); - workShell = TopoDS::Shell(it.Current()); -} - bool FaceUniter::process() { if (workShell.IsNull()) @@ -495,6 +487,7 @@ bool FaceUniter::process() } if (facesToSew.size() > 0) { + modifiedSignal = true; workShell = ModelRefine::removeFaces(workShell, facesToRemove); TopExp_Explorer xp; bool emptyShell = true; @@ -537,11 +530,3 @@ bool FaceUniter::process() } return true; } - -bool FaceUniter::getSolid(TopoDS_Solid &outSolid) const -{ - BRepBuilderAPI_MakeSolid solidMaker; - solidMaker.Add(workShell); - outSolid = solidMaker.Solid(); - return solidMaker.IsDone() ? true : false; -} diff --git a/src/Mod/Part/App/modelRefine.h b/src/Mod/Part/App/modelRefine.h index 1f51b8ded..c008b3053 100644 --- a/src/Mod/Part/App/modelRefine.h +++ b/src/Mod/Part/App/modelRefine.h @@ -151,14 +151,14 @@ namespace ModelRefine FaceUniter(){} public: FaceUniter(const TopoDS_Shell &shellIn); - FaceUniter(const TopoDS_Solid &solidIn);//get first shell bool process(); const TopoDS_Shell& getShell() const {return workShell;} - bool getSolid(TopoDS_Solid &outSolid) const;//tries to make solid from shell. + bool isModified(){return modifiedSignal;} private: TopoDS_Shell workShell; std::vector typeObjects; + bool modifiedSignal; }; }