1 # VISU VISU_SWIG : binding of C++ implementation and Python
3 # Copyright (C) 2003 CEA/DEN, EDF R&D
7 # File : batchmode_visu.py
12 from time import sleep
17 from omniORB import CORBA
19 from batchmode_salome import *
22 myVisu = visu.Initialize(orb,naming_service,lcc,myStudyManager,myStudy,10)
24 raise RuntimeError, "myVisu is none, VISU component is not loaded or found"
26 def try_mesh_parameters(theMeshPattern):
28 if theMeshPattern is None : return aResult ;
29 theMeshPattern = theMeshPattern._narrow(VISU.Mesh)
30 if theMeshPattern is None : return aResult ;
32 aTYPES = [VISU.POINT, VISU.WIREFRAME, VISU.SHADED, VISU.INSIDEFRAME, VISU.SHRINK]
33 import copy; import os;
35 aNewMesh = copy.deepcopy(theMeshPattern);
36 aNewMesh.SetPresentationType(ind)
37 aResult.append(aNewMesh)
41 def try_scalarmap_parameters(thePattern, theNum):
43 if thePattern is None : return aList
44 thePattern = thePattern._narrow(VISU.ScalarMap)
45 if thePattern is None : return aList
46 SCALING = [VISU.LINEAR, VISU.LOGARITHMIC]
49 for ind in range(0,theNum):
50 anObj = copy.deepcopy(thePattern);
52 #try incorrect value deliberately (but allowed by idl description)
53 #try SetScalarMode(long)
54 mode = random.randint(-100000,100000); #incorrect value deliberately
56 #correct value of ScalarMode
57 mode = random.randint(0, 3)
59 print "\tSetScalarMode(" + str(mode) +")"
60 anObj.SetScalarMode(mode)
63 scal = random.randint(0,1)
64 print "\tSetScaling(" + str(SCALING[scal]) +")"
65 anObj.SetScaling(SCALING[scal])
69 alfa = random.random()*random.randint(-100000,100000)
70 betta = random.random()*random.randint(-100000,100000)
71 aMin = alfa; aMax = betta
74 aPMin = thePattern.GetMin()
75 aPMax = thePattern.GetMax()
77 alfa = random.random()%0.5
78 betta = random.random()%0.5
79 aMin = alfa*aLen*random.randint(-1,1) + aPMin
80 aMax = betta*aLen*random.randint(-1,1) + aPMax
81 print "\tSetRange(" + str(aMin) + ", " + str(aMax) + ")"
82 anObj.SetRange(aMin, aMax)