pass
return aSComponent;
+
+def SetName(theObj, theName):
+ anIOR = myORB.object_to_string(theObj)
+ aSObj = myLocalStudy.FindObjectIOR(anIOR)
+ anAttr = aSObj.FindAttribute("AttributeName")[1]
+ anAttr.SetValue(theName)
def StrToMap(theString) :
aPairList = split(theString,";")
print "SObjectToObject - IOR = ''"
return anObj;
-def CreatePrsForMed(theVisu, theFileName, thePrsTypeList, thePictureDir, thePictureExt) :
+def CreatePrsForMed(theVisu, theFileName, thePrsTypeList, thePictureDir, thePictureExt, theIsAutoDelete = 0) :
# try:
global myLifeCycleCORBA
print "lcc.FindOrLoadComponent...",
aResult = theVisu.ImportMed(aMedSObj)
if aResult is None : raise RuntimeError, "Error"
else : print "OK"
- aVISUObjList.append(aResult)
- aVISUObjList.extend(CreatePrsForResult(theVisu, aResult, myView, thePrsTypeList, thePictureDir, thePictureExt))
+
+ aVISUObjList.extend(CreatePrsForResult(theVisu, aResult, myView, thePrsTypeList, thePictureDir, thePictureExt, theIsAutoDelete))
+ if theIsAutoDelete :
+ aResult.RemoveFromStudy()
+ else :
+ aVISUObjList.append(aResult)
aFolderIter = myLocalStudy.NewChildIterator(aMedSObj.GetFather());
while aFolderIter.More() :
aResult = theVisu.ImportMed(aFieldSObj)
if aResult is None : raise RuntimeError, "Error"
else : print "OK"
- aVISUObjList.append(aResult)
- aVISUObjList.extend(CreatePrsForResult(theVisu, aResult, myView, thePrsTypeList, thePictureDir, thePictureExt))
+
+ aVISUObjList.extend(CreatePrsForResult(theVisu, aResult, myView, thePrsTypeList, thePictureDir, thePictureExt, theIsAutoDelete))
+ if theIsAutoDelete :
+ aResult.RemoveFromStudy()
+ else :
+ aVISUObjList.append(aResult)
aTimeStampIter = myLocalStudy.NewChildIterator(aFieldSObj);
if aTimeStampIter.More() :
aResult = theVisu.ImportMedField(aMedField)
if aResult is None : raise RuntimeError, "Error"
else : print "OK"
- aVISUObjList.append(aResult)
- aVISUObjList.extend(CreatePrsForResult(theVisu, aResult, myView, thePrsTypeList, thePictureDir, thePictureExt))
+
+ aVISUObjList.extend(CreatePrsForResult(theVisu, aResult, myView, thePrsTypeList, thePictureDir, thePictureExt, theIsAutoDelete))
+ if theIsAutoDelete :
+ aResult.RemoveFromStudy()
+ else :
+ aVISUObjList.append(aResult)
return aVISUObjList
# except Exception, e:
# print str(e)
-def CreatePrsForFile(theVisu, theFileName, thePrsTypeList, thePictureDir, thePictureExt) :
+def CreatePrsForFile(theVisu, theFileName, thePrsTypeList, thePictureDir, thePictureExt, theIsAutoDelete = 0) :
# try:
aVISUObjList = [myLocalStudy, myViewManager, myView] = CreateStudyForMed(theVisu, theFileName)
if aResult is None : raise RuntimeError, "Error"
else : print "OK"
- aVISUObjList.extend(CreatePrsForResult(theVisu, aResult, myView, thePrsTypeList, thePictureDir, thePictureExt))
-
+ aVISUObjList.extend(CreatePrsForResult(theVisu, aResult, myView, thePrsTypeList, thePictureDir, thePictureExt, theIsAutoDelete))
+
+ if theIsAutoDelete :
+ aResult.RemoveFromStudy()
+ else :
+ aVISUObjList.append(aResult)
+
return aVISUObjList
# except Exception, e:
# print str(e)
-def CreatePrsForResult(theVisu, theResult, theView, thePrsTypeList, thePictureDir, thePictureExt) :
- aVISUObjList = []
+def CreatePrsForResult(theVisu, theResult, theView, thePrsTypeList, thePictureDir, thePictureExt, theIsAutoDelete = 0) :
+ aVISUObjList = None
+ if theIsAutoDelete is not None :
+ aVISUObjList = []
+ pass
+
print "CreatePrsForResult - myLocalStudy.FindObjectIOR...",
myLocalStudy = theVisu.GetCurrentStudy()
+
aSObj = myLocalStudy.FindObjectIOR(theResult.GetID())
if aSObj is None : raise RuntimeError, "Error"
else : print "OK"
while aFolderIter.More() :
aFolderSObj = aFolderIter.Value()
aFolderIter.Next()
- anAttr = aFolderSObj.FindAttribute("AttributeName")[1]
+ anIsFound, anAttr = aFolderSObj.FindAttribute("AttributeName")
+ if not anIsFound :
+ continue
anAttr = anAttr._narrow(SALOMEDS.AttributeName);
aFolderName = anAttr.Value()
print " ", aFolderName
print " ", anEntityName, aMeshName,
aMesh = theVisu.MeshOnEntity(theResult,aMeshName,anEntity)
if aMesh is None : print "Error"
- else : print ",OK"
- theView.DisplayOnly(aMesh)
- theView.FitAll()
- aPictureName = thePictureDir + aMeshNamePic + "_" + anEntityId + "." + thePictureExt
- aPictureName = re.sub("\s+","_", aPictureName);
- theView.SavePicture(aPictureName)
- aVISUObjList.append(aMesh)
+ else :
+ print ",OK"
+ theView.DisplayOnly(aMesh)
+ theView.FitAll()
+ aPictureName = thePictureDir + aMeshNamePic + "_" + anEntityId + "." + thePictureExt
+ aPictureName = re.sub("\s+","_", aPictureName);
+ theView.SavePicture(aPictureName)
+ if theIsAutoDelete :
+ aMesh.RemoveFromStudy()
+ else :
+ aVISUObjList.append(aMesh)
anFamilyIter = myLocalStudy.NewChildIterator(anEntitySObj);
while anFamilyIter.More() :
print " ", anFamilyName,
aMesh = theVisu.FamilyMeshOnEntity(theResult,aMeshName,anEntity,anFamilyName)
if aMesh is None : print "Error"
- else : print ",OK"
- theView.DisplayOnly(aMesh)
- theView.FitAll()
- aPictureName = thePictureDir + aMeshNamePic + "_" + anEntityId + "_" + anFamilyName + "." + thePictureExt
- aPictureName = re.sub("\s+","_", aPictureName);
- theView.SavePicture(aPictureName)
- aVISUObjList.append(aMesh)
+ else :
+ print ",OK"
+ theView.DisplayOnly(aMesh)
+ theView.FitAll()
+ aPictureName = thePictureDir + aMeshNamePic + "_" + anEntityId + "_" + anFamilyName + "." + thePictureExt
+ aPictureName = re.sub("\s+","_", aPictureName);
+ theView.SavePicture(aPictureName)
+ if theIsAutoDelete :
+ aMesh.RemoveFromStudy()
+ else :
+ aVISUObjList.append(aMesh)
if aFolderName == 'Groups' :
aGroupIter = myLocalStudy.NewChildIterator(aFolderSObj);
print " ", aGroupName,
aMesh = theVisu.GroupMesh(theResult,aMeshName,aGroupName)
if aMesh is None : print "Error"
- else : print ",OK"
- theView.DisplayOnly(aMesh)
- theView.FitAll()
- aPictureName = thePictureDir + aMeshNamePic + "_" + aGroupName + "." + thePictureExt
- aPictureName = re.sub("\s+","_", aPictureName);
- theView.SavePicture(aPictureName)
- aVISUObjList.append(aMesh)
+ else :
+ print ",OK"
+ theView.DisplayOnly(aMesh)
+ theView.FitAll()
+ aPictureName = thePictureDir + aMeshNamePic + "_" + aGroupName + "." + thePictureExt
+ aPictureName = re.sub("\s+","_", aPictureName);
+ theView.SavePicture(aPictureName)
+ if theIsAutoDelete :
+ aMesh.RemoveFromStudy()
+ else :
+ aVISUObjList.append(aMesh)
if aFolderName == 'Fields' :
aFieldIter = myLocalStudy.NewChildIterator(aFolderSObj);
print " Creating ScalarMapOnField",
aPrsObj = theVisu.ScalarMapOnField(theResult,aMeshName,anEntity,aFieldName,aTimeStampId)
if aPrsObj is None : print "Error"
- else : print ",OK"
- theView.DisplayOnly(aPrsObj)
- theView.FitAll()
- aPictureName = thePictureDir + aMeshNamePic + "_" + anEntityId + "_" + aFieldName + "_" + str(aTimeStampId) + "_TSCALARMAP." + thePictureExt
- aPictureName = re.sub("\s+","_", aPictureName);
- theView.SavePicture(aPictureName)
- aVISUObjList.append(aPrsObj)
-
+ else :
+ print ",OK"
+ theView.DisplayOnly(aPrsObj)
+ theView.FitAll()
+ aPictureName = thePictureDir + aMeshNamePic + "_" + anEntityId + "_" + aFieldName + "_" + str(aTimeStampId) + "_TSCALARMAP." + thePictureExt
+ aPictureName = re.sub("\s+","_", aPictureName);
+ theView.SavePicture(aPictureName)
+ if theIsAutoDelete :
+ aPrsObj.RemoveFromStudy()
+ else :
+ aVISUObjList.append(aPrsObj)
+
if HasValue(thePrsTypeList,VISU.TISOSURFACE) :
print " Creating IsoSurfacesOnField",
aPrsObj = theVisu.IsoSurfacesOnField(theResult,aMeshName,anEntity,aFieldName,aTimeStampId)
if aPrsObj is None : print "Error"
- else : print ",OK"
- theView.DisplayOnly(aPrsObj)
- theView.FitAll()
- aPictureName = thePictureDir + aMeshNamePic + "_" + anEntityId + "_" + aFieldName + "_" + str(aTimeStampId) + "_TISOSURFACE." + thePictureExt
- aPictureName = re.sub("\s+","_", aPictureName);
- theView.SavePicture(aPictureName)
- aVISUObjList.append(aPrsObj)
+ else :
+ print ",OK"
+ theView.DisplayOnly(aPrsObj)
+ theView.FitAll()
+ aPictureName = thePictureDir + aMeshNamePic + "_" + anEntityId + "_" + aFieldName + "_" + str(aTimeStampId) + "_TISOSURFACE." + thePictureExt
+ aPictureName = re.sub("\s+","_", aPictureName);
+ theView.SavePicture(aPictureName)
+ if theIsAutoDelete :
+ aPrsObj.RemoveFromStudy()
+ else :
+ aVISUObjList.append(aPrsObj)
if HasValue(thePrsTypeList,VISU.TCUTPLANES) :
print " Creating CutPlanesOnField",
aPrsObj = theVisu.CutPlanesOnField(theResult,aMeshName,anEntity,aFieldName,aTimeStampId)
if aPrsObj is None : print "Error"
- else : print ",OK"
- aPrsObj.SetOrientation(VISU.CutPlanes.ZX,aPrsObj.GetRotateX(),aPrsObj.GetRotateY())
- theView.DisplayOnly(aPrsObj)
- theView.FitAll()
- aPictureName = thePictureDir + aMeshNamePic + "_" + anEntityId + "_" + aFieldName + "_" + str(aTimeStampId) + "_TCUTPLANES." + thePictureExt
- aPictureName = re.sub("\s+","_", aPictureName)
- theView.SavePicture(aPictureName)
- aVISUObjList.append(aPrsObj)
+ else :
+ print ",OK"
+ aPrsObj.SetOrientation(VISU.CutPlanes.ZX,aPrsObj.GetRotateX(),aPrsObj.GetRotateY())
+ theView.DisplayOnly(aPrsObj)
+ theView.FitAll()
+ aPictureName = thePictureDir + aMeshNamePic + "_" + anEntityId + "_" + aFieldName + "_" + str(aTimeStampId) + "_TCUTPLANES." + thePictureExt
+ aPictureName = re.sub("\s+","_", aPictureName)
+ theView.SavePicture(aPictureName)
+ if theIsAutoDelete :
+ aPrsObj.RemoveFromStudy()
+ else :
+ aVISUObjList.append(aPrsObj)
if HasValue(thePrsTypeList,VISU.TCUTLINES) :
print " Creating CutLinesOnField",
aPrsObj = theVisu.CutLinesOnField(theResult,aMeshName,anEntity,aFieldName,aTimeStampId)
if aPrsObj is None : print "Error"
- else : print ",OK"
- 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
- aPictureName = re.sub("\s+","_", aPictureName)
- theView.SavePicture(aPictureName)
- aVISUObjList.append(aPrsObj)
+ else :
+ print ",OK"
+ 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
+ aPictureName = re.sub("\s+","_", aPictureName)
+ theView.SavePicture(aPictureName)
+ if theIsAutoDelete :
+ aPrsObj.RemoveFromStudy()
+ else :
+ aVISUObjList.append(aPrsObj)
if HasValue(thePrsTypeList,VISU.TPLOT3D) :
print " Creating Plot3DOnField",
aPrsObj = theVisu.Plot3DOnField(theResult,aMeshName,anEntity,
aFieldName,aTimeStampId)
if aPrsObj is None : print "Error"
- else : print ",OK"
+ else :
+ print ",OK"
#aPrsObj.SetOrientation(VISU.CutPlanes.ZX,
# aPrsObj.GetRotateX(),
# aPrsObj.GetRotateY())
- theView.DisplayOnly(aPrsObj)
- theView.FitAll()
- aPictureName = thePictureDir + aMeshNamePic + "_" + anEntityId +
- "_" + aFieldName + "_" + str(aTimeStampId) +
- "_TPLOT3D." + thePictureExt
- aPictureName = re.sub("\s+","_", aPictureName)
- theView.SavePicture(aPictureName)
- aVISUObjList.append(aPrsObj)
+ theView.DisplayOnly(aPrsObj)
+ theView.FitAll()
+ aPictureName = thePictureDir + aMeshNamePic + "_" + anEntityId + "_" + aFieldName + "_" + str(aTimeStampId) + "_TPLOT3D." + thePictureExt
+ aPictureName = re.sub("\s+","_", aPictureName)
+ theView.SavePicture(aPictureName)
+ if theIsAutoDelete :
+ aPrsObj.RemoveFromStudy()
+ else :
+ aVISUObjList.append(aPrsObj)
aNumComponent = atoi(aMap["myNumComponent"])
if aNumComponent > 1 :
print " Creating DeformedShapeOnField",
aPrsObj = theVisu.DeformedShapeOnField(theResult,aMeshName,anEntity,aFieldName,aTimeStampId)
if aPrsObj is None : print "Error"
- else : print ",OK"
- theView.DisplayOnly(aPrsObj)
- theView.FitAll()
- aPictureName = thePictureDir + aMeshNamePic + "_" + anEntityId + "_" + aFieldName + "_" + str(aTimeStampId) + "_TDEFORMEDSHAPE." + thePictureExt
- aPictureName = re.sub("\s+","_", aPictureName)
- theView.SavePicture(aPictureName)
- aVISUObjList.append(aPrsObj)
+ else :
+ print ",OK"
+ theView.DisplayOnly(aPrsObj)
+ theView.FitAll()
+ aPictureName = thePictureDir + aMeshNamePic + "_" + anEntityId + "_" + aFieldName + "_" + str(aTimeStampId) + "_TDEFORMEDSHAPE." + thePictureExt
+ aPictureName = re.sub("\s+","_", aPictureName)
+ theView.SavePicture(aPictureName)
+ if theIsAutoDelete :
+ aPrsObj.RemoveFromStudy()
+ else :
+ aVISUObjList.append(aPrsObj)
if HasValue(thePrsTypeList,VISU.TVECTORS) :
print " Creating VectorsOnField",
aPrsObj = theVisu.VectorsOnField(theResult,aMeshName,anEntity,aFieldName,aTimeStampId)
if aPrsObj is None : print "Error"
- else : print ",OK"
- theView.DisplayOnly(aPrsObj)
- theView.FitAll()
- aPictureName = thePictureDir + aMeshNamePic + "_" + anEntityId + "_" + aFieldName + "_" + str(aTimeStampId) + "_TVECTORS." + thePictureExt
- aPictureName = re.sub("\s+","_", aPictureName)
- theView.SavePicture(aPictureName)
- aVISUObjList.append(aPrsObj)
+ else :
+ print ",OK"
+ theView.DisplayOnly(aPrsObj)
+ theView.FitAll()
+ aPictureName = thePictureDir + aMeshNamePic + "_" + anEntityId + "_" + aFieldName + "_" + str(aTimeStampId) + "_TVECTORS." + thePictureExt
+ aPictureName = re.sub("\s+","_", aPictureName)
+ theView.SavePicture(aPictureName)
+ if theIsAutoDelete :
+ aPrsObj.RemoveFromStudy()
+ else :
+ aVISUObjList.append(aPrsObj)
if HasValue(thePrsTypeList,VISU.TSTREAMLINES) :
print " Creating StreamLinesOnField",
aPrsObj = theVisu.StreamLinesOnField(theResult,aMeshName,anEntity,aFieldName,aTimeStampId)
if aPrsObj is None : print "Error"
- else : print ",OK"
- theView.DisplayOnly(aPrsObj)
- theView.FitAll()
- aPictureName = thePictureDir + aMeshNamePic + "_" + anEntityId + "_" + aFieldName + "_" + str(aTimeStampId) + "_TSTREAMLINES." + thePictureExt
- aPictureName = re.sub("\s+","_", aPictureName)
- theView.SavePicture(aPictureName)
- aVISUObjList.append(aPrsObj)
-
+ else :
+ print ",OK"
+ theView.DisplayOnly(aPrsObj)
+ theView.FitAll()
+ aPictureName = thePictureDir + aMeshNamePic + "_" + anEntityId + "_" + aFieldName + "_" + str(aTimeStampId) + "_TSTREAMLINES." + thePictureExt
+ aPictureName = re.sub("\s+","_", aPictureName)
+ theView.SavePicture(aPictureName)
+ if theIsAutoDelete :
+ aPrsObj.RemoveFromStudy()
+ else :
+ aVISUObjList.append(aPrsObj)
+
+ if HasValue(thePrsTypeList,VISU.TSCALARMAPONDEFORMEDSHAPE) :
+ print " Creating ScalarMapOnDeformedShapeOnField",
+ aPrsObj = theVisu.ScalarMapOnDeformedShapeOnField(theResult,aMeshName,anEntity,aFieldName,aTimeStampId)
+ if aPrsObj is None : print "Error"
+ else :
+ print ",OK"
+ theView.DisplayOnly(aPrsObj)
+ theView.FitAll()
+ aPictureName = thePictureDir + aMeshNamePic + "_" + anEntityId + "_" + aFieldName + "_" + str(aTimeStampId) + "_TSCALARMAPONDEFORMEDSHAPE." + thePictureExt
+ aPictureName = re.sub("\s+","_", aPictureName)
+ theView.SavePicture(aPictureName)
+ if theIsAutoDelete :
+ aPrsObj.RemoveFromStudy()
+ else :
+ aVISUObjList.append(aPrsObj)
+
return aVISUObjList
# ----------------------
def try_cutplanes_parameters(thePattern) :
- if thePattern is None : return aList
+ if thePattern is None : return None
import copy
import random