Salome HOME
PAL13473 (Build repetitive mesh):
authoreap <eap@opencascade.com>
Fri, 8 Dec 2006 14:43:46 +0000 (14:43 +0000)
committereap <eap@opencascade.com>
Fri, 8 Dec 2006 14:43:46 +0000 (14:43 +0000)
Set shape to all meshes before hypo assignation

src/SMESH_I/SMESH_Gen_i.cxx

index 067e88089018c4cdc350f6690eddf05e84a93900..9673f56b4e511410bbbf914c705ee727401b914a 100644 (file)
@@ -2389,6 +2389,32 @@ bool SMESH_Gen_i::Load( SALOMEDS::SComponent_ptr theComponent,
          string iorString = GetORB()->object_to_string( myNewMesh );
          int newId = myStudyContext->findId( iorString );
          myStudyContext->mapOldToNew( id, newId );
+
+          // try to read and set reference to shape
+          GEOM::GEOM_Object_var aShapeObject;
+          if ( aTopGroup->ExistInternalObject( "Ref on shape" ) ) {
+            // load mesh "Ref on shape" - it's an entry to SObject
+            aDataset = new HDFdataset( "Ref on shape", aTopGroup );
+            aDataset->OpenOnDisk();
+            size = aDataset->GetSize();
+            char* refFromFile = new char[ size ];
+            aDataset->ReadFromDisk( refFromFile );
+            aDataset->CloseOnDisk();
+            if ( strlen( refFromFile ) > 0 ) {
+              SALOMEDS::SObject_var shapeSO = myCurrentStudy->FindObjectID( refFromFile );
+
+              // Make sure GEOM data are loaded first
+              //loadGeomData( shapeSO->GetFatherComponent() );
+
+              CORBA::Object_var shapeObject = SObjectToObject( shapeSO );
+              if ( !CORBA::is_nil( shapeObject ) ) {
+                aShapeObject = GEOM::GEOM_Object::_narrow( shapeObject );
+                if ( !aShapeObject->_is_nil() )
+                  myNewMeshImpl->SetShape( aShapeObject );
+              }
+            }
+          }
+
         }
       }
     }
@@ -2414,6 +2440,7 @@ bool SMESH_Gen_i::Load( SALOMEDS::SComponent_ptr theComponent,
       ::SMESH_Mesh& myLocMesh     = myNewMeshImpl->GetImpl();
       SMESHDS_Mesh* mySMESHDSMesh = myLocMesh.GetMeshDS();
 
+      GEOM::GEOM_Object_var aShapeObject = myNewMeshImpl->GetShapeToMesh();
       bool hasData = false;
 
       // get mesh old id
@@ -2439,31 +2466,6 @@ bool SMESH_Gen_i::Load( SALOMEDS::SComponent_ptr theComponent,
         }
       }
 
-      // try to read and set reference to shape
-      GEOM::GEOM_Object_var aShapeObject;
-      if ( aTopGroup->ExistInternalObject( "Ref on shape" ) ) {
-        // load mesh "Ref on shape" - it's an entry to SObject
-        aDataset = new HDFdataset( "Ref on shape", aTopGroup );
-        aDataset->OpenOnDisk();
-        size = aDataset->GetSize();
-        char* refFromFile = new char[ size ];
-        aDataset->ReadFromDisk( refFromFile );
-        aDataset->CloseOnDisk();
-        if ( strlen( refFromFile ) > 0 ) {
-          SALOMEDS::SObject_var shapeSO = myCurrentStudy->FindObjectID( refFromFile );
-
-          // Make sure GEOM data are loaded first
-          //loadGeomData( shapeSO->GetFatherComponent() );
-
-          CORBA::Object_var shapeObject = SObjectToObject( shapeSO );
-          if ( !CORBA::is_nil( shapeObject ) ) {
-            aShapeObject = GEOM::GEOM_Object::_narrow( shapeObject );
-            if ( !aShapeObject->_is_nil() )
-              myNewMeshImpl->SetShape( aShapeObject );
-          }
-        }
-      }
-
       // try to get applied algorithms
       if ( aTopGroup->ExistInternalObject( "Applied Algorithms" ) ) {
         aGroup = new HDFgroup( "Applied Algorithms", aTopGroup );