Salome HOME
19997: Compute does not work in script, ok in GUI
authoreap <eap@opencascade.com>
Mon, 13 Oct 2008 08:10:22 +0000 (08:10 +0000)
committereap <eap@opencascade.com>
Mon, 13 Oct 2008 08:10:22 +0000 (08:10 +0000)
     fix MakeComputed() for group projection

src/SMESH/SMESH_Pattern.cxx
src/StdMeshers/StdMeshers_ProjectionUtils.cxx

index b8dd698a16b37967d1aed8058db657328be6416c..292af478f4181ff6480e151f861608b6e53304a1 100644 (file)
@@ -3804,11 +3804,9 @@ static bool clearSubMesh( SMESH_Mesh*         theMesh,
   bool removed = false;
   if ( SMESH_subMesh * aSubMesh = theMesh->GetSubMeshContaining( theShape ))
   {
-    if ( aSubMesh->GetSubMeshDS() ) {
-      removed =
-        aSubMesh->GetSubMeshDS()->NbElements() || aSubMesh->GetSubMeshDS()->NbNodes();
+    removed = !aSubMesh->IsEmpty();
+    if ( removed )
       aSubMesh->ComputeStateEngine( SMESH_subMesh::CLEAN );
-    }
   }
   else {
     SMESHDS_Mesh* aMeshDS = theMesh->GetMeshDS();
index 550ecb2e598b8aa8f3958c68e77b486b29522d10..8c858e94d847b5edb8cd22af341cfd8e036ce0db 100644 (file)
@@ -1635,7 +1635,17 @@ bool StdMeshers_ProjectionUtils::MakeComputed(SMESH_subMesh * sm, const int iter
   SMESH_Gen* gen   = mesh->GetGen();
   SMESH_Algo* algo = gen->GetAlgo( *mesh, sm->GetSubShape() );
   if ( !algo )
-    RETURN_BAD_RESULT("No algo assigned to submesh " << sm->GetId());
+  {
+    if ( sm->GetSubShape().ShapeType() != TopAbs_COMPOUND )
+      RETURN_BAD_RESULT("No algo assigned to submesh " << sm->GetId());
+    // group
+    bool computed = true;
+    for ( TopoDS_Iterator grMember( sm->GetSubShape() ); grMember.More(); grMember.Next())
+      if ( SMESH_subMesh* grSub = mesh->GetSubMesh( grMember.Value() ))
+        if ( !MakeComputed( grSub, iterationNb + 1 ))
+          computed = false;
+    return computed;
+  }
 
   string algoType = algo->GetName();
   if ( algoType.substr(0, 11) != "Projection_")
@@ -1679,7 +1689,10 @@ bool StdMeshers_ProjectionUtils::MakeComputed(SMESH_subMesh * sm, const int iter
   if ( !srcMesh )
     srcMesh = mesh;
 
-  return MakeComputed( srcMesh->GetSubMesh( srcShape ), iterationNb + 1 );
+  if ( MakeComputed( srcMesh->GetSubMesh( srcShape ), iterationNb + 1 ))
+    return gen->Compute( *mesh, sm->GetSubShape() );
+
+  return false;
 }
 
 //================================================================================