From f0982d1d61a3c1c08a9482cb6e4632ee1520eba2 Mon Sep 17 00:00:00 2001 From: bgbsww <120601209+bgbsww@users.noreply.github.com> Date: Sun, 18 Aug 2024 12:49:05 -0400 Subject: [PATCH] =?UTF-8?q?Toponaming:=20=20Fuse=20call=20makeElementRefin?= =?UTF-8?q?e;=20remove=20deprecated=20refineSha=E2=80=A6=20(#15897)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * Toponaming: Fuse call makeElementRefine; remove deprecated refineShapeIfActive * Part/Toponaming: import code for MultiFuse::execute() from LS3 * added expected values of testRefine Co-authored-by: Zheng, Lei Co-authored-by: CalligaroV Co-authored-by: Chris Hennes --- src/Mod/Part/App/FeaturePartFuse.cpp | 9 +-------- src/Mod/PartDesign/App/FeatureTransformed.cpp | 20 ------------------- tests/src/Mod/Part/App/FeaturePartFuse.cpp | 12 +++++++++++ 3 files changed, 13 insertions(+), 28 deletions(-) diff --git a/src/Mod/Part/App/FeaturePartFuse.cpp b/src/Mod/Part/App/FeaturePartFuse.cpp index 18c1e71d7d..e2ec36028c 100644 --- a/src/Mod/Part/App/FeaturePartFuse.cpp +++ b/src/Mod/Part/App/FeaturePartFuse.cpp @@ -276,14 +276,7 @@ App::DocumentObjectExecReturn *MultiFuse::execute() } if (this->Refine.getValue()) { try { - TopoDS_Shape oldShape = res.getShape(); - BRepBuilderAPI_RefineModel mkRefine(oldShape); - res.setShape(mkRefine.Shape()); - ShapeHistory hist = - buildHistory(mkRefine, TopAbs_FACE, res.getShape(), oldShape); - for (auto& jt : history) { - jt = joinHistory(jt, hist); - } + res = res.makeElementRefine(); } catch (Standard_Failure&) { // do nothing diff --git a/src/Mod/PartDesign/App/FeatureTransformed.cpp b/src/Mod/PartDesign/App/FeatureTransformed.cpp index 027ae802f6..43f4d88a7d 100644 --- a/src/Mod/PartDesign/App/FeatureTransformed.cpp +++ b/src/Mod/PartDesign/App/FeatureTransformed.cpp @@ -374,26 +374,6 @@ TopoShape Transformed::refineShapeIfActive(const TopoShape& oldShape) const return oldShape; } -// Deprecated, prefer the TopoShape method -TopoDS_Shape Transformed::refineShapeIfActive(const TopoDS_Shape& oldShape) const -{ - if (this->Refine.getValue()) { - try { - Part::BRepBuilderAPI_RefineModel mkRefine(oldShape); - TopoDS_Shape resShape = mkRefine.Shape(); - if (!TopoShape(resShape).isClosed()) { - return oldShape; - } - return resShape; - } - catch (Standard_Failure&) { - return oldShape; - } - } - - return oldShape; -} - TopoDS_Shape Transformed::getRemainingSolids(const TopoDS_Shape& shape) { BRep_Builder builder; diff --git a/tests/src/Mod/Part/App/FeaturePartFuse.cpp b/tests/src/Mod/Part/App/FeaturePartFuse.cpp index 49f0e365f1..9fd70ebec3 100644 --- a/tests/src/Mod/Part/App/FeaturePartFuse.cpp +++ b/tests/src/Mod/Part/App/FeaturePartFuse.cpp @@ -187,6 +187,12 @@ TEST_F(FeaturePartFuseTest, testRefine) ts.getSubTopoShapes(TopAbs_FACE); // TopAbs_WIRE alternate approach // Assert two boxes, plus redundant faces at the joint. EXPECT_EQ(subs.size(), 14); + // 14 Faces + // 28 Edges + // 16 Vertices + // ----------- + // 58 Elements + EXPECT_EQ(_fuse->Shape.getShape().getElementMapSize(), 58); // Act _fuse->Refine.setValue(true); _fuse->execute(); @@ -194,6 +200,12 @@ TEST_F(FeaturePartFuseTest, testRefine) subs = ts.getSubTopoShapes(TopAbs_FACE); // Assert we now just have one big box EXPECT_EQ(subs.size(), 6); + // 6 Faces + // 12 Edges + // 8 Vertices + // ----------- + // 58 Elements + EXPECT_EQ(_fuse->Shape.getShape().getElementMapSize(), 26); } // See FeaturePartCommon.cpp for a history test. It would be exactly the same and redundant here.