0052829: Failed GetSubShapeID() breaks the next IsSubShapeBelongsTo()

This commit is contained in:
skv 2015-07-22 12:40:08 +03:00
parent 6440cc096c
commit a207750f4a

View File

@ -690,8 +690,12 @@ Handle(GEOM_Object) GEOMImpl_IShapesOperations::MakeFaceWithConstraints
if ( aFace->GetValue().ShapeType() != TopAbs_FACE ) if ( aFace->GetValue().ShapeType() != TopAbs_FACE )
// constraint face can be omitted - it is a valid case // constraint face can be omitted - it is a valid case
continue; continue;
// Keep the old error code as IsSubShapeBelongsTo changes it.
TCollection_AsciiString anOldCode = GetErrorCode();
if ( IsSubShapeBelongsTo( anObject, 0, aFace, 0 ) ) { if ( IsSubShapeBelongsTo( anObject, 0, aFace, 0 ) ) {
// valid constraint // valid constraint
SetErrorCode(anOldCode);
aRefSh = aFace->GetLastFunction(); aRefSh = aFace->GetLastFunction();
aConstraints->Append(aRefSh); aConstraints->Append(aRefSh);
it++; it++;
@ -2019,6 +2023,8 @@ Standard_Boolean GEOMImpl_IShapesOperations::IsSubShapeBelongsTo( Handle(GEOM_Ob
Handle(GEOM_Object) theObject, Handle(GEOM_Object) theObject,
const Standard_Integer theObjectIndex) const Standard_Integer theObjectIndex)
{ {
SetErrorCode(KO);
if ( theObject.IsNull() || theSubObject.IsNull() ) if ( theObject.IsNull() || theSubObject.IsNull() )
return false; return false;
@ -2039,7 +2045,12 @@ Standard_Boolean GEOMImpl_IShapesOperations::IsSubShapeBelongsTo( Handle(GEOM_Ob
} }
TopExp::MapShapes( shape, anIndices ); TopExp::MapShapes( shape, anIndices );
return anIndices.Contains( subShape );
const Standard_Boolean isBelongTo = anIndices.Contains(subShape);
SetErrorCode(OK);
return isBelongTo;
} }
//============================================================================= //=============================================================================