Welcome to the forums. Please post in English or French.

You are not logged in.

#1 2019-11-04 19:03:54

Registered: 2019-10-21
Posts: 9

Command to export MED file

Hello community,

I am automating the simulation process of Code Aster using a bash script. Right now I can export multiple dump studies and change automatically some values of the geometry. I just have one question, how can I automatically export the MED file in the specific folder?
Right now with my bash script, I am using the echo command to add to the dump study the "command" and path to export the med file:

Mesh_1.ExportMED( r\047/'${path}'/'Template_${step_x}_${step_y}'/Mesh_1.med\047, 0, SMESH.MED_V2_2, 1, None ,1)
print \047ExportToMEDX() failed.
Invalid file name?

This does not automatically export me the med file but If I open the dump study with Salome and compute the mesh, it automatically export the med file to the right folder.

How can I fix this?

Thank you very much, I have attached the dump.py file


#2 2019-11-04 21:43:14

Registered: 2012-06-27
Posts: 68

Re: Command to export MED file


I am not sure python can handle environment variables (from shell) in this way (I suppose the dump.py thrown the exception of your try/except condition), it is more complicated I think, you cannot pass variable from shell to python script in this way especially because the dump.py is executed by salome session and not by the shell. But to be honest I never tried it. If you follow my example I gave you in an other post, the param dict file can handle this simply (as it is already done in the 144 line of salomeScript.py).