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

0030593: Modeling Algorithms - ShapeUpgrade_ShapeDivide::Perform() throws Standard_NoMoreObject

Added missing TopExp_Explorer::More() checks to ShapeUpgrade_ShapeDivide::Perform() and BRepCheck_Analyzer::Perform().
This commit is contained in:
kgv 2019-03-19 11:24:21 +03:00 committed by apn
parent 85831628d6
commit 2328cae25d
2 changed files with 46 additions and 33 deletions

View File

@ -147,7 +147,6 @@ void BRepCheck_Analyzer::Perform(const TopoDS_Shape& S)
if ( ! aRes.IsNull() ) if ( ! aRes.IsNull() )
{ {
aRes->SetFailStatus(exp.Current());
aRes->SetFailStatus(S); aRes->SetFailStatus(S);
} }
} }

View File

@ -193,41 +193,55 @@ Standard_Boolean ShapeUpgrade_ShapeDivide::Perform(const Standard_Boolean newCon
} }
Message_Msg doneMsg = GetFaceMsg(); Message_Msg doneMsg = GetFaceMsg();
for(TopExp_Explorer exp(myShape,TopAbs_FACE); exp.More(); exp.Next()) { for (TopExp_Explorer exp (myShape,TopAbs_FACE); exp.More(); exp.Next())
//smh#8 {
TopoDS_Shape tmpF = exp.Current().Oriented ( TopAbs_FORWARD ); TopoDS_Shape tmpF = exp.Current().Oriented ( TopAbs_FORWARD );
TopoDS_Face F = TopoDS::Face (tmpF); // protection against INTERNAL shapes: cts20105a.rle TopoDS_Face F = TopoDS::Face (tmpF); // protection against INTERNAL shapes: cts20105a.rle
TopoDS_Shape sh = myContext->Apply ( F, TopAbs_SHAPE ); TopoDS_Shape sh = myContext->Apply ( F, TopAbs_SHAPE );
for (TopExp_Explorer exp2(sh,TopAbs_FACE); exp2.More(); exp2.Next()) { for (TopExp_Explorer exp2 (sh,TopAbs_FACE); exp2.More(); exp2.Next())
//szv: try-catch added {
try { try
OCC_CATCH_SIGNALS {
for (; exp2.More(); exp2.Next()) { OCC_CATCH_SIGNALS
TopoDS_Face face = TopoDS::Face ( exp2.Current() ); for (; exp2.More(); exp2.Next())
SplitFace->Init(face); {
SplitFace->SetContext(myContext); TopoDS_Face face = TopoDS::Face (exp2.Current());
SplitFace->Perform(); SplitFace->Init(face);
if(SplitFace->Status(ShapeExtend_FAIL)) { SplitFace->SetContext(myContext);
myStatus |= ShapeExtend::EncodeStatus ( ShapeExtend_FAIL2 ); SplitFace->Perform();
} if (SplitFace->Status (ShapeExtend_FAIL))
if(SplitFace->Status(ShapeExtend_DONE)) { {
myContext->Replace(face,SplitFace->Result()); myStatus |= ShapeExtend::EncodeStatus (ShapeExtend_FAIL2);
SendMsg( face, doneMsg, Message_Info ); }
if(SplitFace->Status(ShapeExtend_DONE1)) if (SplitFace->Status (ShapeExtend_DONE))
myStatus |= ShapeExtend::EncodeStatus ( ShapeExtend_DONE1 ); {
if(SplitFace->Status(ShapeExtend_DONE2)) myContext->Replace (face, SplitFace->Result());
myStatus |= ShapeExtend::EncodeStatus ( ShapeExtend_DONE2 ); SendMsg (face, doneMsg, Message_Info);
} if (SplitFace->Status (ShapeExtend_DONE1))
} {
} myStatus |= ShapeExtend::EncodeStatus (ShapeExtend_DONE1);
catch (Standard_Failure const& anException) { }
#ifdef OCCT_DEBUG if (SplitFace->Status (ShapeExtend_DONE2))
cout << "\nError: Exception in ShapeUpgrade_FaceDivide::Perform(): "; {
anException.Print(cout); cout << endl; myStatus |= ShapeExtend::EncodeStatus (ShapeExtend_DONE2);
#endif }
(void)anException; }
myStatus |= ShapeExtend::EncodeStatus ( ShapeExtend_FAIL2 ); }
} }
catch (Standard_Failure const& anException)
{
#ifdef OCCT_DEBUG
std::cout << "\nError: Exception in ShapeUpgrade_FaceDivide::Perform(): ";
anException.Print (std::cout); std::cout << std::endl;
#endif
(void )anException;
myStatus |= ShapeExtend::EncodeStatus (ShapeExtend_FAIL2);
}
if (!exp2.More())
{
break;
}
} }
} }
} }