From a207750f4a6445385f86f142c5a12f4efd24b6a9 Mon Sep 17 00:00:00 2001 From: skv Date: Wed, 22 Jul 2015 12:40:08 +0300 Subject: [PATCH] 0052829: Failed GetSubShapeID() breaks the next IsSubShapeBelongsTo() --- src/GEOMImpl/GEOMImpl_IShapesOperations.cxx | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/src/GEOMImpl/GEOMImpl_IShapesOperations.cxx b/src/GEOMImpl/GEOMImpl_IShapesOperations.cxx index fcba87df2..e5cdc97ea 100644 --- a/src/GEOMImpl/GEOMImpl_IShapesOperations.cxx +++ b/src/GEOMImpl/GEOMImpl_IShapesOperations.cxx @@ -690,8 +690,12 @@ Handle(GEOM_Object) GEOMImpl_IShapesOperations::MakeFaceWithConstraints if ( aFace->GetValue().ShapeType() != TopAbs_FACE ) // constraint face can be omitted - it is a valid case continue; + // Keep the old error code as IsSubShapeBelongsTo changes it. + TCollection_AsciiString anOldCode = GetErrorCode(); + if ( IsSubShapeBelongsTo( anObject, 0, aFace, 0 ) ) { // valid constraint + SetErrorCode(anOldCode); aRefSh = aFace->GetLastFunction(); aConstraints->Append(aRefSh); it++; @@ -2019,6 +2023,8 @@ Standard_Boolean GEOMImpl_IShapesOperations::IsSubShapeBelongsTo( Handle(GEOM_Ob Handle(GEOM_Object) theObject, const Standard_Integer theObjectIndex) { + SetErrorCode(KO); + if ( theObject.IsNull() || theSubObject.IsNull() ) return false; @@ -2039,7 +2045,12 @@ Standard_Boolean GEOMImpl_IShapesOperations::IsSubShapeBelongsTo( Handle(GEOM_Ob } TopExp::MapShapes( shape, anIndices ); - return anIndices.Contains( subShape ); + + const Standard_Boolean isBelongTo = anIndices.Contains(subShape); + + SetErrorCode(OK); + + return isBelongTo; } //============================================================================= -- 2.39.2