1
0
mirror of https://git.dev.opencascade.org/repos/occt.git synced 2025-06-30 12:14:08 +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 OCC_CATCH_SIGNALS
for (; exp2.More(); exp2.Next()) { for (; exp2.More(); exp2.Next())
{
TopoDS_Face face = TopoDS::Face (exp2.Current()); TopoDS_Face face = TopoDS::Face (exp2.Current());
SplitFace->Init(face); SplitFace->Init(face);
SplitFace->SetContext(myContext); SplitFace->SetContext(myContext);
SplitFace->Perform(); SplitFace->Perform();
if(SplitFace->Status(ShapeExtend_FAIL)) { if (SplitFace->Status (ShapeExtend_FAIL))
{
myStatus |= ShapeExtend::EncodeStatus (ShapeExtend_FAIL2); myStatus |= ShapeExtend::EncodeStatus (ShapeExtend_FAIL2);
} }
if(SplitFace->Status(ShapeExtend_DONE)) { if (SplitFace->Status (ShapeExtend_DONE))
{
myContext->Replace (face, SplitFace->Result()); myContext->Replace (face, SplitFace->Result());
SendMsg (face, doneMsg, Message_Info); SendMsg (face, doneMsg, Message_Info);
if (SplitFace->Status (ShapeExtend_DONE1)) if (SplitFace->Status (ShapeExtend_DONE1))
{
myStatus |= ShapeExtend::EncodeStatus (ShapeExtend_DONE1); myStatus |= ShapeExtend::EncodeStatus (ShapeExtend_DONE1);
}
if (SplitFace->Status (ShapeExtend_DONE2)) if (SplitFace->Status (ShapeExtend_DONE2))
{
myStatus |= ShapeExtend::EncodeStatus (ShapeExtend_DONE2); myStatus |= ShapeExtend::EncodeStatus (ShapeExtend_DONE2);
} }
} }
} }
catch (Standard_Failure const& anException) { }
catch (Standard_Failure const& anException)
{
#ifdef OCCT_DEBUG #ifdef OCCT_DEBUG
cout << "\nError: Exception in ShapeUpgrade_FaceDivide::Perform(): "; std::cout << "\nError: Exception in ShapeUpgrade_FaceDivide::Perform(): ";
anException.Print(cout); cout << endl; anException.Print (std::cout); std::cout << std::endl;
#endif #endif
(void )anException; (void )anException;
myStatus |= ShapeExtend::EncodeStatus (ShapeExtend_FAIL2); myStatus |= ShapeExtend::EncodeStatus (ShapeExtend_FAIL2);
} }
if (!exp2.More())
{
break;
}
} }
} }
} }