1
0
mirror of https://git.dev.opencascade.org/repos/occt.git synced 2025-04-10 18:51:21 +03:00

0025068: ShapeAnalysis_FreeBounds::ConnectEdgesToWires returns wires with not valid Closed flag

Test case for issue CR25068
This commit is contained in:
ifv 2014-09-04 14:07:04 +04:00 committed by bugmaster
parent 31cf9c5f7d
commit 189062565f
4 changed files with 304 additions and 243 deletions

View File

@ -199,6 +199,15 @@ ShapeAnalysis_FreeBounds::ShapeAnalysis_FreeBounds(const TopoDS_Shape& shape,
Handle(ShapeExtend_WireData)
sewd = new ShapeExtend_WireData (TopoDS::Wire (arrwires->Value (1)));
Standard_Boolean isUsedManifoldMode = Standard_True;
if((sewd->NbEdges() < 1) && (sewd->NbNonManifoldEdges() > 0))
{
isUsedManifoldMode = Standard_False;
sewd = new ShapeExtend_WireData (TopoDS::Wire (arrwires->Value (1)), Standard_True,
isUsedManifoldMode);
}
Handle(ShapeAnalysis_Wire) saw = new ShapeAnalysis_Wire;
saw->Load (sewd);
saw->SetPrecision (tolerance);
@ -227,12 +236,6 @@ ShapeAnalysis_FreeBounds::ShapeAnalysis_FreeBounds(const TopoDS_Shape& shape,
ShapeAnalysis_Edge sae; //szv#4:S4163:12Mar99 moved
Standard_Boolean done = Standard_False;
Standard_Boolean isUsedManifoldMode = Standard_True;
if((sewd->NbEdges() < 1) && (sewd->NbNonManifoldEdges() > 0))
{
isUsedManifoldMode = Standard_False;
}
while (!done)
{
@ -241,10 +244,8 @@ ShapeAnalysis_FreeBounds::ShapeAnalysis_FreeBounds(const TopoDS_Shape& shape,
aSel.SetStop();
Bnd_Box FVBox, LVBox;
TopoDS_Vertex Vf, Vl;
Vf = isUsedManifoldMode ? sae.FirstVertex(sewd->Edge(1)) :
sae.FirstVertex(sewd->NonmanifoldEdge(1));
Vl = isUsedManifoldMode ? sae.LastVertex(sewd->Edge(sewd->NbEdges())) :
sae.LastVertex(sewd->NonmanifoldEdge(sewd->NbNonManifoldEdges()));
Vf = sae.FirstVertex(sewd->Edge(1));
Vl = sae.LastVertex(sewd->Edge(sewd->NbEdges()));
gp_Pnt pf, pl;
pf = BRep_Tool::Pnt(Vf);
@ -284,7 +285,7 @@ ShapeAnalysis_FreeBounds::ShapeAnalysis_FreeBounds(const TopoDS_Shape& shape,
TopoDS_Wire aCurW = TopoDS::Wire (arrwires->Value (lwire));
Handle(ShapeExtend_WireData) acurwd = new
ShapeExtend_WireData ( TopoDS::Wire (arrwires->Value (lwire)));
ShapeExtend_WireData ( TopoDS::Wire (arrwires->Value (lwire)), Standard_True, isUsedManifoldMode);
sewd->Add (acurwd, (tail ? 0 : 1));
}
else
@ -328,11 +329,42 @@ ShapeAnalysis_FreeBounds::ShapeAnalysis_FreeBounds(const TopoDS_Shape& shape,
//2.making wire
TopoDS_Wire wire = sewd->Wire();
if(isUsedManifoldMode)
{
if (!saw->CheckConnected (1) && saw->LastCheckStatus (ShapeExtend_OK))
wire.Closed (Standard_True);
}
else
{
//Try to check connection by number of free vertices
TopTools_MapOfShape vmap;
TopoDS_Iterator it(wire);
for(; it.More(); it.Next())
{
const TopoDS_Shape& E = it.Value();
TopoDS_Iterator ite(E, Standard_False, Standard_True);
for(; ite.More(); ite.Next())
{
const TopoDS_Shape& V = ite.Value();
if (V.Orientation() == TopAbs_FORWARD ||
V.Orientation() == TopAbs_REVERSED)
{
// add or remove in the vertex map
if (!vmap.Add(V)) vmap.Remove(V);
}
}
}
if(vmap.IsEmpty())
{
wire.Closed(Standard_True);
}
}
owires->Append (wire);
sewd->Clear();
sewd->ManifoldMode() = isUsedManifoldMode;
// Recherche de la premier edge non traitee pour un autre wire.
//Searching for first edge for next wire

View File

@ -64,7 +64,17 @@ TopoDS_Edge ShapeBuild_Edge::CopyReplaceVertices (const TopoDS_Edge& edge,
TopTools_SequenceOfShape aNMVertices;
TopoDS_Vertex newV1 = V1, newV2 = V2;
if ( newV1.IsNull() || newV2.IsNull() ) {
for ( TopoDS_Iterator it(edge); it.More(); it.Next() ) {
TopoDS_Iterator it;
if(edge.Orientation() == TopAbs_FORWARD ||
edge.Orientation() == TopAbs_REVERSED)
{
it.Initialize(edge, Standard_True, Standard_True);
}
else
{
it.Initialize(edge, Standard_False, Standard_True);
}
for ( ; it.More(); it.Next() ) {
TopoDS_Vertex V = TopoDS::Vertex ( it.Value() );
if ( V.Orientation() == TopAbs_FORWARD ) {
if ( newV1.IsNull() ) newV1 = V;

19
tests/bugs/heal/bug25068 Executable file
View File

@ -0,0 +1,19 @@
puts "============"
puts "OCC25068"
puts "============"
puts ""
###################################################
## ShapeAnalysis_FreeBounds::ConnectEdgesToWires returns wires with not valid Closed flag
###################################################
restore [locate_data_file bug24807_Compound.brep] a
connectedges r a 1.e-7 0
explode r
set info [whatis r_1]
if { [regexp "Closed" ${info}] == 1 } {
puts "Error: Closed flag is not valid"
} else {
puts "OK: Closed flag is valid"
}

View File

@ -2,7 +2,7 @@ if {[string compare $command "ShapeConvertRev"] == 0 } {
puts "TODO OCC23127 ALL: Error : The resulting shape is not correct"
}
if {[string compare $command "SplitAngle"] == 0 } {
puts "TODO OCC23127 ALL: Faulty shapes in variables faulty_1 to faulty_9 "
puts "TODO OCC23127 ALL: Faulty shapes in variables faulty_1 to faulty_"
puts "TODO ?DEBUG_OCC24121 Debian60-64 Windows: Error: Exception in ShapeUpgrade_FaceDivide"
}
restore [locate_data_file CTO900_ger60598c.rle] a