]> SALOME platform Git repositories - modules/geom.git/commitdiff
Salome HOME
0052829: Failed GetSubShapeID() breaks the next IsSubShapeBelongsTo()
authorskv <skv@opencascade.com>
Wed, 22 Jul 2015 09:40:08 +0000 (12:40 +0300)
committerskv <skv@opencascade.com>
Wed, 22 Jul 2015 09:40:08 +0000 (12:40 +0300)
src/GEOMImpl/GEOMImpl_IShapesOperations.cxx

index fcba87df249cffbd3f28fa11bcd076241320603d..e5cdc97ead71275fd20e4692780d7090a3f6289a 100644 (file)
@@ -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;
 }
 
 //=============================================================================