Salome HOME
0021439: EDF 2004 GEOM, SMESH: Dump of study gives bad geom group and stops with...
authoreap <eap@opencascade.com>
Wed, 11 Jan 2012 09:50:28 +0000 (09:50 +0000)
committereap <eap@opencascade.com>
Wed, 11 Jan 2012 09:50:28 +0000 (09:50 +0000)
    fix _pyGen::FindObject() to restore the lost wrapping of hyp creation

src/SMESH_I/SMESH_2smeshpy.cxx

index 2437efbd32cee8957f1e55c981f82d2454755801..20d18e144fc92ca3017931be2012da3277c1bd7b 100644 (file)
@@ -243,7 +243,7 @@ Handle(_pyCommand) _pyGen::AddCommand( const TCollection_AsciiString& theCommand
   MESSAGE ( "## COM " << myNbCommands << ": "<< aCommand->GetString() );
 #endif
 
-  _pyID objID = aCommand->GetObject();
+  const _pyID& objID = aCommand->GetObject();
 
   if ( objID.IsEmpty() )
     return aCommand;
@@ -251,7 +251,8 @@ Handle(_pyCommand) _pyGen::AddCommand( const TCollection_AsciiString& theCommand
   // Find an object to process theCommand
 
   // SMESH_Gen method?
-  if ( objID == this->GetID() || objID == SMESH_2smeshpy::GenName()) {
+  if ( objID == this->GetID() || objID == SMESH_2smeshpy::GenName())
+  {
     this->Process( aCommand );
     return aCommand;
   }
@@ -831,8 +832,22 @@ void _pyGen::AddObject( Handle(_pyObject)& theObj )
 
 Handle(_pyObject) _pyGen::FindObject( const _pyID& theObjID )  const
 {
-  std::map< _pyID, Handle(_pyObject) >::const_iterator id_obj = myObjects.find( theObjID );
-  return ( id_obj == myObjects.end() ) ? Handle(_pyObject)() : id_obj->second;
+  {
+    map< _pyID, Handle(_pyObject) >::const_iterator id_obj = myObjects.find( theObjID );
+    if ( id_obj != myObjects.end() )
+      return id_obj->second;
+  }
+  {
+    map< _pyID, Handle(_pyMesh) >::const_iterator id_obj = myMeshes.find( theObjID );
+    if ( id_obj != myMeshes.end() )
+      return id_obj->second;
+  }
+  {
+    map< _pyID, Handle(_pyMeshEditor) >::const_iterator id_obj = myMeshEditors.find( theObjID );
+    if ( id_obj != myMeshEditors.end() )
+      return id_obj->second;
+  }
+  return Handle(_pyObject)();
 }
 
 //================================================================================