1 # VISU VISU_SWIG : binding of C++ implementation and Python
3 # Copyright (C) 2003 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
4 # CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
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.
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.
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
20 # See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
22 # File : batchmode_visu.py
25 from batchmode_salome import *
28 myVisu = visu.Initialize(orb,naming_service,lcc,myStudyManager,myStudy,10)
30 raise RuntimeError, "myVisu is none, VISU component is not loaded or found"
32 def try_mesh_parameters(theMeshPattern):
34 if theMeshPattern is None : return aResult ;
35 theMeshPattern = theMeshPattern._narrow(VISU.Mesh)
36 if theMeshPattern is None : return aResult ;
38 aTYPES = [VISU.POINT, VISU.WIREFRAME, VISU.SHADED, VISU.INSIDEFRAME, VISU.SHRINK]
39 import copy; import os;
41 aNewMesh = copy.deepcopy(theMeshPattern);
42 aNewMesh.SetPresentationType(ind)
43 aResult.append(aNewMesh)
47 def try_scalarmap_parameters(thePattern, theNum):
49 if thePattern is None : return aList
50 thePattern = thePattern._narrow(VISU.ScalarMap)
51 if thePattern is None : return aList
52 SCALING = [VISU.LINEAR, VISU.LOGARITHMIC]
55 for ind in range(0,theNum):
56 anObj = copy.deepcopy(thePattern);
58 #try incorrect value deliberately (but allowed by idl description)
59 #try SetScalarMode(long)
60 mode = random.randint(-100000,100000); #incorrect value deliberately
62 #correct value of ScalarMode
63 mode = random.randint(0, 3)
65 print "\tSetScalarMode(" + str(mode) +")"
66 anObj.SetScalarMode(mode)
69 scal = random.randint(0,1)
70 print "\tSetScaling(" + str(SCALING[scal]) +")"
71 anObj.SetScaling(SCALING[scal])
75 alfa = random.random()*random.randint(-100000,100000)
76 betta = random.random()*random.randint(-100000,100000)
77 aMin = alfa; aMax = betta
80 aPMin = thePattern.GetMin()
81 aPMax = thePattern.GetMax()
83 alfa = random.random()%0.5
84 betta = random.random()%0.5
85 aMin = alfa*aLen*random.randint(-1,1) + aPMin
86 aMax = betta*aLen*random.randint(-1,1) + aPMax
87 print "\tSetRange(" + str(aMin) + ", " + str(aMax) + ")"
88 anObj.SetRange(aMin, aMax)