Correct method ShapeUpgrade_UnifySameDomain::UnifyFaces: when creating the Edge-Face map of initial shape, count each face only once.
{
// 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;
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
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
--- /dev/null
+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"
+}