From ec5be50bc68e8aa3b5added7eb9ba2da21572798 Mon Sep 17 00:00:00 2001 From: jfa Date: Mon, 12 Dec 2005 10:12:42 +0000 Subject: [PATCH] Improve scripts; temporarily comment some lines due to bug 10000. --- src/VISU_SWIG/VISU_Example_01.py | 13 +++++++++---- src/VISU_SWIG/VISU_Example_02.py | 28 ++++++++++++++++++++-------- src/VISU_SWIG/VISU_Example_04.py | 2 +- src/VISU_SWIG/VISU_Example_06.py | 2 +- 4 files changed, 31 insertions(+), 14 deletions(-) diff --git a/src/VISU_SWIG/VISU_Example_01.py b/src/VISU_SWIG/VISU_Example_01.py index 82228544..d8c19b65 100644 --- a/src/VISU_SWIG/VISU_Example_01.py +++ b/src/VISU_SWIG/VISU_Example_01.py @@ -82,11 +82,16 @@ myView.DisplayOnly(cutplanes) #%====================Stage4: Opening a new study and Med file import====================% -print "**** Stage4: Opening a new study and Med file import" +# Opening a new study tempoparily commented due to a problem +# with python initialization. To be restored after bug 10000 fixing. -print "Creating a new study..................", -newStudy = salome.myStudyManager.NewStudy('newStudy') -myVisu.SetCurrentStudy(newStudy) +#print "**** Stage4: Opening a new study and Med file import" +print "**** Stage4: Med file import" + +#print "Creating a new study..................", +#newStudy = salome.myStudyManager.NewStudy('newStudy') +newStudy = salome.myStudy # temporarily +#myVisu.SetCurrentStudy(newStudy) myViewManager = myVisu.GetViewManager() myView = myViewManager.Create3DView() if myView is None : print "Error" diff --git a/src/VISU_SWIG/VISU_Example_02.py b/src/VISU_SWIG/VISU_Example_02.py index be71fa76..38f2b6b6 100644 --- a/src/VISU_SWIG/VISU_Example_02.py +++ b/src/VISU_SWIG/VISU_Example_02.py @@ -222,28 +222,37 @@ file = str+'/VISU_005.hdf' salome.myStudyManager.SaveAs(file, salome.myStudy, 0) study_id = salome.myStudy._get_StudyId() -#salome.sg.CloseStudy(study_id) -#salome.myStudyManager.Close(salome.myStudy) -#salome.myStudy.Close() print "OK" -print "Opening just saved study..............", +file_new = str+'/VISU_005_new.hdf' +command = "mv " + file + " " + file_new +os.system(command) +file = file_new -openedStudy = salome.myStudyManager.Open(file) -myVisu.SetCurrentStudy(openedStudy) +# Opening a study tempoparily commented due to a problem +# with python initialization. To be restored after bug 10000 fixing. + +#print "Opening just saved study..............", +# +#openedStudy = salome.myStudyManager.Open(file)] +openedStudy = salome.myStudy # temporarily +#myVisu.SetCurrentStudy(openedStudy) myViewManager = myVisu.GetViewManager() myView1 = myViewManager.Create3DView() if myView1 is None : print "Error" else : print "OK" +import time +time.sleep(1) + print "Restoring first view parameters.......", aRestoreRes = myView1.RestoreViewParams(aViewParamsName1) if aRestoreRes != 1 : print "Error" else : print "OK" Builder = openedStudy.NewBuilder() -SCom = openedStudy.FindComponent("VISU") -Builder.LoadWith(SCom ,myVisu) +#SCom = openedStudy.FindComponent("VISU") +#Builder.LoadWith(SCom ,myVisu) print "Displaying Scalar Map.................", SObj = openedStudy.FindObject('ScalarMap') @@ -346,3 +355,6 @@ aRestoreRes = myView1.RestoreViewParams(aViewParamsName2) if aRestoreRes != 1 : print "Error" else : print "OK" +# Remove the study file +command = "rm -r " + file +os.system(command) diff --git a/src/VISU_SWIG/VISU_Example_04.py b/src/VISU_SWIG/VISU_Example_04.py index a50a831a..9ae4d110 100644 --- a/src/VISU_SWIG/VISU_Example_04.py +++ b/src/VISU_SWIG/VISU_Example_04.py @@ -46,7 +46,7 @@ aMeshName ="LE VOLUME" anEntity = VISU.NODE aTimeStampId = 1 -medFile = os.getenv('DATA_DIR') + '/MedFIles/' + medFile +medFile = os.getenv('DATA_DIR') + '/MedFiles/' + medFile myResult = myVisu.ImportFile(medFile) myView = myViewManager.Create3DView(); diff --git a/src/VISU_SWIG/VISU_Example_06.py b/src/VISU_SWIG/VISU_Example_06.py index f31b80e4..622b6cb4 100644 --- a/src/VISU_SWIG/VISU_Example_06.py +++ b/src/VISU_SWIG/VISU_Example_06.py @@ -4,7 +4,7 @@ import salome import math import SALOMEDS import VISU -#from visu_gui import * +from visu_gui import * # >>> Getting study builder ================================================== myStudy = salome.myStudy -- 2.39.2