mirror of
https://git.dev.opencascade.org/repos/occt.git
synced 2025-04-10 18:51:21 +03:00
0032619: [Regression] Modelling Algorithms - UnifySameDomain ignores shared face
Correct method ShapeUpgrade_UnifySameDomain::UnifyFaces: exclude free boundary edges from unification.
This commit is contained in:
parent
eb78d737d4
commit
538700ffa2
@ -2622,11 +2622,29 @@ void ShapeUpgrade_UnifySameDomain::UnifyFaces()
|
|||||||
TopExp::MapShapes (myShape, TopAbs_FACE, aFaceMap);
|
TopExp::MapShapes (myShape, TopAbs_FACE, aFaceMap);
|
||||||
for (Standard_Integer i = 1; i <= aFaceMap.Extent(); i++)
|
for (Standard_Integer i = 1; i <= aFaceMap.Extent(); i++)
|
||||||
TopExp::MapShapesAndAncestors (aFaceMap(i), TopAbs_EDGE, TopAbs_FACE, aGMapEdgeFaces);
|
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
|
// unify faces in each shell separately
|
||||||
TopExp_Explorer exps;
|
TopExp_Explorer exps;
|
||||||
for (exps.Init(myShape, TopAbs_SHELL); exps.More(); exps.Next())
|
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
|
// gather all faces out of shells in one compound and unify them at once
|
||||||
BRep_Builder aBB;
|
BRep_Builder aBB;
|
||||||
@ -2637,7 +2655,7 @@ void ShapeUpgrade_UnifySameDomain::UnifyFaces()
|
|||||||
aBB.Add(aCmp, exps.Current());
|
aBB.Add(aCmp, exps.Current());
|
||||||
|
|
||||||
if (nbf > 0)
|
if (nbf > 0)
|
||||||
IntUnifyFaces(aCmp, aGMapEdgeFaces);
|
IntUnifyFaces(aCmp, aGMapEdgeFaces, aFreeBoundMap);
|
||||||
|
|
||||||
myShape = myContext->Apply(myShape);
|
myShape = myContext->Apply(myShape);
|
||||||
}
|
}
|
||||||
@ -2666,7 +2684,8 @@ static void SetFixWireModes(ShapeFix_Face& theSff)
|
|||||||
//=======================================================================
|
//=======================================================================
|
||||||
|
|
||||||
void ShapeUpgrade_UnifySameDomain::IntUnifyFaces(const TopoDS_Shape& theInpShape,
|
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
|
// creating map of edge faces for the shape
|
||||||
TopTools_IndexedDataMapOfShapeListOfShape aMapEdgeFaces;
|
TopTools_IndexedDataMapOfShapeListOfShape aMapEdgeFaces;
|
||||||
@ -2723,7 +2742,9 @@ void ShapeUpgrade_UnifySameDomain::IntUnifyFaces(const TopoDS_Shape& theInpShape
|
|||||||
|
|
||||||
// get connectivity of the edge in the global shape
|
// get connectivity of the edge in the global shape
|
||||||
const TopTools_ListOfShape& aGList = theGMapEdgeFaces.FindFromKey(edge);
|
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
|
// non manifold case is not processed unless myAllowInternal
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
@ -2811,7 +2832,8 @@ void ShapeUpgrade_UnifySameDomain::IntUnifyFaces(const TopoDS_Shape& theInpShape
|
|||||||
if (aLF.Extent() == 2) {
|
if (aLF.Extent() == 2) {
|
||||||
const TopoDS_Shape& aE = aMapEF.FindKey(i);
|
const TopoDS_Shape& aE = aMapEF.FindKey(i);
|
||||||
const TopTools_ListOfShape& aGLF = theGMapEdgeFaces.FindFromKey(aE);
|
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);
|
aKeepEdges.Append(aE);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -169,7 +169,8 @@ protected:
|
|||||||
Standard_EXPORT void UnifyEdges();
|
Standard_EXPORT void UnifyEdges();
|
||||||
|
|
||||||
void IntUnifyFaces(const TopoDS_Shape& theInpShape,
|
void IntUnifyFaces(const TopoDS_Shape& theInpShape,
|
||||||
TopTools_IndexedDataMapOfShapeListOfShape& theGMapEdgeFaces);
|
TopTools_IndexedDataMapOfShapeListOfShape& theGMapEdgeFaces,
|
||||||
|
const TopTools_MapOfShape& theFreeBoundMap);
|
||||||
|
|
||||||
//! Splits the sequence of edges into the sequence of chains
|
//! Splits the sequence of edges into the sequence of chains
|
||||||
Standard_Boolean MergeEdges(TopTools_SequenceOfShape& SeqEdges,
|
Standard_Boolean MergeEdges(TopTools_SequenceOfShape& SeqEdges,
|
||||||
|
20
tests/bugs/heal/bug32619
Normal file
20
tests/bugs/heal/bug32619
Normal file
@ -0,0 +1,20 @@
|
|||||||
|
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
|
Loading…
x
Reference in New Issue
Block a user