From 1e6b2065b56039c9c977ca3d029ab81d3a2e7680 Mon Sep 17 00:00:00 2001 From: jgv Date: Fri, 10 Sep 2021 19:30:38 +0300 Subject: [PATCH] 0032561: Modelling Algorithms - UnifySameDomain does nothing while it is expected to union two pairs of faces Correct method ShapeUpgrade_UnifySameDomain::UnifyFaces: when creating the Edge-Face map of initial shape, count each face only once. --- .../ShapeUpgrade_UnifySameDomain.cxx | 6 +++++- tests/boolean/removefeatures/C5 | 4 ++-- tests/bugs/heal/bug32561 | 18 ++++++++++++++++++ 3 files changed, 25 insertions(+), 3 deletions(-) create mode 100644 tests/bugs/heal/bug32561 diff --git a/src/ShapeUpgrade/ShapeUpgrade_UnifySameDomain.cxx b/src/ShapeUpgrade/ShapeUpgrade_UnifySameDomain.cxx index 458d79b2aa..6b883e3149 100644 --- a/src/ShapeUpgrade/ShapeUpgrade_UnifySameDomain.cxx +++ b/src/ShapeUpgrade/ShapeUpgrade_UnifySameDomain.cxx @@ -2573,7 +2573,11 @@ void ShapeUpgrade_UnifySameDomain::UnifyFaces() { // creating map of edge faces for the whole shape TopTools_IndexedDataMapOfShapeListOfShape aGMapEdgeFaces; - TopExp::MapShapesAndAncestors(myShape, TopAbs_EDGE, TopAbs_FACE, aGMapEdgeFaces); + + TopTools_IndexedMapOfShape aFaceMap; + TopExp::MapShapes (myShape, TopAbs_FACE, aFaceMap); + for (Standard_Integer i = 1; i <= aFaceMap.Extent(); i++) + TopExp::MapShapesAndAncestors (aFaceMap(i), TopAbs_EDGE, TopAbs_FACE, aGMapEdgeFaces); // unify faces in each shell separately TopExp_Explorer exps; diff --git a/tests/boolean/removefeatures/C5 b/tests/boolean/removefeatures/C5 index fe32e78e5d..4d393e4936 100644 --- a/tests/boolean/removefeatures/C5 +++ b/tests/boolean/removefeatures/C5 @@ -8,7 +8,7 @@ compound s_11 s_12 s_17 gap2 removefeatures res1 s gap1 checkshape res1 checkprops res1 -s 1200 -v 1875 -checknbshapes res1 -vertex 21 -edge 35 -wire 17 -face 17 -shell 2 -solid 2 +checknbshapes res1 -vertex 19 -edge 31 -wire 15 -face 15 -shell 2 -solid 2 CheckIsFeatureRemoved gap1 {e f} # check that the common face is still shared @@ -32,7 +32,7 @@ checkprops m1 -s 600 -v 1000 removefeatures res2 s gap2 checkshape res2 checkprops res2 -s 1200 -v 1875 -checknbshapes res2 -vertex 21 -edge 35 -wire 17 -face 17 -shell 2 -solid 2 +checknbshapes res2 -vertex 19 -edge 31 -wire 15 -face 15 -shell 2 -solid 2 CheckIsFeatureRemoved gap2 {e f} # get history of the operation diff --git a/tests/bugs/heal/bug32561 b/tests/bugs/heal/bug32561 new file mode 100644 index 0000000000..5b9ab8423a --- /dev/null +++ b/tests/bugs/heal/bug32561 @@ -0,0 +1,18 @@ +puts "=======================================================================================" +puts "OCC32561: UnifySameDomain does nothing while it is expected to union two pairs of faces" +puts "=======================================================================================" +puts "" + +restore [locate_data_file bug32561.brep] a + +unifysamedom result a + +checkshape result + +checknbshapes result -t -solid 64 -shell 64 -face 233 -wire 233 -edge 284 -vertex 116 + +set tolres [checkmaxtol result] + +if { ${tolres} > 2.e-7} { + puts "Error: bad tolerance of result" +} -- 2.20.1