From 0c1e7c3900bda4cf8030454accff68730c233758 Mon Sep 17 00:00:00 2001 From: eap Date: Mon, 21 Dec 2009 08:24:08 +0000 Subject: [PATCH] 0020623: EDF 1209 SMESH: Load script/execfile add the objects in the wrong study set current study to SMESH_Gen --- src/SMESH_SWIG/PAL_MESH_041_mesh.py | 2 +- src/SMESH_SWIG/PAL_MESH_043_2D.py | 1 + src/SMESH_SWIG/PAL_MESH_043_3D.py | 1 + src/SMESH_SWIG/SMESH_AdvancedEditor.py | 3 ++- src/SMESH_SWIG/SMESH_BuildCompound.py | 2 ++ src/SMESH_SWIG/SMESH_Nut.py | 2 ++ src/SMESH_SWIG/SMESH_Partition1_tetra.py | 1 + src/SMESH_SWIG/SMESH_Sphere.py | 1 + src/SMESH_SWIG/SMESH_box.py | 1 + src/SMESH_SWIG/SMESH_box2_tetra.py | 1 + src/SMESH_SWIG/SMESH_box3_tetra.py | 2 +- src/SMESH_SWIG/SMESH_box_tetra.py | 1 + src/SMESH_SWIG/SMESH_demo_hexa2_upd.py | 1 + src/SMESH_SWIG/SMESH_fixation_hexa.py | 1 + src/SMESH_SWIG/SMESH_fixation_netgen.py | 1 + src/SMESH_SWIG/SMESH_fixation_tetra.py | 1 + src/SMESH_SWIG/SMESH_flight_skin.py | 1 + src/SMESH_SWIG/SMESH_freebord.py | 1 + src/SMESH_SWIG/SMESH_hexaedre.py | 1 + src/SMESH_SWIG/SMESH_mechanic.py | 1 + src/SMESH_SWIG/SMESH_mechanic_editor.py | 1 + src/SMESH_SWIG/SMESH_mechanic_netgen.py | 1 + src/SMESH_SWIG/SMESH_mechanic_tetra.py | 1 + src/SMESH_SWIG/SMESH_reg.py | 2 +- src/SMESH_SWIG/SMESH_test.py | 1 + src/SMESH_SWIG/SMESH_test1.py | 2 ++ src/SMESH_SWIG/SMESH_test1_AndDisplay.py | 2 ++ src/SMESH_SWIG/SMESH_test4.py | 1 + src/SMESH_SWIG/SMESH_test5.py | 2 ++ 29 files changed, 35 insertions(+), 4 deletions(-) diff --git a/src/SMESH_SWIG/PAL_MESH_041_mesh.py b/src/SMESH_SWIG/PAL_MESH_041_mesh.py index 523429d2b..66252f223 100755 --- a/src/SMESH_SWIG/PAL_MESH_041_mesh.py +++ b/src/SMESH_SWIG/PAL_MESH_041_mesh.py @@ -54,7 +54,7 @@ Id_face1 = geompy.addToStudy(face1,"Face1") #-----------------------------SMESH------------------------------------------- - +smesh.SetCurrentStudy(salome.myStudy) # -- Init mesh -- plane_mesh = salome.IDToObject( Id_face1) diff --git a/src/SMESH_SWIG/PAL_MESH_043_2D.py b/src/SMESH_SWIG/PAL_MESH_043_2D.py index 35bd54cda..85fa92589 100755 --- a/src/SMESH_SWIG/PAL_MESH_043_2D.py +++ b/src/SMESH_SWIG/PAL_MESH_043_2D.py @@ -52,6 +52,7 @@ id_ellipse2 = geompy.addToStudy(ellipse2, "Ellips 2") #---------------------------------SMESH +smesh.SetCurrentStudy(salome.myStudy) # create the path mesh mesh1 = smesh.Mesh(ellipse1, "Path Mesh") diff --git a/src/SMESH_SWIG/PAL_MESH_043_3D.py b/src/SMESH_SWIG/PAL_MESH_043_3D.py index bc4e115f0..009ca3991 100755 --- a/src/SMESH_SWIG/PAL_MESH_043_3D.py +++ b/src/SMESH_SWIG/PAL_MESH_043_3D.py @@ -50,6 +50,7 @@ idcircle = geompy.addToStudy(circle, "Circle") idface = geompy.addToStudy(face, "Circular face") +smesh.SetCurrentStudy(salome.myStudy) # init a Mesh with the circular face mesh1 = smesh.Mesh(face, "Mesh on circular face") diff --git a/src/SMESH_SWIG/SMESH_AdvancedEditor.py b/src/SMESH_SWIG/SMESH_AdvancedEditor.py index a480d029f..561f1dc52 100644 --- a/src/SMESH_SWIG/SMESH_AdvancedEditor.py +++ b/src/SMESH_SWIG/SMESH_AdvancedEditor.py @@ -51,7 +51,8 @@ def GetNewNodes(mesh,Elems,OldNodes): pass return newnodes - +smesh.SetCurrentStudy(salome.myStudy) + # create empty mesh mesh = smesh.Mesh() diff --git a/src/SMESH_SWIG/SMESH_BuildCompound.py b/src/SMESH_SWIG/SMESH_BuildCompound.py index e82abfa40..0f92cda70 100644 --- a/src/SMESH_SWIG/SMESH_BuildCompound.py +++ b/src/SMESH_SWIG/SMESH_BuildCompound.py @@ -61,6 +61,8 @@ geompy.addToStudy(Box_sup, "Box_sup") geompy.addToStudyInFather(Box_sup, Fsup2, "Fsup") geompy.addToStudyInFather(Box_sup, Finf2, "Finf") +smesh.SetCurrentStudy(salome.myStudy) + ## create a bottom mesh Mesh_inf = smesh.Mesh(Box_inf, "Mesh_inf") algo1D_1=Mesh_inf.Segment() diff --git a/src/SMESH_SWIG/SMESH_Nut.py b/src/SMESH_SWIG/SMESH_Nut.py index 11428f8c5..ff0df1683 100755 --- a/src/SMESH_SWIG/SMESH_Nut.py +++ b/src/SMESH_SWIG/SMESH_Nut.py @@ -97,6 +97,8 @@ Cut_1_ID = geompy.addToStudy(Cut_1, "Cut_1") #Mesh creation +smesh.SetCurrentStudy(salome.myStudy) + # -- Init -- shape_mesh = salome.IDToObject( Cut_1_ID ) diff --git a/src/SMESH_SWIG/SMESH_Partition1_tetra.py b/src/SMESH_SWIG/SMESH_Partition1_tetra.py index e3af5d2d1..5c2825846 100644 --- a/src/SMESH_SWIG/SMESH_Partition1_tetra.py +++ b/src/SMESH_SWIG/SMESH_Partition1_tetra.py @@ -119,6 +119,7 @@ status = geompy.CheckShape(alveole) print " check status ", status # ---- launch SMESH +smesh.SetCurrentStudy(salome.myStudy) # ---- init a Mesh with the alveole shape_mesh = salome.IDToObject( idalveole ) diff --git a/src/SMESH_SWIG/SMESH_Sphere.py b/src/SMESH_SWIG/SMESH_Sphere.py index 3b1ca2e79..e79f5eaf6 100644 --- a/src/SMESH_SWIG/SMESH_Sphere.py +++ b/src/SMESH_SWIG/SMESH_Sphere.py @@ -103,6 +103,7 @@ Id_Result = addToStudy(Result, "Result") #----------------------------------------------------------------------- #Meshing +smesh.SetCurrentStudy(salome.myStudy) my_hexa = smesh.Mesh(Result, "Sphere_Mesh") algo = my_hexa.Segment() algo.NumberOfSegments(NbSeg) diff --git a/src/SMESH_SWIG/SMESH_box.py b/src/SMESH_SWIG/SMESH_box.py index 8a1b39cac..6e034aca0 100755 --- a/src/SMESH_SWIG/SMESH_box.py +++ b/src/SMESH_SWIG/SMESH_box.py @@ -47,6 +47,7 @@ box = geompy.MakeBox(0.,0.,0.,1.,1.,1.) boxId = geompy.addToStudy(box,"box") # ---- SMESH +smesh.SetCurrentStudy(salome.myStudy) # ---- init a Mesh diff --git a/src/SMESH_SWIG/SMESH_box2_tetra.py b/src/SMESH_SWIG/SMESH_box2_tetra.py index 79cf3b536..ab189a361 100644 --- a/src/SMESH_SWIG/SMESH_box2_tetra.py +++ b/src/SMESH_SWIG/SMESH_box2_tetra.py @@ -73,6 +73,7 @@ print "number of Edges in shell : ", len(subEdgeList) ### ---------------------------- SMESH -------------------------------------- +smesh.SetCurrentStudy(salome.myStudy) # ---- init a Mesh with the shell diff --git a/src/SMESH_SWIG/SMESH_box3_tetra.py b/src/SMESH_SWIG/SMESH_box3_tetra.py index fd1b3ef62..5e750101a 100644 --- a/src/SMESH_SWIG/SMESH_box3_tetra.py +++ b/src/SMESH_SWIG/SMESH_box3_tetra.py @@ -84,7 +84,7 @@ print "number of Edges in shell : ", len(subEdgeList) ### ---------------------------- SMESH -------------------------------------- - +smesh.SetCurrentStudy(salome.myStudy) # ---- init a Mesh with the shell diff --git a/src/SMESH_SWIG/SMESH_box_tetra.py b/src/SMESH_SWIG/SMESH_box_tetra.py index 279ae11ab..e02f74718 100644 --- a/src/SMESH_SWIG/SMESH_box_tetra.py +++ b/src/SMESH_SWIG/SMESH_box_tetra.py @@ -45,6 +45,7 @@ print "number of Edges in box : ", len(subEdgeList) ### ---------------------------- SMESH -------------------------------------- +smesh.SetCurrentStudy(salome.myStudy) # ---- init a Mesh with the boxe diff --git a/src/SMESH_SWIG/SMESH_demo_hexa2_upd.py b/src/SMESH_SWIG/SMESH_demo_hexa2_upd.py index f5f6d65e5..ba48f57f6 100755 --- a/src/SMESH_SWIG/SMESH_demo_hexa2_upd.py +++ b/src/SMESH_SWIG/SMESH_demo_hexa2_upd.py @@ -124,6 +124,7 @@ for i in range(8): idEdgeZ.append(geompy.addToStudyInFather(vol,edgeZ[i],"EdgeZ"+str(i+1))) ### ---------------------------- SMESH -------------------------------------- +smesh.SetCurrentStudy(salome.myStudy) # ---- init a Mesh with the volume diff --git a/src/SMESH_SWIG/SMESH_fixation_hexa.py b/src/SMESH_SWIG/SMESH_fixation_hexa.py index 6a73b38b8..d556ffd23 100644 --- a/src/SMESH_SWIG/SMESH_fixation_hexa.py +++ b/src/SMESH_SWIG/SMESH_fixation_hexa.py @@ -45,6 +45,7 @@ status = geompy.CheckShape(compshell) print " check status ", status ### ---------------------------- SMESH -------------------------------------- +smesh.SetCurrentStudy(salome.myStudy) # ---- init a Mesh with the compshell shape_mesh = salome.IDToObject( idcomp ) diff --git a/src/SMESH_SWIG/SMESH_fixation_netgen.py b/src/SMESH_SWIG/SMESH_fixation_netgen.py index 16295a5e5..aad14b6cd 100644 --- a/src/SMESH_SWIG/SMESH_fixation_netgen.py +++ b/src/SMESH_SWIG/SMESH_fixation_netgen.py @@ -45,6 +45,7 @@ status = geompy.CheckShape(compshell) print " check status ", status ### ---------------------------- SMESH -------------------------------------- +smesh.SetCurrentStudy(salome.myStudy) print "-------------------------- create Mesh, algorithm, hypothesis" diff --git a/src/SMESH_SWIG/SMESH_fixation_tetra.py b/src/SMESH_SWIG/SMESH_fixation_tetra.py index 483cd666d..7af18468f 100644 --- a/src/SMESH_SWIG/SMESH_fixation_tetra.py +++ b/src/SMESH_SWIG/SMESH_fixation_tetra.py @@ -45,6 +45,7 @@ status = geompy.CheckShape(compshell) print " check status ", status ### ---------------------------- SMESH -------------------------------------- +smesh.SetCurrentStudy(salome.myStudy) # ---- init a Mesh with the compshell diff --git a/src/SMESH_SWIG/SMESH_flight_skin.py b/src/SMESH_SWIG/SMESH_flight_skin.py index 534bed16c..dcd788a52 100644 --- a/src/SMESH_SWIG/SMESH_flight_skin.py +++ b/src/SMESH_SWIG/SMESH_flight_skin.py @@ -55,6 +55,7 @@ print "number of Edges in flight : ", len(subEdgeList) ### ---------------------------- SMESH -------------------------------------- +smesh.SetCurrentStudy(salome.myStudy) # ---- init a Mesh with the shell shape_mesh = salome.IDToObject( idShape ) diff --git a/src/SMESH_SWIG/SMESH_freebord.py b/src/SMESH_SWIG/SMESH_freebord.py index 4c5fc646d..539451150 100644 --- a/src/SMESH_SWIG/SMESH_freebord.py +++ b/src/SMESH_SWIG/SMESH_freebord.py @@ -41,6 +41,7 @@ idbox = geompy.addToStudy( aBox, "box" ) aBox = salome.IDToObject( idbox ) # Create mesh +smesh.SetCurrentStudy(salome.myStudy) mesh = smesh.Mesh(aBox, "Mesh_freebord") diff --git a/src/SMESH_SWIG/SMESH_hexaedre.py b/src/SMESH_SWIG/SMESH_hexaedre.py index 4345b08b8..abec53438 100755 --- a/src/SMESH_SWIG/SMESH_hexaedre.py +++ b/src/SMESH_SWIG/SMESH_hexaedre.py @@ -95,6 +95,7 @@ salome.sg.updateObjBrowser(1) # ----------------------------------------------------------------------------- print "-------------------------- mesh" +smesh.SetCurrentStudy(salome.myStudy) # ---- init a Mesh with the geom shape shape_mesh = blob diff --git a/src/SMESH_SWIG/SMESH_mechanic.py b/src/SMESH_SWIG/SMESH_mechanic.py index 46032383c..134e8ee7e 100644 --- a/src/SMESH_SWIG/SMESH_mechanic.py +++ b/src/SMESH_SWIG/SMESH_mechanic.py @@ -120,6 +120,7 @@ name = geompy.SubShapeName( sub_face4, mechanic ) Id_SubFace4 = geompy.addToStudyInFather( mechanic, sub_face4, name ) # ---------------------------- SMESH -------------------------------------- +smesh.SetCurrentStudy(salome.myStudy) # -- Init -- shape_mesh = salome.IDToObject( Id_mechanic ) diff --git a/src/SMESH_SWIG/SMESH_mechanic_editor.py b/src/SMESH_SWIG/SMESH_mechanic_editor.py index 9ff002704..630b308b5 100644 --- a/src/SMESH_SWIG/SMESH_mechanic_editor.py +++ b/src/SMESH_SWIG/SMESH_mechanic_editor.py @@ -118,6 +118,7 @@ name = geompy.SubShapeName( sub_face4, mechanic ) Id_SubFace4 = geompy.addToStudyInFather( mechanic, sub_face4, name ) # ---------------------------- SMESH -------------------------------------- +smesh.SetCurrentStudy(salome.myStudy) # -- Init -- shape_mesh = salome.IDToObject( Id_mechanic ) diff --git a/src/SMESH_SWIG/SMESH_mechanic_netgen.py b/src/SMESH_SWIG/SMESH_mechanic_netgen.py index 038e64e0b..8fa15f583 100644 --- a/src/SMESH_SWIG/SMESH_mechanic_netgen.py +++ b/src/SMESH_SWIG/SMESH_mechanic_netgen.py @@ -104,6 +104,7 @@ print "number of Faces in mechanic : ",len(subFaceList) print "number of Edges in mechanic : ",len(subEdgeList) ### ---------------------------- SMESH -------------------------------------- +smesh.SetCurrentStudy(salome.myStudy) print "-------------------------- create Mesh, algorithm, hypothesis" diff --git a/src/SMESH_SWIG/SMESH_mechanic_tetra.py b/src/SMESH_SWIG/SMESH_mechanic_tetra.py index 1307067df..42f5bf896 100644 --- a/src/SMESH_SWIG/SMESH_mechanic_tetra.py +++ b/src/SMESH_SWIG/SMESH_mechanic_tetra.py @@ -104,6 +104,7 @@ print "number of Faces in mechanic : ",len(subFaceList) print "number of Edges in mechanic : ",len(subEdgeList) ### ---------------------------- SMESH -------------------------------------- +smesh.SetCurrentStudy(salome.myStudy) shape_mesh = salome.IDToObject( Id_mechanic ) diff --git a/src/SMESH_SWIG/SMESH_reg.py b/src/SMESH_SWIG/SMESH_reg.py index 92005898d..85f81731a 100644 --- a/src/SMESH_SWIG/SMESH_reg.py +++ b/src/SMESH_SWIG/SMESH_reg.py @@ -58,7 +58,7 @@ salome.sg.updateObjBrowser(1); # ---- launch SMESH smeshgui = salome.ImportComponentGUI("SMESH") smeshgui.Init(salome.myStudyId) - +smesh.SetCurrentStudy(salome.myStudy) # ---- Creating meshes diff --git a/src/SMESH_SWIG/SMESH_test.py b/src/SMESH_SWIG/SMESH_test.py index da4eda843..e08256cb4 100644 --- a/src/SMESH_SWIG/SMESH_test.py +++ b/src/SMESH_SWIG/SMESH_test.py @@ -56,6 +56,7 @@ ide = geompy.addToStudyInFather(face, edge, name) # ---- SMESH +smesh.SetCurrentStudy(salome.myStudy) box = salome.IDToObject(idb) mesh = smesh.Mesh(box, "Meshbox") diff --git a/src/SMESH_SWIG/SMESH_test1.py b/src/SMESH_SWIG/SMESH_test1.py index cd68018d2..169ca7a4f 100644 --- a/src/SMESH_SWIG/SMESH_test1.py +++ b/src/SMESH_SWIG/SMESH_test1.py @@ -60,6 +60,8 @@ idedge = geompy.addToStudyInFather(face, edge, name) # ---- SMESH +smesh.SetCurrentStudy(salome.myStudy) + # ---- Init a Mesh with the box mesh = smesh.Mesh(box, "Meshbox") diff --git a/src/SMESH_SWIG/SMESH_test1_AndDisplay.py b/src/SMESH_SWIG/SMESH_test1_AndDisplay.py index c87694894..96e502821 100644 --- a/src/SMESH_SWIG/SMESH_test1_AndDisplay.py +++ b/src/SMESH_SWIG/SMESH_test1_AndDisplay.py @@ -60,6 +60,8 @@ idedge = geompy.addToStudyInFather(face, edge, name) # ---- SMESH +smesh.SetCurrentStudy(salome.myStudy) + # ---- Init a Mesh with the box mesh = smesh.Mesh(box, "Meshbox") diff --git a/src/SMESH_SWIG/SMESH_test4.py b/src/SMESH_SWIG/SMESH_test4.py index 181833934..c2ac4c480 100755 --- a/src/SMESH_SWIG/SMESH_test4.py +++ b/src/SMESH_SWIG/SMESH_test4.py @@ -40,6 +40,7 @@ face = salome.IDToObject(idface) # ---- SMESH +smesh.SetCurrentStudy(salome.myStudy) mesh = smesh.Mesh(box, "Meshbox") # Set 1D algorithm/hypotheses to mesh diff --git a/src/SMESH_SWIG/SMESH_test5.py b/src/SMESH_SWIG/SMESH_test5.py index 616f0e39d..f80dffc4c 100644 --- a/src/SMESH_SWIG/SMESH_test5.py +++ b/src/SMESH_SWIG/SMESH_test5.py @@ -30,6 +30,8 @@ import CORBA import os import os.path +smesh.SetCurrentStudy(salome.myStudy) + def SetSObjName(theSObj,theName) : ok, anAttr = theSObj.FindAttribute("AttributeName") if ok: -- 2.39.2