mirror of
https://git.dev.opencascade.org/repos/occt.git
synced 2025-04-21 10:13:43 +03:00
0027521: Standard_ConstructionError when trying to use unifySameDom into a shape
Correct the algorithm in the function MergeEdges in ShapeUpgrade_UnifySameDomain.cxx so as to take into account the orientation of the next edge added to the chain. Test cases for issue CR27521
This commit is contained in:
parent
55fb31dae4
commit
38c2acd423
@ -907,7 +907,7 @@ static Standard_Boolean MergeEdges(TopTools_SequenceOfShape& SeqEdges,
|
|||||||
if (!aMapVE.Contains(aV))
|
if (!aMapVE.Contains(aV))
|
||||||
aMapVE.Add(aV, TopTools_ListOfShape());
|
aMapVE.Add(aV, TopTools_ListOfShape());
|
||||||
aMapVE.ChangeFromKey(aV).Append(anEdge);
|
aMapVE.ChangeFromKey(aV).Append(anEdge);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -929,7 +929,7 @@ static Standard_Boolean MergeEdges(TopTools_SequenceOfShape& SeqEdges,
|
|||||||
|
|
||||||
// make chain for unite
|
// make chain for unite
|
||||||
TopTools_SequenceOfShape aChain;
|
TopTools_SequenceOfShape aChain;
|
||||||
aChain.Append(edge);
|
aChain.Append(edge);
|
||||||
aUsedEdges.Add(edge);
|
aUsedEdges.Add(edge);
|
||||||
TopoDS_Vertex V[2];
|
TopoDS_Vertex V[2];
|
||||||
TopExp::Vertices(edge, V[0], V[1], Standard_True);
|
TopExp::Vertices(edge, V[0], V[1], Standard_True);
|
||||||
@ -949,27 +949,31 @@ static Standard_Boolean MergeEdges(TopTools_SequenceOfShape& SeqEdges,
|
|||||||
edge = TopoDS::Edge(itL.Value());
|
edge = TopoDS::Edge(itL.Value());
|
||||||
if (!aUsedEdges.Contains(edge))
|
if (!aUsedEdges.Contains(edge))
|
||||||
{
|
{
|
||||||
if (j == 0)
|
TopoDS_Vertex V2[2];
|
||||||
aChain.Prepend(edge);
|
TopExp::Vertices(edge, V2[0], V2[1], Standard_True);
|
||||||
else
|
// the neighboring edge must have V[j] reversed and located on the opposite end
|
||||||
aChain.Append(edge);
|
if (V2[1 - j].IsEqual(V[j].Reversed()))
|
||||||
aUsedEdges.Add(edge);
|
{
|
||||||
TopoDS_Vertex VF2, VL2;
|
if (j == 0)
|
||||||
TopExp::Vertices(edge, VF2, VL2, Standard_True);
|
aChain.Prepend(edge);
|
||||||
V[j] = (VF2.IsSame(V[j]) ? VL2 : VF2);
|
else
|
||||||
isAdded = Standard_True;
|
aChain.Append(edge);
|
||||||
break;
|
aUsedEdges.Add(edge);
|
||||||
|
V[j] = V2[j];
|
||||||
|
isAdded = Standard_True;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if (aChain.Length() < 2)
|
if (aChain.Length() < 2)
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
Standard_Boolean IsClosed = Standard_False;
|
Standard_Boolean IsClosed = Standard_False;
|
||||||
if (V[0].IsSame ( V[1] ))
|
if (V[0].IsSame ( V[1] ))
|
||||||
IsClosed = Standard_True;
|
IsClosed = Standard_True;
|
||||||
|
|
||||||
// split chain by vertices at which merging is not possible
|
// split chain by vertices at which merging is not possible
|
||||||
NCollection_Sequence<SubSequenceOfEdges> aOneSeq;
|
NCollection_Sequence<SubSequenceOfEdges> aOneSeq;
|
||||||
@ -1525,11 +1529,11 @@ void ShapeUpgrade_UnifySameDomain::UnifyFaces()
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
Handle(ShapeExtend_WireData) sbwd =
|
Handle(ShapeExtend_WireData) sbwd =
|
||||||
new ShapeExtend_WireData (aWire);
|
new ShapeExtend_WireData (aWire);
|
||||||
ShapeFix_WireSegment seg ( sbwd, TopAbs_REVERSED );
|
ShapeFix_WireSegment seg ( sbwd, TopAbs_REVERSED );
|
||||||
wires.Append(seg);
|
wires.Append(seg);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
CompShell.DispatchWires ( parts,wires );
|
CompShell.DispatchWires ( parts,wires );
|
||||||
|
17
tests/bugs/modalg_6/bug27521_1
Normal file
17
tests/bugs/modalg_6/bug27521_1
Normal file
@ -0,0 +1,17 @@
|
|||||||
|
puts "============"
|
||||||
|
puts "OCC27521"
|
||||||
|
puts "============"
|
||||||
|
puts ""
|
||||||
|
###############################
|
||||||
|
## Standard_ConstructionError when trying to use unifySameDom into a shape
|
||||||
|
###############################
|
||||||
|
|
||||||
|
restore [locate_data_file bug27521_dom8443-good.brep] a
|
||||||
|
unifysamedom result a
|
||||||
|
|
||||||
|
don result
|
||||||
|
smallview; fit
|
||||||
|
checkshape result
|
||||||
|
checknbshapes result -m UnifySameDomain -face 31 -edge 286
|
||||||
|
|
||||||
|
checkview -screenshot -2d -path ${imagedir}/${test_image}.png
|
17
tests/bugs/modalg_6/bug27521_2
Normal file
17
tests/bugs/modalg_6/bug27521_2
Normal file
@ -0,0 +1,17 @@
|
|||||||
|
puts "============"
|
||||||
|
puts "OCC27521"
|
||||||
|
puts "============"
|
||||||
|
puts ""
|
||||||
|
###############################
|
||||||
|
## Standard_ConstructionError when trying to use unifySameDom into a shape
|
||||||
|
###############################
|
||||||
|
|
||||||
|
restore [locate_data_file bug27521_dom8443-wrong.brep] a
|
||||||
|
unifysamedom result a
|
||||||
|
|
||||||
|
don result
|
||||||
|
smallview; fit
|
||||||
|
checkshape result
|
||||||
|
checknbshapes result -m UnifySameDomain -face 31 -edge 286
|
||||||
|
|
||||||
|
checkview -screenshot -2d -path ${imagedir}/${test_image}.png
|
Loading…
x
Reference in New Issue
Block a user