TopExp::MapShapes (myShape, TopAbs_FACE, aFaceMap);
for (Standard_Integer i = 1; i <= aFaceMap.Extent(); i++)
TopExp::MapShapesAndAncestors (aFaceMap(i), TopAbs_EDGE, TopAbs_FACE, aGMapEdgeFaces);
+
+ // creating map of free boundaries
+ TopTools_MapOfShape aFreeBoundMap;
+ // look at only shells not belonging to solids
+ TopExp_Explorer anExplo (myShape, TopAbs_SHELL, TopAbs_SOLID);
+ for (; anExplo.More(); anExplo.Next())
+ {
+ const TopoDS_Shape& aShell = anExplo.Current();
+ TopTools_IndexedDataMapOfShapeListOfShape aEFmap;
+ TopExp::MapShapesAndAncestors (aShell, TopAbs_EDGE, TopAbs_FACE, aEFmap);
+ for (Standard_Integer ii = 1; ii <= aEFmap.Extent(); ii++)
+ {
+ const TopoDS_Edge& anEdge = TopoDS::Edge (aEFmap.FindKey(ii));
+ const TopTools_ListOfShape& aFaceList = aEFmap(ii);
+ if (!BRep_Tool::Degenerated (anEdge) && aFaceList.Extent() == 1)
+ aFreeBoundMap.Add (anEdge);
+ }
+ }
// unify faces in each shell separately
TopExp_Explorer exps;
for (exps.Init(myShape, TopAbs_SHELL); exps.More(); exps.Next())
- IntUnifyFaces(exps.Current(), aGMapEdgeFaces);
+ IntUnifyFaces(exps.Current(), aGMapEdgeFaces, aFreeBoundMap);
// gather all faces out of shells in one compound and unify them at once
BRep_Builder aBB;
aBB.Add(aCmp, exps.Current());
if (nbf > 0)
- IntUnifyFaces(aCmp, aGMapEdgeFaces);
+ IntUnifyFaces(aCmp, aGMapEdgeFaces, aFreeBoundMap);
myShape = myContext->Apply(myShape);
}
//=======================================================================
void ShapeUpgrade_UnifySameDomain::IntUnifyFaces(const TopoDS_Shape& theInpShape,
- TopTools_IndexedDataMapOfShapeListOfShape& theGMapEdgeFaces)
+ TopTools_IndexedDataMapOfShapeListOfShape& theGMapEdgeFaces,
+ const TopTools_MapOfShape& theFreeBoundMap)
{
// creating map of edge faces for the shape
TopTools_IndexedDataMapOfShapeListOfShape aMapEdgeFaces;
// get connectivity of the edge in the global shape
const TopTools_ListOfShape& aGList = theGMapEdgeFaces.FindFromKey(edge);
- if (!myAllowInternal && (aGList.Extent() != 2 || myKeepShapes.Contains(edge))) {
+ if (!myAllowInternal &&
+ (aGList.Extent() != 2 || myKeepShapes.Contains(edge) || theFreeBoundMap.Contains(edge)))
+ {
// non manifold case is not processed unless myAllowInternal
continue;
}
if (aLF.Extent() == 2) {
const TopoDS_Shape& aE = aMapEF.FindKey(i);
const TopTools_ListOfShape& aGLF = theGMapEdgeFaces.FindFromKey(aE);
- if (aGLF.Extent() > 2 || myKeepShapes.Contains(aE)) {
+ if (aGLF.Extent() > 2 || myKeepShapes.Contains(aE) || theFreeBoundMap.Contains(aE))
+ {
aKeepEdges.Append(aE);
}
}
--- /dev/null
+puts "============================================="
+puts "OCC32619: UnifySameDomain ignores shared face"
+puts "============================================="
+puts ""
+
+restore [locate_data_file bug32619.brep] a
+
+unifysamedom result a
+
+checkshape result
+
+checknbshapes result -t -shell 2 -face 3 -wire 3 -edge 12 -vertex 10
+
+set tolres [checkmaxtol result]
+
+if { ${tolres} > 2.e-7} {
+ puts "Error: bad tolerance of result"
+}
+
+checkview -display result -2d -path ${imagedir}/${test_image}.png
\ No newline at end of file