0020623: EDF 1209 SMESH: Load script/execfile add the objects in the wrong study

set current study to SMESH_Gen
This commit is contained in:
eap 2009-12-21 08:24:08 +00:00
parent 31873e6e23
commit 0c1e7c3900
29 changed files with 35 additions and 4 deletions

View File

@ -54,7 +54,7 @@ Id_face1 = geompy.addToStudy(face1,"Face1")
#-----------------------------SMESH------------------------------------------- #-----------------------------SMESH-------------------------------------------
smesh.SetCurrentStudy(salome.myStudy)
# -- Init mesh -- # -- Init mesh --
plane_mesh = salome.IDToObject( Id_face1) plane_mesh = salome.IDToObject( Id_face1)

View File

@ -52,6 +52,7 @@ id_ellipse2 = geompy.addToStudy(ellipse2, "Ellips 2")
#---------------------------------SMESH #---------------------------------SMESH
smesh.SetCurrentStudy(salome.myStudy)
# create the path mesh # create the path mesh
mesh1 = smesh.Mesh(ellipse1, "Path Mesh") mesh1 = smesh.Mesh(ellipse1, "Path Mesh")

View File

@ -50,6 +50,7 @@ idcircle = geompy.addToStudy(circle, "Circle")
idface = geompy.addToStudy(face, "Circular face") idface = geompy.addToStudy(face, "Circular face")
smesh.SetCurrentStudy(salome.myStudy)
# init a Mesh with the circular face # init a Mesh with the circular face
mesh1 = smesh.Mesh(face, "Mesh on circular face") mesh1 = smesh.Mesh(face, "Mesh on circular face")

View File

@ -51,7 +51,8 @@ def GetNewNodes(mesh,Elems,OldNodes):
pass pass
return newnodes return newnodes
smesh.SetCurrentStudy(salome.myStudy)
# create empty mesh # create empty mesh
mesh = smesh.Mesh() mesh = smesh.Mesh()

View File

@ -61,6 +61,8 @@ geompy.addToStudy(Box_sup, "Box_sup")
geompy.addToStudyInFather(Box_sup, Fsup2, "Fsup") geompy.addToStudyInFather(Box_sup, Fsup2, "Fsup")
geompy.addToStudyInFather(Box_sup, Finf2, "Finf") geompy.addToStudyInFather(Box_sup, Finf2, "Finf")
smesh.SetCurrentStudy(salome.myStudy)
## create a bottom mesh ## create a bottom mesh
Mesh_inf = smesh.Mesh(Box_inf, "Mesh_inf") Mesh_inf = smesh.Mesh(Box_inf, "Mesh_inf")
algo1D_1=Mesh_inf.Segment() algo1D_1=Mesh_inf.Segment()

View File

@ -97,6 +97,8 @@ Cut_1_ID = geompy.addToStudy(Cut_1, "Cut_1")
#Mesh creation #Mesh creation
smesh.SetCurrentStudy(salome.myStudy)
# -- Init -- # -- Init --
shape_mesh = salome.IDToObject( Cut_1_ID ) shape_mesh = salome.IDToObject( Cut_1_ID )

View File

@ -119,6 +119,7 @@ status = geompy.CheckShape(alveole)
print " check status ", status print " check status ", status
# ---- launch SMESH # ---- launch SMESH
smesh.SetCurrentStudy(salome.myStudy)
# ---- init a Mesh with the alveole # ---- init a Mesh with the alveole
shape_mesh = salome.IDToObject( idalveole ) shape_mesh = salome.IDToObject( idalveole )

View File

@ -103,6 +103,7 @@ Id_Result = addToStudy(Result, "Result")
#----------------------------------------------------------------------- #-----------------------------------------------------------------------
#Meshing #Meshing
smesh.SetCurrentStudy(salome.myStudy)
my_hexa = smesh.Mesh(Result, "Sphere_Mesh") my_hexa = smesh.Mesh(Result, "Sphere_Mesh")
algo = my_hexa.Segment() algo = my_hexa.Segment()
algo.NumberOfSegments(NbSeg) algo.NumberOfSegments(NbSeg)

View File

@ -47,6 +47,7 @@ box = geompy.MakeBox(0.,0.,0.,1.,1.,1.)
boxId = geompy.addToStudy(box,"box") boxId = geompy.addToStudy(box,"box")
# ---- SMESH # ---- SMESH
smesh.SetCurrentStudy(salome.myStudy)
# ---- init a Mesh # ---- init a Mesh

View File

@ -73,6 +73,7 @@ print "number of Edges in shell : ", len(subEdgeList)
### ---------------------------- SMESH -------------------------------------- ### ---------------------------- SMESH --------------------------------------
smesh.SetCurrentStudy(salome.myStudy)
# ---- init a Mesh with the shell # ---- init a Mesh with the shell

View File

@ -84,7 +84,7 @@ print "number of Edges in shell : ", len(subEdgeList)
### ---------------------------- SMESH -------------------------------------- ### ---------------------------- SMESH --------------------------------------
smesh.SetCurrentStudy(salome.myStudy)
# ---- init a Mesh with the shell # ---- init a Mesh with the shell

View File

@ -45,6 +45,7 @@ print "number of Edges in box : ", len(subEdgeList)
### ---------------------------- SMESH -------------------------------------- ### ---------------------------- SMESH --------------------------------------
smesh.SetCurrentStudy(salome.myStudy)
# ---- init a Mesh with the boxe # ---- init a Mesh with the boxe

View File

@ -124,6 +124,7 @@ for i in range(8):
idEdgeZ.append(geompy.addToStudyInFather(vol,edgeZ[i],"EdgeZ"+str(i+1))) idEdgeZ.append(geompy.addToStudyInFather(vol,edgeZ[i],"EdgeZ"+str(i+1)))
### ---------------------------- SMESH -------------------------------------- ### ---------------------------- SMESH --------------------------------------
smesh.SetCurrentStudy(salome.myStudy)
# ---- init a Mesh with the volume # ---- init a Mesh with the volume

View File

@ -45,6 +45,7 @@ status = geompy.CheckShape(compshell)
print " check status ", status print " check status ", status
### ---------------------------- SMESH -------------------------------------- ### ---------------------------- SMESH --------------------------------------
smesh.SetCurrentStudy(salome.myStudy)
# ---- init a Mesh with the compshell # ---- init a Mesh with the compshell
shape_mesh = salome.IDToObject( idcomp ) shape_mesh = salome.IDToObject( idcomp )

View File

@ -45,6 +45,7 @@ status = geompy.CheckShape(compshell)
print " check status ", status print " check status ", status
### ---------------------------- SMESH -------------------------------------- ### ---------------------------- SMESH --------------------------------------
smesh.SetCurrentStudy(salome.myStudy)
print "-------------------------- create Mesh, algorithm, hypothesis" print "-------------------------- create Mesh, algorithm, hypothesis"

View File

@ -45,6 +45,7 @@ status = geompy.CheckShape(compshell)
print " check status ", status print " check status ", status
### ---------------------------- SMESH -------------------------------------- ### ---------------------------- SMESH --------------------------------------
smesh.SetCurrentStudy(salome.myStudy)
# ---- init a Mesh with the compshell # ---- init a Mesh with the compshell

View File

@ -55,6 +55,7 @@ print "number of Edges in flight : ", len(subEdgeList)
### ---------------------------- SMESH -------------------------------------- ### ---------------------------- SMESH --------------------------------------
smesh.SetCurrentStudy(salome.myStudy)
# ---- init a Mesh with the shell # ---- init a Mesh with the shell
shape_mesh = salome.IDToObject( idShape ) shape_mesh = salome.IDToObject( idShape )

View File

@ -41,6 +41,7 @@ idbox = geompy.addToStudy( aBox, "box" )
aBox = salome.IDToObject( idbox ) aBox = salome.IDToObject( idbox )
# Create mesh # Create mesh
smesh.SetCurrentStudy(salome.myStudy)
mesh = smesh.Mesh(aBox, "Mesh_freebord") mesh = smesh.Mesh(aBox, "Mesh_freebord")

View File

@ -95,6 +95,7 @@ salome.sg.updateObjBrowser(1)
# ----------------------------------------------------------------------------- # -----------------------------------------------------------------------------
print "-------------------------- mesh" print "-------------------------- mesh"
smesh.SetCurrentStudy(salome.myStudy)
# ---- init a Mesh with the geom shape # ---- init a Mesh with the geom shape
shape_mesh = blob shape_mesh = blob

View File

@ -120,6 +120,7 @@ name = geompy.SubShapeName( sub_face4, mechanic )
Id_SubFace4 = geompy.addToStudyInFather( mechanic, sub_face4, name ) Id_SubFace4 = geompy.addToStudyInFather( mechanic, sub_face4, name )
# ---------------------------- SMESH -------------------------------------- # ---------------------------- SMESH --------------------------------------
smesh.SetCurrentStudy(salome.myStudy)
# -- Init -- # -- Init --
shape_mesh = salome.IDToObject( Id_mechanic ) shape_mesh = salome.IDToObject( Id_mechanic )

View File

@ -118,6 +118,7 @@ name = geompy.SubShapeName( sub_face4, mechanic )
Id_SubFace4 = geompy.addToStudyInFather( mechanic, sub_face4, name ) Id_SubFace4 = geompy.addToStudyInFather( mechanic, sub_face4, name )
# ---------------------------- SMESH -------------------------------------- # ---------------------------- SMESH --------------------------------------
smesh.SetCurrentStudy(salome.myStudy)
# -- Init -- # -- Init --
shape_mesh = salome.IDToObject( Id_mechanic ) shape_mesh = salome.IDToObject( Id_mechanic )

View File

@ -104,6 +104,7 @@ print "number of Faces in mechanic : ",len(subFaceList)
print "number of Edges in mechanic : ",len(subEdgeList) print "number of Edges in mechanic : ",len(subEdgeList)
### ---------------------------- SMESH -------------------------------------- ### ---------------------------- SMESH --------------------------------------
smesh.SetCurrentStudy(salome.myStudy)
print "-------------------------- create Mesh, algorithm, hypothesis" print "-------------------------- create Mesh, algorithm, hypothesis"

View File

@ -104,6 +104,7 @@ print "number of Faces in mechanic : ",len(subFaceList)
print "number of Edges in mechanic : ",len(subEdgeList) print "number of Edges in mechanic : ",len(subEdgeList)
### ---------------------------- SMESH -------------------------------------- ### ---------------------------- SMESH --------------------------------------
smesh.SetCurrentStudy(salome.myStudy)
shape_mesh = salome.IDToObject( Id_mechanic ) shape_mesh = salome.IDToObject( Id_mechanic )

View File

@ -58,7 +58,7 @@ salome.sg.updateObjBrowser(1);
# ---- launch SMESH # ---- launch SMESH
smeshgui = salome.ImportComponentGUI("SMESH") smeshgui = salome.ImportComponentGUI("SMESH")
smeshgui.Init(salome.myStudyId) smeshgui.Init(salome.myStudyId)
smesh.SetCurrentStudy(salome.myStudy)
# ---- Creating meshes # ---- Creating meshes

View File

@ -56,6 +56,7 @@ ide = geompy.addToStudyInFather(face, edge, name)
# ---- SMESH # ---- SMESH
smesh.SetCurrentStudy(salome.myStudy)
box = salome.IDToObject(idb) box = salome.IDToObject(idb)
mesh = smesh.Mesh(box, "Meshbox") mesh = smesh.Mesh(box, "Meshbox")

View File

@ -60,6 +60,8 @@ idedge = geompy.addToStudyInFather(face, edge, name)
# ---- SMESH # ---- SMESH
smesh.SetCurrentStudy(salome.myStudy)
# ---- Init a Mesh with the box # ---- Init a Mesh with the box
mesh = smesh.Mesh(box, "Meshbox") mesh = smesh.Mesh(box, "Meshbox")

View File

@ -60,6 +60,8 @@ idedge = geompy.addToStudyInFather(face, edge, name)
# ---- SMESH # ---- SMESH
smesh.SetCurrentStudy(salome.myStudy)
# ---- Init a Mesh with the box # ---- Init a Mesh with the box
mesh = smesh.Mesh(box, "Meshbox") mesh = smesh.Mesh(box, "Meshbox")

View File

@ -40,6 +40,7 @@ face = salome.IDToObject(idface)
# ---- SMESH # ---- SMESH
smesh.SetCurrentStudy(salome.myStudy)
mesh = smesh.Mesh(box, "Meshbox") mesh = smesh.Mesh(box, "Meshbox")
# Set 1D algorithm/hypotheses to mesh # Set 1D algorithm/hypotheses to mesh

View File

@ -30,6 +30,8 @@ import CORBA
import os import os
import os.path import os.path
smesh.SetCurrentStudy(salome.myStudy)
def SetSObjName(theSObj,theName) : def SetSObjName(theSObj,theName) :
ok, anAttr = theSObj.FindAttribute("AttributeName") ok, anAttr = theSObj.FindAttribute("AttributeName")
if ok: if ok: