Salome HOME
Fix bug on PARAMETRIC component loading in batch
authorRenaud Barate <renaud.barate@edf.fr>
Thu, 25 Apr 2013 15:28:27 +0000 (17:28 +0200)
committerRenaud Barate <renaud.barate@edf.fr>
Thu, 25 Apr 2013 15:28:27 +0000 (17:28 +0200)
Data in PARAMETRIC component was not read correctly
from the study when the parametric study was run in
batch mode.

src/salome/parametric/genjob.py

index 1acde4d57dba7b5b6c0a7563c3a3b88dec8680ce..04c0aa06961b32896896e842142cd9fd82f48995 100644 (file)
@@ -24,10 +24,10 @@ import salome
 from salome.kernel.studyedit import getStudyEditor
 from study import ParametricStudy
 
-job_script_template = """
-#!/usr/bin/env python
+job_script_template = """#!/usr/bin/env python
 
 import salome
+from salome.kernel.studyedit import getStudyEditor
 import PARAMETRIC
 
 salome.salome_init()
@@ -35,8 +35,12 @@ salome.salome_init()
 # load study
 study = salome.myStudyManager.Open("%(input_study)s")
 
-# start container and load PARAMETRIC component
-comp = salome.lcc.FindOrLoadComponent("ParametricContainer", "PARAMETRIC")
+# start container, load PARAMETRIC component and load the content of the parametric study in the component
+ed = getStudyEditor(study._get_StudyId())
+sobj = study.FindObjectID("%(param_entry)s")
+scomp = sobj.GetFatherComponent()
+ed.loadComponentEngine(scomp, "ParametricContainer")
+comp = scomp.GetObject()
 
 # run parametric study
 comp.RunStudy(study._get_StudyId(), "%(param_entry)s")