1 # Copyright (C) 2007-2008 CEA/DEN, EDF R&D, OPEN CASCADE
3 # Copyright (C) 2003-2007 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 # VISU VISU_SWIG : binding of C++ implementation and Python
23 # File : batchmode_visu.py
26 from batchmode_salome import *
29 myVisu = visu.Initialize(orb,naming_service,lcc,myStudyManager,myStudy,10)
31 raise RuntimeError, "myVisu is none, VISU component is not loaded or found"
33 def try_mesh_parameters(theMeshPattern):
35 if theMeshPattern is None : return aResult ;
36 theMeshPattern = theMeshPattern._narrow(VISU.Mesh)
37 if theMeshPattern is None : return aResult ;
39 aTYPES = [VISU.POINT, VISU.WIREFRAME, VISU.SHADED, VISU.INSIDEFRAME, VISU.SHRINK]
40 import copy; import os;
42 aNewMesh = copy.deepcopy(theMeshPattern);
43 aNewMesh.SetPresentationType(ind)
44 aResult.append(aNewMesh)
48 def try_scalarmap_parameters(thePattern, theNum):
50 if thePattern is None : return aList
51 thePattern = thePattern._narrow(VISU.ScalarMap)
52 if thePattern is None : return aList
53 SCALING = [VISU.LINEAR, VISU.LOGARITHMIC]
56 for ind in range(0,theNum):
57 anObj = copy.deepcopy(thePattern);
59 #try incorrect value deliberately (but allowed by idl description)
60 #try SetScalarMode(long)
61 mode = random.randint(-100000,100000); #incorrect value deliberately
63 #correct value of ScalarMode
64 mode = random.randint(0, 3)
66 print "\tSetScalarMode(" + str(mode) +")"
67 anObj.SetScalarMode(mode)
70 scal = random.randint(0,1)
71 print "\tSetScaling(" + str(SCALING[scal]) +")"
72 anObj.SetScaling(SCALING[scal])
76 alfa = random.random()*random.randint(-100000,100000)
77 betta = random.random()*random.randint(-100000,100000)
78 aMin = alfa; aMax = betta
81 aPMin = thePattern.GetMin()
82 aPMax = thePattern.GetMax()
84 alfa = random.random()%0.5
85 betta = random.random()%0.5
86 aMin = alfa*aLen*random.randint(-1,1) + aPMin
87 aMax = betta*aLen*random.randint(-1,1) + aPMax
88 print "\tSetRange(" + str(aMin) + ", " + str(aMax) + ")"
89 anObj.SetRange(aMin, aMax)