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
myLifeCycleCORBA = theLifeCycleCORBA
myLocalStudyManager = theStudyManager
mySession = myNamingService.Resolve("/Kernel/Session")
+ mySession = mySession._narrow(SALOME.Session)
mySession.GetInterface()
myDelay = theDelay
sleep(myDelay)
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)
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()
# 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"
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
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
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)
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
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
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))
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):