]> SALOME platform Git repositories - modules/visu.git/blob - src/VISU_SWIG/visu.py
Salome HOME
Join modifications from BR_Dev_For_4_0 tag V4_1_1.
[modules/visu.git] / src / VISU_SWIG / visu.py
1 #  VISU VISU_SWIG : binding of C++ implementation and Python
2 #
3 #  Copyright (C) 2003  OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
4 #  CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS 
5
6 #  This library is free software; you can redistribute it and/or 
7 #  modify it under the terms of the GNU Lesser General Public 
8 #  License as published by the Free Software Foundation; either 
9 #  version 2.1 of the License. 
10
11 #  This library is distributed in the hope that it will be useful, 
12 #  but WITHOUT ANY WARRANTY; without even the implied warranty of 
13 #  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU 
14 #  Lesser General Public License for more details. 
15
16 #  You should have received a copy of the GNU Lesser General Public 
17 #  License along with this library; if not, write to the Free Software 
18 #  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA 
19
20 #  See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
21 #
22 #  File   : visu.py
23 #  Module : VISU
24
25 import os
26 import re
27 from time import sleep
28
29 import VISU
30 import SALOME
31 import SALOME_Session_idl
32 import SALOMEDS
33 import SALOME_MED
34 import SALOME_ModuleCatalog
35 from omniORB import CORBA
36 from string import *
37 from time import sleep
38
39 myORB = None
40 myNamingService = None
41 myLifeCycleCORBA = None
42 myNamingService = None
43 myLocalStudyManager = None
44 myLocalStudy = None
45 myLocalVisu = None
46 myDelay = None
47 mySession = None
48  
49 def Initialize(theORB, theNamingService, theLifeCycleCORBA, theStudyManager, theStudy, theDelay) :
50     global myORB, myNamingService, myLifeCycleCORBA, myLocalStudyManager, myLocalStudy
51     global mySession, myLocalVisu, myDelay
52     myDelay = theDelay
53     myORB = theORB
54     myNamingService = theNamingService
55     myLifeCycleCORBA = theLifeCycleCORBA
56     myLocalStudyManager = theStudyManager
57     while mySession == None:
58         mySession = myNamingService.Resolve("/Kernel/Session")
59     mySession = mySession._narrow(SALOME.Session)
60     mySession.GetInterface()
61     myDelay = theDelay
62     sleep(myDelay)
63     myLocalVisu = myLifeCycleCORBA.FindOrLoadComponent("FactoryServer", "VISU")
64     myLocalStudy = theStudy
65     myLocalVisu.SetCurrentStudy(myLocalStudy)
66     return myLocalVisu
67
68 def PublishComponent(theStudyDocument):
69     aComponentDataType = myLocalVisu.ComponentDataType()
70     aSComponent = theStudyDocument.FindComponent(aComponentDataType)
71     if aSComponent == None:
72         aStudyBuilder = theStudyDocument.NewBuilder()
73         aStudyBuilder.NewCommand()
74         aLocked = theStudyDocument.GetProperties().IsLocked()
75         if aLocked:
76             theStudyDocument.GetProperties().SetLocked(0)
77             pass
78
79         aSComponent = aStudyBuilder.NewComponent(aComponentDataType);
80         aName = aStudyBuilder.FindOrCreateAttribute(aSComponent,"AttributeName")
81         aModuleCatalogObj = myNamingService.Resolve("/Kernel/ModulCatalog");
82         aModuleCatalog = aModuleCatalogObj._narrow(SALOME_ModuleCatalog.ModuleCatalog)
83         aComponent = aModuleCatalog.GetComponent(aComponentDataType);
84         if aComponent != None:
85             aComponentUserName = aComponent._get_componentusername()
86             aName.SetValue(aComponentUserName)
87             pass
88         
89         aPixMap = aStudyBuilder.FindOrCreateAttribute(aSComponent,"AttributePixMap")
90         aPixMap.SetPixMap("ICON_OBJBROWSER_Visu")
91         
92         aStudyBuilder.DefineComponentInstance(aSComponent,myLocalVisu);
93         if aLocked:
94             theStudyDocument.GetProperties().SetLocked(1);
95             pass
96         
97         aStudyBuilder.CommitCommand();
98         pass
99     
100     return aSComponent;
101
102 def SetName(theObj, theName):
103     anIOR  = myORB.object_to_string(theObj)
104     aSObj  = myLocalStudy.FindObjectIOR(anIOR)
105     anAttr = aSObj.FindAttribute("AttributeName")[1]
106     anAttr.SetValue(theName)
107         
108 def StrToMap(theString) :
109     aPairList = split(theString,";")
110     aMap = {}
111     iEnd = len(aPairList)
112     for i in range(iEnd) :
113         aPair = split(aPairList[i],"=")
114         aMap[aPair[0]] = aPair[1]
115     return aMap
116
117 def IntToEntity(theInt) :
118     theInt = atoi(theInt)
119     if theInt == 0 :
120         return VISU.NODE;
121     elif theInt == 1 :
122         return VISU.EDGE;
123     elif theInt == 2 :
124         return VISU.FACE;
125     else :
126         return VISU.CELL;
127         
128 def HasValue(theList, theValue) :
129     try :
130         return theList.index(theValue) + 1
131     except StandardError, e :
132         return 0
133
134 def CreateStudyForMed(theVisu, theFileName) :
135     print "CreateStudyForMed ", theFileName,
136     if os.path.isfile(theFileName) :
137         if re.search("\.med$", theFileName) is not None :
138             print "OK"
139             aStudyName = os.path.basename(theFileName)
140             aStudyName = re.sub(r'\.med', "", aStudyName)
141             aStudyName = generateName(aStudyName)
142             print "myLocalStudyManager.NewStudy -", aStudyName, "...",
143             aStudy = myLocalStudyManager.NewStudy(aStudyName)
144             if aStudy is None : raise RuntimeError, "Error"
145             else : print "OK"
146             
147             print "CreateStudyForMed - Creating a 3D viewer...",
148             theVisu.SetCurrentStudy(aStudy)
149             myViewManager = theVisu.GetViewManager()
150             if myViewManager is None : raise RuntimeError, "Error - theVisu.GetViewManager"
151             myView = myViewManager.Create3DView()
152             if myView is None : raise RuntimeError, "Error - myViewManager.Create3DView"
153             myView.Maximize()
154             print "OK"
155
156             return [aStudy, myViewManager, myView]
157     raise RuntimeError, "Error: There is no such file."
158
159 def getMedSObject(theStudy = myLocalStudy ):
160     if theStudy is None:
161         theStudy = myLocalStudy
162     aSO = theStudy.FindObject("Med")
163     anIsPresetn, aSObject = aSO.FindSubObject(1)
164     return aSObject
165
166 def getMedObjectFromStudy(theStudy = myLocalStudy):
167     aSObject = getMedSObject(theStudy)
168     if aSObject:
169         anAttr = aSObject.FindAttribute("AttributeIOR")[1]
170         anObj = myORB.string_to_object(anAttr.Value())
171         return  anObj._narrow(SALOME_MED.MED)
172     return None
173
174 def getFieldObjectFromStudy(number, subnumber, theStudy = myLocalStudy):
175     if theStudy is None:
176         theStudy = myLocalStudy
177     mySO = theStudy.FindObject("MEDFIELD")
178     if mySO is None:
179         raise Runtime, "getFieldObjectFromStudy mySO is None"
180     mysub = mySO.FindSubObject(number)[1]
181     if mysub:
182         mysubsub = mysub.FindSubObject(subnumber)[1]
183         if mysubsub:
184             Builder = theStudy.NewBuilder()
185             anAttr = Builder.FindOrCreateAttribute(mysubsub, "AttributeIOR")
186             obj = myORB.string_to_object(anAttr.Value())
187             myObj = obj._narrow(SALOME_MED.FIELDINT)
188             if (myObj == None):
189                 myObj = obj._narrow(SALOME_MED.FIELDDOUBLE)
190             return myObj
191     else:
192         print "ERROR: No Field Object stored in this Study"
193         return None
194
195 def SObjectToObject(theSObject) :
196      #    global myORB
197     if theSObject is None :
198         print "SObjectToObject : argument is None"
199     anObj = None                         
200     res,Attr = theSObject.FindAttribute("AttributeIOR")
201     if (res != 0) and (Attr is not None)  : 
202       anIOR  = Attr._narrow(SALOMEDS.AttributeIOR);
203       aValue = anIOR.Value();
204       if(len(aValue) != 0) :
205         anObj = myORB.string_to_object(aValue);
206       else:
207         print "SObjectToObject - IOR = ''"
208     return anObj;
209  
210 def CreatePrsForMed(theVisu, theFileName, thePrsTypeList, thePictureDir, thePictureExt, theIsAutoDelete = 0) :
211 #    try:
212         global myLifeCycleCORBA
213         print "lcc.FindOrLoadComponent...",
214         aMedComp = myLifeCycleCORBA.FindOrLoadComponent("FactoryServer", "MED")
215         if aMedComp is None : print "Error"
216         else : print "OK"
217         
218         aVISUObjList = [myLocalStudy, myViewManager, myView] = CreateStudyForMed(theVisu, theFileName)
219
220         print "aMedComp.readStructFileWithFieldType...",
221         aMedComp.readStructFileWithFieldType(theFileName,myLocalStudy._get_Name())
222         aMedSObj = getMedSObject(myLocalStudy)
223         if aMedSObj is None : raise RuntimeError, "Error"
224         else : print "OK"
225         
226         print "theVisu.ImportMed...",
227         aResult = theVisu.ImportMed(aMedSObj)
228         if aResult is None : raise RuntimeError, "Error"
229         else : print "OK"
230
231         aVISUObjList.extend(CreatePrsForResult(theVisu, aResult, myView, thePrsTypeList, thePictureDir, thePictureExt, theIsAutoDelete))
232         if theIsAutoDelete :
233             aResult.RemoveFromStudy()
234         else :
235             aVISUObjList.append(aResult)
236         
237         aFolderIter = myLocalStudy.NewChildIterator(aMedSObj.GetFather());
238         while aFolderIter.More() :
239             aFolderSObj = aFolderIter.Value()
240             aFolderIter.Next()
241             anAttr = aFolderSObj.FindAttribute("AttributeName")[1]
242             anAttr = anAttr._narrow(SALOMEDS.AttributeName);
243             aFolderName = anAttr.Value()
244             print "  ", aFolderName
245             
246             if aFolderName == 'MEDMESH' :
247                 aMeshIter = myLocalStudy.NewChildIterator(aFolderSObj);
248                 while aMeshIter.More() :
249                     aMeshSObj = aMeshIter.Value()
250                     aMeshIter.Next()
251                     anAttr = aMeshSObj.FindAttribute("AttributeName")[1]
252                     anAttr = anAttr._narrow(SALOMEDS.AttributeName);
253                     aMeshName = anAttr.Value()
254                     print "    ", aMeshName
255                 
256                     aSupportIter = myLocalStudy.NewChildIterator(aMeshSObj);
257                     while aSupportIter.More() :
258                         aSupportSObj = aSupportIter.Value()
259                         aSupportIter.Next()
260                         anAttr = aSupportSObj.FindAttribute("AttributeName")[1]
261                         anAttr = anAttr._narrow(SALOMEDS.AttributeName);
262                         aSupportName = anAttr.Value()
263                         print "      ", aSupportName
264
265             if aFolderName == 'MEDFIELD' :
266                 aFieldIter = myLocalStudy.NewChildIterator(aFolderSObj);
267                 while aFieldIter.More() :
268                     aFieldSObj = aFieldIter.Value()
269                     aFieldIter.Next()
270                     anAttr = aFieldSObj.FindAttribute("AttributeName")[1]
271                     anAttr = anAttr._narrow(SALOMEDS.AttributeName);
272                     aFieldName = anAttr.Value()
273                     print "    ", aFieldName
274                 
275                     print "theVisu.ImportMed...",
276                     aResult = theVisu.ImportMed(aFieldSObj)
277                     if aResult is None : raise RuntimeError, "Error"
278                     else : print "OK"
279
280                     aVISUObjList.extend(CreatePrsForResult(theVisu, aResult, myView, thePrsTypeList, thePictureDir, thePictureExt, theIsAutoDelete))
281                     if theIsAutoDelete :
282                         aResult.RemoveFromStudy()
283                     else :
284                         aVISUObjList.append(aResult)
285
286                     aTimeStampIter = myLocalStudy.NewChildIterator(aFieldSObj);
287                     if aTimeStampIter.More() :
288                         aTimeStampIter.Next()
289                         while aTimeStampIter.More() :
290                             aTimeStampSObj = aTimeStampIter.Value()
291                             aTimeStampIter.Next()
292                             anAttr = aTimeStampSObj.FindAttribute("AttributeName")[1]
293                             anAttr = anAttr._narrow(SALOMEDS.AttributeName);
294                             aTimeStampName = anAttr.Value()
295                             print "        ", aTimeStampName
296
297                             print "theVisu.ImportMed...",
298                             aMedField = SObjectToObject(aTimeStampSObj)
299                             aResult = theVisu.ImportMedField(aMedField)
300                             if aResult is None : raise RuntimeError, "Error"
301                             else : print "OK"
302
303                             aVISUObjList.extend(CreatePrsForResult(theVisu, aResult, myView, thePrsTypeList, thePictureDir, thePictureExt, theIsAutoDelete))
304                             if theIsAutoDelete :
305                                 aResult.RemoveFromStudy()
306                             else :
307                                 aVISUObjList.append(aResult)
308                     
309         return aVISUObjList
310     
311 #    except Exception, e:
312 #        print str(e)
313         
314 def CreatePrsForFile(theVisu, theFileName, thePrsTypeList, thePictureDir, thePictureExt, theIsAutoDelete = 0) :
315  #   try:
316         aVISUObjList = [myLocalStudy, myViewManager, myView] = CreateStudyForMed(theVisu, theFileName)
317
318         print "theVisu.ImportMed...",
319         aResult = theVisu.ImportFile(theFileName)
320         if aResult is None : raise RuntimeError, "Error"
321         else : print "OK"
322         
323         aVISUObjList.extend(CreatePrsForResult(theVisu, aResult, myView, thePrsTypeList, thePictureDir, thePictureExt, theIsAutoDelete))
324
325         if theIsAutoDelete :
326             aResult.RemoveFromStudy()
327         else :
328             aVISUObjList.append(aResult)
329
330         return aVISUObjList
331     
332 #    except Exception, e:
333 #        print str(e)
334                 
335 def CreatePrsForResult(theVisu, theResult, theView, thePrsTypeList, thePictureDir, thePictureExt, theIsAutoDelete = 0) :
336     aVISUObjList = None
337     if theIsAutoDelete is not None :
338         aVISUObjList = []
339         pass
340         
341     print "CreatePrsForResult - myLocalStudy.FindObjectIOR...",
342     myLocalStudy = theVisu.GetCurrentStudy()
343
344     aSObj = myLocalStudy.FindObjectIOR(theResult.GetID())
345     if aSObj is None : raise RuntimeError, "Error"
346     else : print "OK"
347     aMeshIter = myLocalStudy.NewChildIterator(aSObj);
348     while aMeshIter.More() :
349         aMeshSObj = aMeshIter.Value()
350         aMeshIter.Next()
351         anAttr = aMeshSObj.FindAttribute("AttributeName")[1]
352         if anAttr is None :
353             aMeshSObj = aMeshIter.Value()
354             aMeshIter.Next()
355             anAttr = aMeshSObj.FindAttribute("AttributeName")[1]
356         anAttr = anAttr._narrow(SALOMEDS.AttributeName);
357         aMeshName = anAttr.Value()
358         aMeshNamePic = re.sub(".","_",aMeshName)
359         print "  ", aMeshName
360         
361         aFolderIter = myLocalStudy.NewChildIterator(aMeshSObj);
362         while aFolderIter.More() :
363             aFolderSObj = aFolderIter.Value()
364             aFolderIter.Next()
365             anIsFound, anAttr = aFolderSObj.FindAttribute("AttributeName")
366             if not anIsFound :
367                 continue
368             anAttr = anAttr._narrow(SALOMEDS.AttributeName);
369             aFolderName = anAttr.Value()
370             print "    ", aFolderName
371             
372             if aFolderName == 'Families' :
373                 anEntityIter = myLocalStudy.NewChildIterator(aFolderSObj);
374                 while anEntityIter.More() :
375                     anEntitySObj = anEntityIter.Value()
376                     anEntityIter.Next()
377                     anAttr = anEntitySObj.FindAttribute("AttributeName")[1]
378                     anAttr = anAttr._narrow(SALOMEDS.AttributeName);
379                     anEntityName = anAttr.Value()
380                     
381                     anEntityId = "3"
382                     if anEntityName == 'onNodes' :
383                         anEntity = VISU.NODE
384                         anEntityId = "0"
385                     if anEntityName == 'onEdges' :
386                         anEntity = VISU.EDGE
387                         anEntityId = "1"
388                     if anEntityName == 'onFaces' :
389                         anEntity = VISU.FACE
390                         anEntityId = "2"
391                     if anEntityName == 'onCells' :
392                         anEntity = VISU.CELL
393                         anEntityId = "3"
394
395                     if HasValue(thePrsTypeList,VISU.TMESH) :
396                         print "      ", anEntityName, aMeshName,
397                         aMesh = theVisu.MeshOnEntity(theResult,aMeshName,anEntity)
398                         if aMesh is None : print "Error"
399                         else :
400                             print ",OK"
401                             theView.DisplayOnly(aMesh)
402                             theView.FitAll()
403                             aPictureName = thePictureDir + aMeshNamePic + "_" + anEntityId + "." + thePictureExt
404                             aPictureName = re.sub("\s+","_", aPictureName);
405                             theView.SavePicture(aPictureName)
406                             if theIsAutoDelete :
407                                 aMesh.RemoveFromStudy()
408                             else :
409                                 aVISUObjList.append(aMesh)
410                         
411                         anFamilyIter = myLocalStudy.NewChildIterator(anEntitySObj);
412                         while anFamilyIter.More() :
413                             aFamilySObj = anFamilyIter.Value()
414                             anFamilyIter.Next()
415                             anAttr = aFamilySObj.FindAttribute("AttributeName")[1]
416                             anAttr = anAttr._narrow(SALOMEDS.AttributeName);
417                             anFamilyName = anAttr.Value()
418                             if HasValue(thePrsTypeList,VISU.TMESH) :
419                                 print "        ", anFamilyName,
420                                 aMesh = theVisu.FamilyMeshOnEntity(theResult,aMeshName,anEntity,anFamilyName)
421                                 if aMesh is None : print "Error"
422                                 else :
423                                     print ",OK"
424                                     theView.DisplayOnly(aMesh)
425                                     theView.FitAll()
426                                     aPictureName = thePictureDir + aMeshNamePic + "_" + anEntityId + "_" + anFamilyName + "." + thePictureExt
427                                     aPictureName = re.sub("\s+","_", aPictureName);
428                                     theView.SavePicture(aPictureName)
429                                     if theIsAutoDelete :
430                                         aMesh.RemoveFromStudy()
431                                     else :
432                                         aVISUObjList.append(aMesh)
433                                 
434             if aFolderName == 'Groups' :
435                 aGroupIter = myLocalStudy.NewChildIterator(aFolderSObj);
436                 while aGroupIter.More() :
437                     aGroupSObj = aGroupIter.Value()
438                     aGroupIter.Next()
439                     anAttr = aGroupSObj.FindAttribute("AttributeName")[1]
440                     anAttr = anAttr._narrow(SALOMEDS.AttributeName);
441                     aGroupName = anAttr.Value()
442                     if HasValue(thePrsTypeList,VISU.TMESH) :
443                         print "      ", aGroupName,
444                         aMesh = theVisu.GroupMesh(theResult,aMeshName,aGroupName)
445                         if aMesh is None : print "Error"
446                         else :
447                             print ",OK"
448                             theView.DisplayOnly(aMesh)
449                             theView.FitAll()
450                             aPictureName = thePictureDir + aMeshNamePic + "_" + aGroupName + "." + thePictureExt
451                             aPictureName = re.sub("\s+","_", aPictureName);
452                             theView.SavePicture(aPictureName)
453                             if theIsAutoDelete :
454                                 aMesh.RemoveFromStudy()
455                             else :
456                                 aVISUObjList.append(aMesh)
457                         
458             if aFolderName == 'Fields' :
459                 aFieldIter = myLocalStudy.NewChildIterator(aFolderSObj);
460                 while aFieldIter.More() :
461                     aFieldSObj = aFieldIter.Value()
462                     aFieldIter.Next()
463                     anAttr = aFieldSObj.FindAttribute("AttributeName")[1]
464                     anAttr = anAttr._narrow(SALOMEDS.AttributeName);
465                     aFieldName = anAttr.Value()
466                     print "      ", aFieldName
467                     
468                     anAttr = aFieldSObj.FindAttribute("AttributeString")[1]
469                     anAttr = anAttr._narrow(SALOMEDS.AttributeString);
470                     aFieldComment = anAttr.Value()
471                     aMap = StrToMap(aFieldComment)
472                     
473                     aTimeStampIter = myLocalStudy.NewChildIterator(aFieldSObj);
474                     if aTimeStampIter.More() :
475                         aTimeStampIter.Next()
476                         while aTimeStampIter.More() :
477                             aTimeStampSObj = aTimeStampIter.Value()
478                             aTimeStampIter.Next()
479                             anAttr = aTimeStampSObj.FindAttribute("AttributeName")[1]
480                             anAttr = anAttr._narrow(SALOMEDS.AttributeName);
481                             aTimeStampName = anAttr.Value()
482                             print "        ", aTimeStampName
483                             
484                             anAttr = aTimeStampSObj.FindAttribute("AttributeString")[1]
485                             anAttr = anAttr._narrow(SALOMEDS.AttributeString);
486                             aTimeStampComment = anAttr.Value()
487                             aMap = StrToMap(aTimeStampComment)
488                             aMeshName = aMap["myMeshName"]
489                             aFieldName = aMap["myFieldName"]
490                             aTimeStampId = atoi(aMap["myTimeStampId"])
491                             anEntity = IntToEntity(aMap["myEntityId"])
492                             anEntityId = str(aMap["myEntityId"]);
493                             #print aMeshName, aFieldName, anEntity, aTimeStampId
494                             if HasValue(thePrsTypeList,VISU.TSCALARMAP) :
495                                 print "          Creating ScalarMapOnField",
496                                 aPrsObj = theVisu.ScalarMapOnField(theResult,aMeshName,anEntity,aFieldName,aTimeStampId)
497                                 if aPrsObj is None : print "Error"
498                                 else :
499                                     print ",OK"
500                                     theView.DisplayOnly(aPrsObj)
501                                     theView.FitAll()
502                                     aPictureName = thePictureDir + aMeshNamePic + "_" + anEntityId + "_" + aFieldName + "_" + str(aTimeStampId) + "_TSCALARMAP." + thePictureExt
503                                     aPictureName = re.sub("\s+","_", aPictureName);
504                                     theView.SavePicture(aPictureName)
505                                     if theIsAutoDelete :
506                                         aPrsObj.RemoveFromStudy()
507                                     else :
508                                         aVISUObjList.append(aPrsObj)
509
510                             if HasValue(thePrsTypeList,VISU.TISOSURFACES) :
511                                 print "          Creating IsoSurfacesOnField",
512                                 aPrsObj = theVisu.IsoSurfacesOnField(theResult,aMeshName,anEntity,aFieldName,aTimeStampId)
513                                 if aPrsObj is None : print "Error"
514                                 else :
515                                     print ",OK"
516                                     theView.DisplayOnly(aPrsObj)
517                                     theView.FitAll()
518                                     aPictureName = thePictureDir + aMeshNamePic + "_" + anEntityId + "_" + aFieldName + "_" + str(aTimeStampId) + "_TISOSURFACES." + thePictureExt
519                                     aPictureName = re.sub("\s+","_", aPictureName);
520                                     theView.SavePicture(aPictureName)
521                                     if theIsAutoDelete :
522                                         aPrsObj.RemoveFromStudy()
523                                     else :
524                                         aVISUObjList.append(aPrsObj)
525                                 
526                             if HasValue(thePrsTypeList,VISU.TCUTPLANES) :
527                                 print "          Creating CutPlanesOnField",
528                                 aPrsObj = theVisu.CutPlanesOnField(theResult,aMeshName,anEntity,aFieldName,aTimeStampId)
529                                 if aPrsObj is None : print "Error"
530                                 else :
531                                     print ",OK"
532                                     aPrsObj.SetOrientation(VISU.CutPlanes.ZX,aPrsObj.GetRotateX(),aPrsObj.GetRotateY())
533                                     theView.DisplayOnly(aPrsObj)
534                                     theView.FitAll()
535                                     aPictureName = thePictureDir + aMeshNamePic + "_" + anEntityId + "_" + aFieldName + "_" + str(aTimeStampId) + "_TCUTPLANES." + thePictureExt
536                                     aPictureName = re.sub("\s+","_", aPictureName)
537                                     theView.SavePicture(aPictureName)
538                                     if theIsAutoDelete :
539                                         aPrsObj.RemoveFromStudy()
540                                     else :
541                                         aVISUObjList.append(aPrsObj)
542                                 
543                             if HasValue(thePrsTypeList,VISU.TCUTLINES) :
544                                 print "          Creating CutLinesOnField",
545                                 aPrsObj = theVisu.CutLinesOnField(theResult,aMeshName,anEntity,aFieldName,aTimeStampId)
546                                 if aPrsObj is None : print "Error"
547                                 else :
548                                     print ",OK"
549                                     aPrsObj.SetOrientation(VISU.CutPlanes.XY,aPrsObj.GetRotateX(),aPrsObj.GetRotateY())
550                                     aPrsObj.SetOrientation2(VISU.CutPlanes.ZX,aPrsObj.GetRotateX2(),aPrsObj.GetRotateY2())
551                                     theView.DisplayOnly(aPrsObj)
552                                     theView.FitAll()
553                                     aPictureName = thePictureDir + aMeshNamePic + "_" + anEntityId + "_" + aFieldName + "_" + str(aTimeStampId) + "_TCUTLINES." + thePictureExt
554                                     aPictureName = re.sub("\s+","_", aPictureName)
555                                     theView.SavePicture(aPictureName)
556                                     if theIsAutoDelete :
557                                         aPrsObj.RemoveFromStudy()
558                                     else :
559                                         aVISUObjList.append(aPrsObj)
560                                 
561                             if HasValue(thePrsTypeList,VISU.TPLOT3D) :
562                                 print "          Creating Plot3DOnField",
563                                 aPrsObj = theVisu.Plot3DOnField(theResult,aMeshName,anEntity,
564                                                                 aFieldName,aTimeStampId)
565                                 if aPrsObj is None : print "Error"
566                                 else :
567                                     print ",OK"
568                                 #aPrsObj.SetOrientation(VISU.CutPlanes.ZX,
569                                 #                       aPrsObj.GetRotateX(),
570                                 #                       aPrsObj.GetRotateY())
571                                     theView.DisplayOnly(aPrsObj)
572                                     theView.FitAll()
573                                     aPictureName = thePictureDir + aMeshNamePic + "_" + anEntityId + "_" + aFieldName + "_" + str(aTimeStampId) + "_TPLOT3D." + thePictureExt
574                                     aPictureName = re.sub("\s+","_", aPictureName)
575                                     theView.SavePicture(aPictureName)
576                                     if theIsAutoDelete :
577                                         aPrsObj.RemoveFromStudy()
578                                     else :
579                                         aVISUObjList.append(aPrsObj)
580                                 
581                             aNumComponent = atoi(aMap["myNumComponent"])
582                             if aNumComponent > 1 :
583                                 if HasValue(thePrsTypeList,VISU.TDEFORMEDSHAPE) :
584                                     print "          Creating DeformedShapeOnField",
585                                     aPrsObj = theVisu.DeformedShapeOnField(theResult,aMeshName,anEntity,aFieldName,aTimeStampId)
586                                     if aPrsObj is None : print "Error"
587                                     else :
588                                         print ",OK"
589                                         theView.DisplayOnly(aPrsObj)
590                                         theView.FitAll()
591                                         aPictureName = thePictureDir + aMeshNamePic + "_" + anEntityId + "_" + aFieldName + "_" + str(aTimeStampId) + "_TDEFORMEDSHAPE." + thePictureExt
592                                         aPictureName = re.sub("\s+","_", aPictureName)
593                                         theView.SavePicture(aPictureName)
594                                         if theIsAutoDelete :
595                                             aPrsObj.RemoveFromStudy()
596                                         else :
597                                             aVISUObjList.append(aPrsObj)
598
599                                 if HasValue(thePrsTypeList,VISU.TVECTORS) :
600                                     print "          Creating VectorsOnField",
601                                     aPrsObj = theVisu.VectorsOnField(theResult,aMeshName,anEntity,aFieldName,aTimeStampId)
602                                     if aPrsObj is None : print "Error"
603                                     else :
604                                         print ",OK"
605                                         theView.DisplayOnly(aPrsObj)
606                                         theView.FitAll()
607                                         aPictureName = thePictureDir + aMeshNamePic + "_" + anEntityId + "_" + aFieldName + "_" + str(aTimeStampId) + "_TVECTORS." + thePictureExt
608                                         aPictureName = re.sub("\s+","_", aPictureName)
609                                         theView.SavePicture(aPictureName)
610                                         if theIsAutoDelete :
611                                             aPrsObj.RemoveFromStudy()
612                                         else :
613                                             aVISUObjList.append(aPrsObj)
614                                     
615                                 if HasValue(thePrsTypeList,VISU.TSTREAMLINES) :
616                                     print "          Creating StreamLinesOnField",
617                                     aPrsObj = theVisu.StreamLinesOnField(theResult,aMeshName,anEntity,aFieldName,aTimeStampId)
618                                     if aPrsObj is None : print "Error"
619                                     else :
620                                         print ",OK"
621                                         theView.DisplayOnly(aPrsObj)
622                                         theView.FitAll()
623                                         aPictureName = thePictureDir + aMeshNamePic + "_" + anEntityId + "_" + aFieldName + "_" + str(aTimeStampId) + "_TSTREAMLINES." + thePictureExt
624                                         aPictureName = re.sub("\s+","_", aPictureName)
625                                         theView.SavePicture(aPictureName)
626                                         if theIsAutoDelete :
627                                             aPrsObj.RemoveFromStudy()
628                                         else :
629                                             aVISUObjList.append(aPrsObj)
630
631                                 if HasValue(thePrsTypeList,VISU.TSCALARMAPONDEFORMEDSHAPE) :
632                                     print "          Creating ScalarMapOnDeformedShapeOnField",
633                                     aPrsObj = theVisu.ScalarMapOnDeformedShapeOnField(theResult,aMeshName,anEntity,aFieldName,aTimeStampId)
634                                     if aPrsObj is None : print "Error"
635                                     else :
636                                         print ",OK"
637                                         theView.DisplayOnly(aPrsObj)
638                                         theView.FitAll()
639                                         aPictureName = thePictureDir + aMeshNamePic + "_" + anEntityId + "_" + aFieldName + "_" + str(aTimeStampId) + "_TSCALARMAPONDEFORMEDSHAPE." + thePictureExt
640                                         aPictureName = re.sub("\s+","_", aPictureName)
641                                         theView.SavePicture(aPictureName)
642                                         if theIsAutoDelete :
643                                             aPrsObj.RemoveFromStudy()
644                                         else :
645                                             aVISUObjList.append(aPrsObj)
646
647                                 if HasValue(thePrsTypeList,VISU.TGAUSSPOINTS) :
648                                     print "          Creating GaussPointsOnField",
649                                     aPrsObj = theVisu.GaussPointsOnField(theResult,aMeshName,anEntity,aFieldName,aTimeStampId)
650                                     if aPrsObj is None : print "Error"
651                                     else :
652                                         print ",OK"
653                                         theView.DisplayOnly(aPrsObj)
654                                         theView.FitAll()
655                                         aPictureName = thePictureDir + aMeshNamePic + "_" + anEntityId + "_" + aFieldName + "_" + str(aTimeStampId) + "_TGAUSSPOINTS." + thePictureExt
656                                         aPictureName = re.sub("\s+","_", aPictureName)
657                                         theView.SavePicture(aPictureName)
658                                         if theIsAutoDelete :
659                                             aPrsObj.RemoveFromStudy()
660                                             pass
661                                         else :
662                                             aVISUObjList.append(aPrsObj)
663                                             pass
664                                         pass
665                                     pass
666                                 
667     return aVISUObjList
668
669
670 def generateName(prefix = None):
671     import whrandom;
672     int = whrandom.randint(1,1000);
673     if prefix is None:
674         return "Study" + str(int)
675     else :
676         return prefix + str(int)
677     
678
679
680 # ----------------------
681 # MESH
682 # ----------------------
683 def try_mesh_parameters(theMeshPattern):
684     aResult = []
685     if theMeshPattern is None : return aResult ;
686     theMeshPattern =  theMeshPattern._narrow(VISU.Mesh)
687     if theMeshPattern is None : return aResult ;
688
689     aTYPES = [VISU.POINT, VISU.WIREFRAME, VISU.SHADED, VISU.INSIDEFRAME, VISU.SHRINK]
690     import copy; import os;
691     for ind in aTYPES:
692         aNewMesh = copy.deepcopy(theMeshPattern);
693         aNewMesh.SetPresentationType(ind)
694         aResult.append(aNewMesh)
695
696     return aResult
697
698
699 # ----------------------------    
700 # SCALAR MAP 
701 # ----------------------------    
702 ind=1  #try safe way
703 def try_scalarmap_parameters(thePattern, dump = 0):
704
705     if thePattern  is None : return None 
706
707     SCALING = [VISU.LINEAR, VISU.LOGARITHMIC]
708     import copy
709     import random
710
711     anObj = thePattern#copy.deepcopy(thePattern);
712     #ind = random.randint(1,2)
713     if ind%2 :
714             #try incorrect value deliberately (but allowed by idl description)
715             #try SetScalarMode(long)
716             mode = random.randint(-100000,100000); #incorrect value deliberately
717     else:
718             #correct value of ScalarMode
719             mode = random.randint(0, 3)
720
721     if dump : print "\tSetScalarMode(" + str(mode) +")"
722     anObj.SetScalarMode(mode)
723
724     # --- SCALING ---
725     scal = random.randint(0,1)
726     if dump : print "\tSetScaling(" + str(SCALING[scal]) +")"
727     anObj.SetScaling(SCALING[scal])
728         
729     # --- BOUNDARIES ---
730     if ind%2 :
731             alfa =  random.random()*random.randint(-100000,100000)
732             betta = random.random()*random.randint(-100000,100000)
733             aMin = alfa; aMax = betta
734     else:
735             #more correct set
736             aPMin = thePattern.GetMin()
737             aPMax = thePattern.GetMax()
738             aLen = aPMax - aPMin
739             alfa =  random.random()%0.5
740             betta = random.random()%0.5
741             aMin = alfa*aLen*random.randint(-1,1) + aPMin
742             aMax = betta*aLen*random.randint(-1,1) + aPMax
743     if dump : print "\tSetRange(" + str(aMin) + ", " + str(aMax) + ")"
744     anObj.SetRange(aMin, aMax)
745
746         # --- POSITION ---
747     if ind%2:
748             X=random.random()*random.randint(-100000,100000)
749             Y=random.random()*random.randint(-100000,100000)
750     else :
751              X=random.random()
752              Y=random.random()
753     if dump : print "SetPosition("+ str(X) + ", " + str(Y) + " )"
754     anObj.SetPosition(X, Y)
755
756         # --- SCALAR BAR SIZE ---
757     if ind%2:
758             aWidth=random.random()*random.randint(-100000,100000)
759             aHeight=random.random()*random.randint(-100000,100000)
760     else :
761              aWidth=random.random()
762              aHeight=random.random()
763     if dump : print " SCALAR BAR Width = " + str(aWidth) + " Height = ", str(aHeight)
764     anObj.SetSize(aWidth, aHeight)
765     
766     return anObj
767
768
769 def dump_scalarmap_parameters(anObj):
770     
771     print "\tGetScalarMode() = " + str(anObj.GetScalarMode()) 
772     print "\tGetScaling() = " + str(anObj.GetScaling()) 
773     print "\tGetMin() = " + str(anObj.GetMin()) + "  GetMax() = " + str (anObj.GetMax())
774     print "\tGetOrientation() = " + str(anObj.GetOrientation())
775     print "\tGetPosX() = ", str(anObj.GetPosX()) + "  GetPosY() = ", str(anObj.GetPosY())
776     print "\tGetWidth() = ", str ( anObj.GetWidth()) + "  GetHeight() = " + str(anObj.GetHeight())
777
778 # ----------------------
779 # DEFORMED SHAPE
780 # ----------------------
781 def try_deformedshape_parameters(thePattern) :
782
783     if thePattern  is None : return None 
784     import copy
785     import random
786
787     anObj = try_scalarmap_parameters(thePattern)
788
789     # --- SCALING ---
790     if ind%2:
791         anObj.SetScale( random.random()*random.randint(-100000, 100000))
792     else :
793         anObj.SetScale( anObj.GetScale()*random.random())
794
795     return anObj
796
797
798 def dump_deformedshape_parameters(theObject):
799     dump_scalarmap_parameters(theObject)
800     print "GetScale() = ", theObject.GetScale()
801     
802 # ----------------------
803 # CUT PLANES
804 # ----------------------
805 def try_cutplanes_parameters(thePattern) :
806
807     if thePattern  is None : return None 
808     import copy
809     import random
810
811     ORIENT = [VISU.CutPlanes.XY, VISU.CutPlanes.YZ, VISU.CutPlanes.ZX]
812
813     ind = random.randint(1,2)
814     anObj = try_scalarmap_parameters(thePattern)
815         
816     if ind%2 :   anObj.SetNbPlanes(random.randint(-40,40))
817     else :       anObj.SetNbPlanes(random.randint(0,10)) #try behaivor if NbPlanes=0
818
819     # --- DISPLACEMENT ---
820     anObj.SetDisplacement(random.randint(-100000,100000))
821
822     # --- PLANE POSITION ---
823     if ind%2:
824         PlaneNb = random.randint(-100000,100000) #incorrect value is possible
825     else    : PlaneNb = random.randint(0, anObj.GetNbPlanes())
826         
827     anObj.SetPlanePosition(PlaneNb, random.random()*random.randint(-100000,100000))
828
829     # --- SET DEFAULT ---
830     anObj.SetDefault(PlaneNb)
831
832     # --- SET X,Y,Z ROTATION ---
833     if ind%2 :
834             angle1 = random.random()*random.randint(-100000,100000)
835             angle2 = random.random()*random.randint(-100000,100000)
836     else :
837             angle1 = random.random()*3.14
838             angle2 = random.random()*3.14
839         
840     # --- ORIENTATION ---
841     anObj.SetOrientation(ORIENT[random.randint(0,2)],angle1,angle2)
842
843     return anObj
844         
845 def dump_cutplanes_parameters(theObject):
846         dump_saclarmap_parameters(theObject)
847
848         print "GetOrientationType = " + str(theObject.GetOrientationType())
849         PlanesNb = theObject.GetNbPlanes()
850         print "GetNbPlanes() = ", str(PlanesNb)
851         for i in range(0,PlanesNb+1):
852             if theObject.IsDefault(i) :
853                 print "Default plane : "+str(i); break
854         print "GetPlanePosition(" + str(i) + ") = ", theObject.GetPlanePosition(i)
855         print "GetDisplacement() = ", str(theObject.GetDisplacement())
856         print "GetRotateX() = ", str(theObject.GetRotateX())
857         print "GetRotateY() = ", str(theObject.GetRotateY())
858         print "GetRotateZ() = ", str(theObject.GetRotateZ())
859
860 # ----------------------
861 # CUT LINES
862 # ----------------------
863 def try_cutlines_parameters(thePattern):
864
865     if thePattern  is None : return None 
866     import copy
867     import random
868
869     ORIENT = [VISU.CutPlanes.XY, VISU.CutPlanes.YZ, VISU.CutPlanes.ZX]
870     ind = random.randint(1,2)
871     anObj = try_scalarmap_parameters(thePattern)
872
873     # --- ORIENTATION ---
874     anObj.SetOrientation(ORIENT[random.randint(0,2)],
875                          random.randint(-100,100)*random.random(),
876                          random.randint(-100,100)*random.random())
877     anObj.SetOrientation2(ORIENT[random.randint(0,2)],
878                           random.randint(-100,100)*random.random(),
879                           random.randint(-100,100)*random.random())
880
881     # --- Base Plane Position ---
882     anObj.SetBasePlanePosition( random.random()*random.randint(-100000,100000))
883
884     # --- NUMBER OF LINES ---
885     if ind%2:
886             anObj.SetNbLines(random.randint(-5, 50))
887
888     return anObj
889
890 def dump_cutlines_parameters(theObject):
891     dump_scalarmap_parameters(theObject)
892
893     print "GetOrientationType() = " + str(theObject.GetOrientationType())
894     print "GetOrientationType2() = " + str(theObject.GetOrientationType2())
895     print "GetBasePlanePosition() = "+ str(theObject.GetBasePlanePosition())
896     print "GetNbLines() = " + str(theObject.GetNbLines())
897     print "GetRotateX() = ", str(theObject.GetRotateX())
898     print "GetRotateX2() = ", str(theObject.GetRotateX2())
899     print "GetRotateY() = ", str(theObject.GetRotateY())
900     print "GetRotateY2() = ", str(theObject.GetRotateY2())
901
902 # ----------------------
903 # STREAM LINES
904 # ----------------------
905 def try_streamlines_parameters(thePattern):
906
907     if thePattern  is None : return None 
908     import copy
909     import random
910
911     DIRECTION = [VISU.StreamLines.FORWARD, VISU.StreamLines.BACKWARD, VISU.StreamLines.BOTH]
912
913     ind = random.randint(1,2)
914     anObj = (try_deformedshape_parameters(thePattern))[0]
915
916     # --- DIREACTION ---
917     anObj.SetDirection(DIRECTION[random.randint(0,2)])
918
919     # --- STEP LENGTH ---
920     if ind%2 : anObj.SetStepLength(random.random()*random.randint(-1000,1000))
921     else :
922             aLen = anObj.GetMax() - anObj.GetMin()
923             anObj.SetStepLength(aLen/random.randint(1,100))
924             
925     # --- PROPAGATION TIME ---
926     anObj.SetPropagationTime(random.random()*random.randint(1,100))
927
928     # --- INTEGRATION STEP ---
929     if ind%2 :
930             anObj.SetIntegrationStep(random.random()*random.randint(-1000,1000))
931     else:
932             anObj.SetIntegrationStep(random.random())
933
934     # --- USED POINT ---
935     anObj.SetUsedPoints(random.random()*random.randint(-10000,10000))
936
937     return anObj
938         
939 def dump_streamlines_parameters(theObject):
940     
941     dump_deformedshape_parameters(theObject)
942     
943     print "GetDirection() = "      + str(theObject.GetDirection())
944     print "GetStepLength() = "     + str(theObject.GetStepLength())
945     print "GetPropagationTime() =" + str(theObject.GetPropagationTime())
946     print "GetIntegrationStep() =" + str(theObject.GetIntegrationStep())
947     print "GetUsedPoints()      =" + str(theObject.GetUsedPoints())
948     
949 # ----------------------
950 # VECTORS     
951 # ----------------------
952 def try_vectors_parameters(thePattern, theNum):
953
954     if thePattern  is None : return None 
955     import copy
956     import random
957     GLIPH_TYPE = [VISU.Vectors.ARROW, VISU.Vectors.CONE2, VISU.Vectors.CONE6, VISU.Vectors.NONE]
958     GLIPH_POS = [VISU.Vectors.CENTER, VISU.Vectors.TAIL, VISU.Vectors.HEAD]
959     ind = random.randint(1,2)
960     anObj = (try_deformedshape_parameters(thePattern))[0]
961
962     # --- LINE WIDTH ---
963     if ind%2 :
964             anObj.SetLineWidth(random.random()*random.randint(-10000,10000))
965     else :
966             anObj.SetLineWidth(random.randint(1, 10))
967
968     # --- GLIPH TYPE ---
969     anObj.SetGlyphType(GLIPH_TYPE[random.randint(0, len(GLIPH_TYPE)-1)])
970         
971     # --- GLIPH POS ---
972     anObj.SetGlyphPos(GLIPH_POS[random.randint(0, len(GLIPH_POS)-1)])
973     
974     return anObj
975
976 def dump_vectors_parameters(theObject):
977     
978     dump_deformedshape_parameters(theObject)
979     
980     print "GetLineWidth() = " +str(theObject.GetLineWidth())
981     print "GetGlyphType() = " +str(theObject.GetGlyphType())
982     print "GetGlyphPos()  = " +str(theObject.GetGlyphPos())
983
984
985 # ----------------------
986 # ISO SURFACES     
987 # ----------------------
988
989 def try_isosurfaces_parameters(thePattern) :
990     if thePattern  is None : return None 
991     import copy
992     import random
993     
994     anObj = try_scalarmap_parameters(thePattern)
995     ind = random.randint(1,2)   
996     # --- SURFACES NUMBER ---
997     if ind%2 :
998             anObj.SetNbSurfaces(random.randint(-100000,100000))
999     else:
1000             anObj.SetNbSurfaces(random.randint(1, 50))
1001             
1002     return anObj
1003
1004 def dump_isosurfaces_parameters(theObject):
1005     
1006     dump_scalarmap_parameters(theObject)
1007     print "GetNbSurfaces() = "+ str(theObject.GetNbSurfaces())
1008
1009 # ----------------------------
1010 # SCALAR MAP ON DEFORMED SHAPE
1011 # ----------------------------
1012 def dump_scalarmapondeformedshape_parameters(theObject):
1013     dump_scalarmap_parameters(theObject)
1014     print "GetScale()          =", theObject.GetScale()
1015     print "GetScalarCMeshName ()=|",theObject.GetScalarCMeshName(),"|"
1016     print "GetScalarCFieldName()=|",theObject.GetScalarCFieldName(),"|"
1017     print "GetScalarEEntity()   =",theObject.GetScalarEEntity()
1018     print "GetScalarLIteration()=",theObject.GetScalarLIteration()
1019     pass
1020
1021 def try_scalarmapondeformedshape_parameters(thePattern):
1022
1023     if thePattern  is None : return None 
1024     import copy
1025     import random
1026
1027     anObj = try_scalarmap_parameters(thePattern)
1028
1029     # --- SCALING ---
1030     print 
1031     anObj.SetScale( anObj.GetScale()/random.random()*random.randint(1,10))
1032
1033     # --- Scalar Field ---
1034     # not implemented yet.
1035     
1036     return anObj
1037 # ----------------------
1038 # PLOT 3D 
1039 # ----------------------
1040 def dump_plot3d_parameters(theObject):
1041     dump_scalarmap_parameters(theObject)
1042     print "GetOrientationType()=",str(theObject.GetOrientationType())
1043     print "GetRotateX()=",theObject.GetRotateX()
1044     print "GetRotateY()=",theObject.GetRotateY()
1045     print "GetPlanePosition()=",theObject.GetPlanePosition()
1046     print "IsPositionRelative()=",theObject.IsPositionRelative()
1047     print "GetScaleFactor()=",theObject.GetScaleFactor()
1048     print "GetIsContourPrs()=",theObject.GetIsContourPrs()
1049     print "GetNbOfContours()=",theObject.GetNbOfContours()
1050     pass
1051
1052 def try_plot3d_parameters(thePattern):
1053     if thePattern is None : return None
1054     import random
1055     
1056     anObj = try_scalarmap_parameters(thePattern)
1057
1058     ORIENT = [VISU.Plot3D.XY, VISU.Plot3D.YZ, VISU.Plot3D.ZX]
1059
1060     theXAngle = random.random()*random.randint(-180,180)
1061     theYAngle = random.random()*random.randint(-180,180)
1062
1063     # ORIENTATION and ANGLES
1064     anObj.SetOrientation(ORIENT[random.randint(0,2)],theXAngle,theYAngle)
1065
1066     # Plane position (revative)
1067     anObj.SetPlanePosition(random.random(),1)
1068
1069     # SCALE FACTOR
1070     anObj.SetScaleFactor(random.random()*random.randint(-10000,10000))
1071
1072     # CONTOUR PRS
1073     anObj.SetContourPrs(random.randint(0,1))
1074     if anObj.GetIsContourPrs():
1075         anObj.SetNbOfContours(random.randint(1,999))
1076         pass
1077     
1078     pass
1079
1080 # ----------------------
1081 # Gauss points
1082 # ----------------------
1083 def dump_gausspoints_parameters(theObject):
1084     
1085     print "\tGetScalarMode() = " + str(anObj.GetScalarMode())
1086     print "\tGetMin() = " + str(anObj.GetMin()) + "  GetMax() = " + str (anObj.GetMax())
1087     print "\tGetPosX() = ", str(anObj.GetPosX()) + "  GetPosY() = ", str(anObj.GetPosY())
1088     print "\tGetWidth() = ", str ( anObj.GetWidth()) + "  GetHeight() = " + str(anObj.GetHeight())
1089     print "\tGetNbColors() = " + str(anObj.GetNbColors())
1090     print "\tGetLabels() = " + str(anObj.GetLabels())
1091     print "\tGetTitle() = " + str(anObj.GetTitle())
1092     pass
1093
1094 def try_plot3d_parameters(thePattern):
1095     if thePattern is None : return None
1096     import random
1097     
1098     pass
1099
1100 # ----------------------
1101 # TABLES AND CURVES
1102 # ----------------------
1103
1104 def FillTable( theTable, theValues, theRows, theColumns, theRowTitles, theRowUnits, theColumnTitles ):
1105     if theTable is None: return
1106     if len(theRows) != len(theColumns): return
1107     if len(theRows) != len(theValues): return
1108     i = 0
1109     for value in theValues:
1110         theTable.PutValue( value, theRows[ i ], theColumns[ i ])
1111         i = i + 1
1112         pass
1113     i = 1
1114     for title in theRowTitles:
1115         theTable.SetRowTitle( i, title )
1116         theTable.SetRowUnit( i, theRowUnits[ i - 1 ])
1117         i = i + 1
1118         pass
1119     i = 1
1120     for title in theColumnTitles:
1121         theTable.SetColumnTitle( i, title )
1122         i = i + 1
1123         pass
1124     pass
1125
1126 def CreateCurve( theTable, theHRow, theVRow, theTitle, theColor, theMarker, theLineType, theLineWidth ):
1127     if theTitle is None: return
1128     curve = myLocalVisu.CreateCurve( theTable, theHRow, theVRow );
1129     if curve:
1130         curve.SetTitle( theTitle )
1131         curve.SetColor( theColor )
1132         curve.SetMarker( theMarker )
1133         curve.SetLine( theLineType, theLineWidth )
1134         pass
1135     return curve