X-Git-Url: http://git.salome-platform.org/gitweb/?a=blobdiff_plain;f=src%2Fsalome_hydro%2Fstudy.py;h=f045f9b77d0a6d93d4b37bc5a0806cfc50280939;hb=4fe9554e65e8a87fce1d81bebbb2f18c63d8af99;hp=bc5f4d39b92c1bdee149f010225b525c30e0470b;hpb=99fb0a095cfaa3c5c774438e0e160d33b77e0db7;p=modules%2Fhydrosolver.git diff --git a/src/salome_hydro/study.py b/src/salome_hydro/study.py index bc5f4d3..f045f9b 100644 --- a/src/salome_hydro/study.py +++ b/src/salome_hydro/study.py @@ -171,7 +171,7 @@ class HydroStudyEditor: comment = str(filePath), typeId = TELEMAC2D_CASE_TYPE_ID) - def generate_study_script(self, filePath) + def generate_study_script(self, filePath): """ Generating a python script from the eficas info """ @@ -181,27 +181,38 @@ class HydroStudyEditor: jdc = jdcfile.read() params = jdc_to_dict(jdc, ["TELEMAC2D", "_F"]) + # Generation script string python_script = generate_study_script(params) - print python_script - def generate_study_yacs(self, filePath) + # Computing name of the file (same as filePath) + file_dir, filename = os.path.split(filePath) + root, sfx = os.path.splitext(filename) + python_file = os.path.join(file_dir,root+".py") + + # Writting to file + with open(python_file,'w') as pfile: + pfile.write(python_script) + + def generate_study_yacs(self, filePath): """ Generating a yacs file from the eficas info """ # Create "Python script" item - from TelApy.api.generate_study import generate_yacs_study + from TelApy.api.generate_study import generate_study_yacs with open(filePath) as jdcfile: jdc = jdcfile.read() params = jdc_to_dict(jdc, ["TELEMAC2D", "_F"]) - yacs_scheme = generate_yacs_study(params) - file_dir = os.path.basename(filePath) - root, sfx = filePath.splitext() - yacs_file = os.path.join(file_dir,root+".xml") + # Generation YACS scheme + yacs_scheme = generate_study_yacs(params) - print yacs_file - print yacs_scheme + # Computing name of the file (same as filePath) + file_dir, filename = os.path.split(filePath) + root, sfx = os.path.splitext(filename) + yacs_file = os.path.join(file_dir,root+".xml") + # Writting to file + yacs_scheme.saveSchema(yacs_file) def find_or_create_coupling1d2d_case(self, filePath): self.find_or_create_hydro_component()