Salome HOME
Final modifications
authorYoann AUDOUIN <B61570@dsp0761867.postes.calibre.edf.fr>
Mon, 12 Jun 2017 08:53:42 +0000 (10:53 +0200)
committerYoann AUDOUIN <B61570@dsp0761867.postes.calibre.edf.fr>
Mon, 12 Jun 2017 08:53:42 +0000 (10:53 +0200)
src/salome_hydro/study.py

index dfb0371494f6691871ad52d65cc335851a669a49..b4cecc5e281aba899bd0b0d4605526989f496792 100644 (file)
@@ -181,27 +181,32 @@ class HydroStudyEditor:
             jdc = jdcfile.read()
         params = jdc_to_dict(jdc, ["TELEMAC2D", "_F"])
 
+        yacs_scheme = generate_yacs_study(params)
+        file_dir, filename = os.path.split(filePath)
+        root, sfx = os.path.splitext(filename)
+        python_file = os.path.join(file_dir,root+".xml")
+
         python_script = generate_study_script(params)
-        print python_script
+        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()
+        file_dir, filename = os.path.split(filePath)
+        root, sfx = os.path.splitext(filename)
         yacs_file = os.path.join(file_dir,root+".xml")
 
-        print yacs_file
-        print yacs_scheme
-
+        yacs_scheme = generate_study_yacs(params)
+        yacs_scheme.saveScheme(yacs_file)
 
     def find_or_create_coupling1d2d_case(self, filePath):
         self.find_or_create_hydro_component()