-
- listOfSO = theStudy.FindObjectByName(objNameInStudy,compNameInStudy)
- listLength = len(listOfSO)
- if (listLength == 0) :
- print "PROBLEME ",objNameInStudy," cannot be found in the Study under the component ",compNameInStudy
- return None
- elif (listLength > 1) :
- print "PROBLEME there are more than one instance of ",objNameInStudy," in the Study under the component ",compNameInStudy
- return None
- mySO = listOfSO[0]
- return mySO
-
-##def getFieldObjectFromStudy(number, subnumber, theStudy = myLocalStudy):
-## if theStudy is None:
-## theStudy = myLocalStudy
-## mySO = theStudy.FindObject("MEDFIELD")
-## if mySO is None:
-## raise Runtime, "getFieldObjectFromStudy mySO is None"
-## mysub = mySO.FindSubObject(number)[1]
-## if mysub:
-## mysubsub = mysub.FindSubObject(subnumber)[1]
-## if mysubsub:
-## Builder = theStudy.NewBuilder()
-## anAttr = Builder.FindOrCreateAttribute(mysubsub, "AttributeIOR")
-## obj = myORB.string_to_object(anAttr.Value())
-## myObj = obj._narrow(SALOME_MED.FIELDINT)
-## if (myObj == None):
-## myObj = obj._narrow(SALOME_MED.FIELDDOUBLE)
-## return myObj
-## else:
-## print "ERROR: No Field Object stored in this Study"
-## return None
-
-def getFieldObjectFromStudy(dt, it, fieldName, supportName, meshName,
- theStudy = myLocalStudy):
- meshNameStudy = changeBlankToUnderScore(meshName)
- if theStudy is None:
- theStudy = myLocalStudy
-
- objNameInStudy = "/Med/MEDFIELD/"+fieldName+"/("+str(dt)+","+str(it)+")_ON_"+supportName+"_OF_"+meshNameStudy
- mySO = theStudy.FindObjectByPath(objNameInStudy)
- if (mySO == None) :
- print "PROBLEM ",objNameInStudy," cannot be found in the Study"
- return mySO
+ mySO = theStudy.FindObject("MEDFIELD")
+ if mySO is None:
+ raise Runtime, "getFieldObjectFromStudy mySO is None"
+ mysub = mySO.FindSubObject(number)[1]
+ if mysub:
+ mysubsub = mysub.FindSubObject(subnumber)[1]
+ if mysubsub:
+ Builder = theStudy.NewBuilder()
+ anAttr = Builder.FindOrCreateAttribute(mysubsub, "AttributeIOR")
+ obj = myORB.string_to_object(anAttr.Value())
+ myObj = obj._narrow(SALOME_MED.FIELDINT)
+ if (myObj == None):
+ myObj = obj._narrow(SALOME_MED.FIELDDOUBLE)
+ return myObj