Open HDF file from python file???
Hi everybody,
for an Optimization loop I need to open hdf file from python file. What is the command please? I just tried the command
study = salome.myStudyManager.OpenStudy("/home/user/MyStudy.hdf")
but it doesn't work.
Thank you all for the time and consideration.
FF
Hi Fabio
I usually use such code to open a study and then use SMESH commands on it
salome.myStudy = salome.myStudyManager.Open( file_name )
salome.myStudyId = salome.myStudy._get_StudyId()
salome.myStudyName = salome.myStudy._get_Name()
meshCompSO = salome.myStudy.FindComponent("SMESH")
b = salome.myStudy.NewBuilder()
b.LoadWith( meshCompSO, smesh.smesh )
Regards
Edward
Hi Fabio,
I don't know on Windows, but on Linux, I simply type:
salome Study1.hdf
in a console and Salome loads automatically the HDF file after opening.
So, maybe you could just use a "os.system" command to do it from your Python script:
import os
fileName = "Study1.hdf"
os.system( "salome " + fileName )
I hope it's what you were looking for.
Best regards,
William
PS: My "salome" command is an alias of:
source /opt/salome/salome_6.5.0/KERNEL_6.5.0/salome.sh
/opt/salome/salome_6.5.0/KERNEL_6.5.0/bin/salome/runSalomeI installed my Salome version into my /opt/salome/ folder, but on your computer (or server), it can be different, of course 
Thanks for the replies. It finally works. Another question: I create a compound mesh (call compound_mesh) and I have to extrude it (from python file) and export it (in UNV format, from python file too). How can I do it?
Thank you
## Generates new elements by extrusion of the elements which belong to the object
# @param theObject the object which elements should be processed.
# It can be a mesh, a sub mesh or a group.
# @param StepVector vector, defining the direction and value of extrusion for one step (the total extrusion length will be NbOfSteps * ||StepVector||)
# @param NbOfSteps the number of steps
# @param MakeGroups forces the generation of new groups from existing ones
# @param IsNodes is True if elements which belong to the object are nodes
# @return list of created groups (SMESH_GroupBase) if MakeGroups=True, empty list otherwise
# @ingroup l2_modif_extrurev
def ExtrusionSweepObject(self, theObject, StepVector, NbOfSteps, MakeGroups=False, IsNodes=False):
## Exports the mesh in a file in UNV format
# @param f the file name
# @param meshPart a part of mesh (group, sub-mesh) to export instead of the mesh
# @ingroup l2_impexp
def ExportUNV(self, f, meshPart=None):
St.Michael
