From 8f66ff07090425dd1a36b755cdd09f671f8b2da4 Mon Sep 17 00:00:00 2001 From: smh Date: Thu, 29 Jan 2004 13:42:13 +0000 Subject: [PATCH] MPV: Merge V1_2d --- src/VISU_SWIG/Makefile.in | 3 +- src/VISU_SWIG/batchmode_visu_table.py | 2 +- src/VISU_SWIG/visu.py | 41 ++++++++++++--------------- src/VISU_SWIG/visu_big_table.py | 2 +- src/VISU_SWIG/visu_med.py | 2 +- src/VISU_SWIG/visu_prs_example.py | 2 +- src/VISU_SWIG/visu_table.py | 2 +- 7 files changed, 24 insertions(+), 30 deletions(-) diff --git a/src/VISU_SWIG/Makefile.in b/src/VISU_SWIG/Makefile.in index b81b2a87..ff40e7bc 100644 --- a/src/VISU_SWIG/Makefile.in +++ b/src/VISU_SWIG/Makefile.in @@ -45,7 +45,6 @@ EXPORT_PYSCRIPTS = libVISU_Swig.py batchmode_visu.py batchmode_visu_table.py bat visu_med.py visu_view3d.py visu.py visu_gui.py visu_prs_example.py\ visu_table.py visu_big_table.py visu_view.py \ visu_swig_test.py - EXPORT_SHAREDPYSCRIPTS = VISU_shared_modules.py LIB_CLIENT_IDL = @@ -55,4 +54,4 @@ CPPFLAGS += -ftemplate-depth-32 $(PYTHON_INCLUDES) $(QT_INCLUDES) \ LDFLAGS += $(PYTHON_LIBS) -lVisuConvertor -lVisuPipeLine @CONCLUDE@ - + \ No newline at end of file diff --git a/src/VISU_SWIG/batchmode_visu_table.py b/src/VISU_SWIG/batchmode_visu_table.py index e8c0afa7..fe85ef75 100644 --- a/src/VISU_SWIG/batchmode_visu_table.py +++ b/src/VISU_SWIG/batchmode_visu_table.py @@ -19,7 +19,7 @@ import math myBuilder = myStudy.NewBuilder() # >>> Getting (loading) VISU component ======================================= -myVisu = lcc.FindOrLoadComponent("FactoryServer", "Visu") +myVisu = lcc.FindOrLoadComponent("FactoryServer", "VISU") myComponent = myStudy.FindComponent("VISU") myVisu.SetCurrentStudy(myStudy) if not myComponent: diff --git a/src/VISU_SWIG/visu.py b/src/VISU_SWIG/visu.py index 1cb4f7ce..86d8adc8 100644 --- a/src/VISU_SWIG/visu.py +++ b/src/VISU_SWIG/visu.py @@ -10,10 +10,10 @@ import os import re from time import sleep -# import VISU import SALOME +import SALOME_Session_idl import SALOMEDS import SALOME_MED from omniORB import CORBA @@ -39,6 +39,7 @@ def Initialize(theORB, theNamingService, theLifeCycleCORBA, theStudyManager, the myLifeCycleCORBA = theLifeCycleCORBA myLocalStudyManager = theStudyManager mySession = myNamingService.Resolve("/Kernel/Session") + mySession = mySession._narrow(SALOME.Session) mySession.GetInterface() myDelay = theDelay sleep(myDelay) @@ -76,10 +77,10 @@ def HasValue(theList, theValue) : def CreateStudyForMed(theVisu, theFileName) : print "CreateStudyForMed ", theFileName, if os.path.isfile(theFileName) : - if os.path.splitext(theFileName)[1] == '.med' : + if re.search("\.med$", theFileName) is not None : print "OK" aStudyName = os.path.basename(theFileName) - aStudyName = os.path.splitext(aStudyName)[0] + aStudyName = re.sub(r'\.med', "", aStudyName) aStudyName = generateName(aStudyName) print "myLocalStudyManager.NewStudy -", aStudyName, "...", aStudy = myLocalStudyManager.NewStudy(aStudyName) @@ -169,7 +170,7 @@ def CreatePrsForMed(theVisu, theFileName, thePrsTypeList, thePictureDir, thePict aVISUObjList.append(aResult) aVISUObjList.extend(CreatePrsForResult(theVisu, aResult, myView, thePrsTypeList, thePictureDir, thePictureExt)) - aFolderIter = myLocalStudy.NewChildIterator(aMedSObj); + aFolderIter = myLocalStudy.NewChildIterator(aMedSObj.GetFather()); while aFolderIter.More() : aFolderSObj = aFolderIter.Value() aFolderIter.Next() @@ -242,7 +243,7 @@ def CreatePrsForFile(theVisu, theFileName, thePrsTypeList, thePictureDir, thePic # try: aVISUObjList = [myLocalStudy, myViewManager, myView] = CreateStudyForMed(theVisu, theFileName) - print "theVisu.ImportMed..." + print "theVisu.ImportMed...", aResult = theVisu.ImportFile(theFileName) if aResult is None : raise RuntimeError, "Error" else : print "OK" @@ -423,7 +424,7 @@ def CreatePrsForResult(theVisu, theResult, theView, thePrsTypeList, thePictureDi aPrsObj = theVisu.CutPlanesOnField(theResult,aMeshName,anEntity,aFieldName,aTimeStampId) if aPrsObj is None : print "Error" else : print ",OK" - aPrsObj.SetOrientationType(VISU.CutPlanes.ZX) + aPrsObj.SetOrientation(VISU.CutPlanes.ZX,aPrsObj.GetRotateX(),aPrsObj.GetRotateY()) theView.DisplayOnly(aPrsObj) theView.FitAll() aPictureName = thePictureDir + aMeshNamePic + "_" + anEntityId + "_" + aFieldName + "_" + str(aTimeStampId) + "_TCUTPLANES." + thePictureExt @@ -436,8 +437,8 @@ def CreatePrsForResult(theVisu, theResult, theView, thePrsTypeList, thePictureDi aPrsObj = theVisu.CutLinesOnField(theResult,aMeshName,anEntity,aFieldName,aTimeStampId) if aPrsObj is None : print "Error" else : print ",OK" - aPrsObj.SetOrientationType(VISU.CutPlanes.XY) - aPrsObj.SetOrientationType2(VISU.CutPlanes.ZX) + aPrsObj.SetOrientation(VISU.CutPlanes.XY,aPrsObj.GetRotateX(),aPrsObj.GetRotateY()) + aPrsObj.SetOrientation2(VISU.CutPlanes.ZX,aPrsObj.GetRotateX2(),aPrsObj.GetRotateY2()) theView.DisplayOnly(aPrsObj) theView.FitAll() aPictureName = thePictureDir + aMeshNamePic + "_" + anEntityId + "_" + aFieldName + "_" + str(aTimeStampId) + "_TCUTLINES." + thePictureExt @@ -461,7 +462,7 @@ def CreatePrsForResult(theVisu, theResult, theView, thePrsTypeList, thePictureDi if HasValue(thePrsTypeList,VISU.TVECTORS) : print " Creating VectorsOnField", - aPrsObj = theVisu.VectorsOnField(theResult,aMeshNamePic,anEntity,aFieldName,aTimeStampId) + aPrsObj = theVisu.VectorsOnField(theResult,aMeshName,anEntity,aFieldName,aTimeStampId) if aPrsObj is None : print "Error" else : print ",OK" theView.DisplayOnly(aPrsObj) @@ -632,10 +633,6 @@ def try_cutplanes_parameters(thePattern) : ind = random.randint(1,2) anObj = try_scalarmap_parameters(thePattern) - # --- ORIENTATION --- - anObj.SetOrientationType(ORIENT[random.randint(0,2)]) - - # --- NUMBER OF PLANES --- if ind%2 : anObj.SetNbPlanes(random.randint(-40,40)) else : anObj.SetNbPlanes(random.randint(0,10)) #try behaivor if NbPlanes=0 @@ -660,8 +657,8 @@ def try_cutplanes_parameters(thePattern) : angle1 = random.random()*3.14 angle2 = random.random()*3.14 - anObj.SetRotateX(angle1) - anObj.SetRotateY(angle2) + # --- ORIENTATION --- + anObj.SetOrientation(ORIENT[random.randint(0,2)],angle1,angle2) return anObj @@ -694,8 +691,12 @@ def try_cutlines_parameters(thePattern): anObj = try_scalarmap_parameters(thePattern) # --- ORIENTATION --- - anObj.SetOrientationType(ORIENT[random.randint(0,2)]) - anObj.SetOrientationType2(ORIENT[random.randint(0,2)]) + anObj.SetOrientation(ORIENT[random.randint(0,2)], + random.randint(-100,100)*random.random(), + random.randint(-100,100)*random.random()) + anObj.SetOrientation2(ORIENT[random.randint(0,2)], + random.randint(-100,100)*random.random(), + random.randint(-100,100)*random.random()) # --- Base Plane Position --- anObj.SetBasePlanePosition( random.random()*random.randint(-100000,100000)) @@ -704,12 +705,6 @@ def try_cutlines_parameters(thePattern): if ind%2: anObj.SetNbLines(random.randint(-5, 50)) - # --- ROTATION --- - anObj.SetRotateX(random.randint(-100,100)*random.random()) - anObj.SetRotateX2(random.randint(-100,100)*random.random()) - anObj.SetRotateY(random.randint(-100,100)*random.random()) - anObj.SetRotateY2(random.randint(-100,100)*random.random()) - return anObj def dump_cutlines_parameters(theObject): diff --git a/src/VISU_SWIG/visu_big_table.py b/src/VISU_SWIG/visu_big_table.py index 15d18205..9a3317c4 100644 --- a/src/VISU_SWIG/visu_big_table.py +++ b/src/VISU_SWIG/visu_big_table.py @@ -19,7 +19,7 @@ myStudy = salome.myStudy myBuilder = myStudy.NewBuilder() # >>> Getting (loading) VISU component ======================================= -myVisu = salome.lcc.FindOrLoadComponent("FactoryServer", "Visu") +myVisu = salome.lcc.FindOrLoadComponent("FactoryServer", "VISU") myComponent = myStudy.FindComponent("VISU") myVisu.SetCurrentStudy(myStudy) if not myComponent: diff --git a/src/VISU_SWIG/visu_med.py b/src/VISU_SWIG/visu_med.py index 2a75f06a..46f7bedf 100644 --- a/src/VISU_SWIG/visu_med.py +++ b/src/VISU_SWIG/visu_med.py @@ -53,7 +53,7 @@ def importMed(medFile): importMedFrom(medDir,medFile) #med_obj = getMedObjectFromStudy() -myVisu = salome.lcc.FindOrLoadComponent("FactoryServer", "Visu") +myVisu = salome.lcc.FindOrLoadComponent("FactoryServer", "VISU") print "Use importMed(medFile) or importMedFrom(medDir,medFile) functions !" #myField = getFieldObjectFromStudy(2,1) diff --git a/src/VISU_SWIG/visu_prs_example.py b/src/VISU_SWIG/visu_prs_example.py index d8cba431..002ebd10 100644 --- a/src/VISU_SWIG/visu_prs_example.py +++ b/src/VISU_SWIG/visu_prs_example.py @@ -27,7 +27,7 @@ print medFile studyCurrent = salome.myStudyName -med_comp = salome.lcc.FindOrLoadComponent("FactoryServer", "Med") +med_comp = salome.lcc.FindOrLoadComponent("FactoryServer", "MED") #myVisu = salome.lcc.FindOrLoadComponent("FactoryServer", "Visu") try: diff --git a/src/VISU_SWIG/visu_table.py b/src/VISU_SWIG/visu_table.py index d39beaf7..38641bbd 100644 --- a/src/VISU_SWIG/visu_table.py +++ b/src/VISU_SWIG/visu_table.py @@ -19,7 +19,7 @@ myStudy = salome.myStudy myBuilder = myStudy.NewBuilder() # >>> Getting (loading) VISU component ======================================= -myVisu = salome.lcc.FindOrLoadComponent("FactoryServer", "Visu") +myVisu = salome.lcc.FindOrLoadComponent("FactoryServer", "VISU") myComponent = myStudy.FindComponent("VISU") myVisu.SetCurrentStudy(myStudy) if not myComponent: -- 2.39.2