myNamingService = theNamingService
myLifeCycleCORBA = theLifeCycleCORBA
myLocalStudyManager = theStudyManager
- mySession = myNamingService.Resolve("/Kernel/Session")
+ while mySession == None:
+ mySession = myNamingService.Resolve("/Kernel/Session")
mySession = mySession._narrow(SALOME.Session)
mySession.GetInterface()
myDelay = theDelay
myLocalStudy = theStudy
myLocalVisu.SetCurrentStudy(myLocalStudy)
return myLocalVisu
+
+def PublishComponent(theStudyDocument):
+ aComponentDataType = myLocalVisu.ComponentDataType()
+ aSComponent = theStudyDocument.FindComponent(aComponentDataType)
+ if aSComponent == None:
+ aStudyBuilder = theStudyDocument.NewBuilder()
+ aStudyBuilder.NewCommand()
+ aLocked = theStudyDocument.GetProperties().IsLocked()
+ if aLocked:
+ theStudyDocument.GetProperties().SetLocked(0)
+ pass
+
+ aSComponent = aStudyBuilder.NewComponent(aComponentDataType);
+ aName = aStudyBuilder.FindOrCreateAttribute(aSComponent,"AttributeName")
+ aModuleCatalog = myNamingService.Resolve("/Kernel/ModulCatalog");
+ aComponent = aModuleCatalog.GetComponent(aComponentDataType);
+ if aComponent != None:
+ aComponentUserName = aComponent._get_componentusername()
+ aName.SetValue(aComponentUserName)
+ pass
+
+ aPixMap = aStudyBuilder.FindOrCreateAttribute(aSComponent,"AttributePixMap")
+ aPixMap.SetPixMap("ICON_OBJBROWSER_Visu")
+
+ aStudyBuilder.DefineComponentInstance(aSComponent,myLocalVisu);
+ if aLocked:
+ theStudyDocument.GetProperties().SetLocked(1);
+ pass
+
+ aStudyBuilder.CommitCommand();
+ pass
+ return aSComponent;
+
def StrToMap(theString) :
aPairList = split(theString,";")
aMap = {}
return [aStudy, myViewManager, myView]
raise RuntimeError, "Error: There is no shuch file."
-def getMedObjectFromStudy(theStudy = myLocalStudy):
+def getMedSObject(theStudy = myLocalStudy ):
if theStudy is None:
theStudy = myLocalStudy
- mySO = theStudy.FindObject("Objet MED")
- anAttr = mySO.FindAttribute("AttributeIOR")[1]
- obj = myORB.string_to_object(anAttr.Value())
- myObj = obj._narrow(SALOME_MED.MED)
- return myObj
+ aSO = theStudy.FindObject("Med")
+ anIsPresetn, aSObject = aSO.FindSubObject(1)
+ return aSObject
-def getMedSObject(theStudy = myLocalStudy ):
- return theStudy.FindObject("Objet MED")
+def getMedObjectFromStudy(theStudy = myLocalStudy):
+ aSObject = getMedSObject(theStudy)
+ if aSObject:
+ anAttr = aSObject.FindAttribute("AttributeIOR")[1]
+ anObj = myORB.string_to_object(anAttr.Value())
+ return anObj._narrow(SALOME_MED.MED)
+ return None
def getFieldObjectFromStudy(number, subnumber, theStudy = myLocalStudy):
if theStudy is None:
dump_scalarmap_parameters(theObject)
print "GetNbSurfaces() = "+ str(theObject.GetNbSurfaces())
+
+
+# ----------------------
+# TABLES AND CURVES
+# ----------------------
+
+def FillTable( theTable, theValues, theRows, theColumns, theRowTitles, theRowUnits, theColumnTitles ):
+ if theTable is None: return
+ if len(theRows) != len(theColumns): return
+ if len(theRows) != len(theValues): return
+ i = 0
+ for value in theValues:
+ theTable.PutValue( value, theRows[ i ], theColumns[ i ])
+ i = i + 1
+ pass
+ i = 1
+ for title in theRowTitles:
+ theTable.SetRowTitle( i, title )
+ theTable.SetRowUnit( i, theRowUnits[ i - 1 ])
+ i = i + 1
+ pass
+ i = 1
+ for title in theColumnTitles:
+ theTable.SetColumnTitle( i, title )
+ i = i + 1
+ pass
+ pass
+
+def CreateCurve( theTable, theHRow, theVRow, theTitle, theColor, theMarker, theLineType, theLineWidth ):
+ if theTitle is None: return
+ curve = myLocalVisu.CreateCurve( theTable, theHRow, theVRow );
+ if curve:
+ curve.SetTitle( theTitle )
+ curve.SetColor( theColor )
+ curve.SetMarker( theMarker )
+ curve.SetLine( theLineType, theLineWidth )
+ pass
+ return curve