1 # VISU VISU_SWIG : binding of C++ implementation and Python
3 # Copyright (C) 2003 CEA/DEN, EDF R&D
7 # File : batchmode_visu.py
10 from batchmode_salome import *
13 myVisu = visu.Initialize(orb,naming_service,lcc,myStudyManager,myStudy,10)
15 raise RuntimeError, "myVisu is none, VISU component is not loaded or found"
17 def try_mesh_parameters(theMeshPattern):
19 if theMeshPattern is None : return aResult ;
20 theMeshPattern = theMeshPattern._narrow(VISU.Mesh)
21 if theMeshPattern is None : return aResult ;
23 aTYPES = [VISU.POINT, VISU.WIREFRAME, VISU.SHADED, VISU.INSIDEFRAME, VISU.SHRINK]
24 import copy; import os;
26 aNewMesh = copy.deepcopy(theMeshPattern);
27 aNewMesh.SetPresentationType(ind)
28 aResult.append(aNewMesh)
32 def try_scalarmap_parameters(thePattern, theNum):
34 if thePattern is None : return aList
35 thePattern = thePattern._narrow(VISU.ScalarMap)
36 if thePattern is None : return aList
37 SCALING = [VISU.LINEAR, VISU.LOGARITHMIC]
40 for ind in range(0,theNum):
41 anObj = copy.deepcopy(thePattern);
43 #try incorrect value deliberately (but allowed by idl description)
44 #try SetScalarMode(long)
45 mode = random.randint(-100000,100000); #incorrect value deliberately
47 #correct value of ScalarMode
48 mode = random.randint(0, 3)
50 print "\tSetScalarMode(" + str(mode) +")"
51 anObj.SetScalarMode(mode)
54 scal = random.randint(0,1)
55 print "\tSetScaling(" + str(SCALING[scal]) +")"
56 anObj.SetScaling(SCALING[scal])
60 alfa = random.random()*random.randint(-100000,100000)
61 betta = random.random()*random.randint(-100000,100000)
62 aMin = alfa; aMax = betta
65 aPMin = thePattern.GetMin()
66 aPMax = thePattern.GetMax()
68 alfa = random.random()%0.5
69 betta = random.random()%0.5
70 aMin = alfa*aLen*random.randint(-1,1) + aPMin
71 aMax = betta*aLen*random.randint(-1,1) + aPMax
72 print "\tSetRange(" + str(aMin) + ", " + str(aMax) + ")"
73 anObj.SetRange(aMin, aMax)