1 # -*- coding: iso-8859-1 -*-
2 # Copyright (C) 2007-2008 CEA/DEN, EDF R&D, OPEN CASCADE
4 # Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
5 # CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
7 # This library is free software; you can redistribute it and/or
8 # modify it under the terms of the GNU Lesser General Public
9 # License as published by the Free Software Foundation; either
10 # version 2.1 of the License.
12 # This library is distributed in the hope that it will be useful,
13 # but WITHOUT ANY WARRANTY; without even the implied warranty of
14 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
15 # Lesser General Public License for more details.
17 # You should have received a copy of the GNU Lesser General Public
18 # License along with this library; if not, write to the Free Software
19 # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
21 # See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
23 # VISU VISU_SWIG : binding of C++ implementation and Python
24 # File : batchmode_visu.py
27 from batchmode_salome import *
31 myVisu = visu.Initialize(orb,naming_service,lcc,myStudyManager,myStudy,10)
33 raise RuntimeError, "myVisu is none, VISU component is not loaded or found"
35 myVisu.SetCurrentStudy(salome.myStudy)
37 def try_mesh_parameters(theMeshPattern):
39 if theMeshPattern is None : return aResult ;
40 theMeshPattern = theMeshPattern._narrow(VISU.Mesh)
41 if theMeshPattern is None : return aResult ;
43 aTYPES = [VISU.POINT, VISU.WIREFRAME, VISU.SHADED, VISU.INSIDEFRAME, VISU.SHRINK]
44 import copy; import os;
46 aNewMesh = copy.deepcopy(theMeshPattern);
47 aNewMesh.SetPresentationType(ind)
48 aResult.append(aNewMesh)
52 def try_scalarmap_parameters(thePattern, theNum):
54 if thePattern is None : return aList
55 thePattern = thePattern._narrow(VISU.ScalarMap)
56 if thePattern is None : return aList
57 SCALING = [VISU.LINEAR, VISU.LOGARITHMIC]
60 for ind in range(0,theNum):
61 anObj = copy.deepcopy(thePattern);
63 #try incorrect value deliberately (but allowed by idl description)
64 #try SetScalarMode(long)
65 mode = random.randint(-100000,100000); #incorrect value deliberately
67 #correct value of ScalarMode
68 mode = random.randint(0, 3)
70 print "\tSetScalarMode(" + str(mode) +")"
71 anObj.SetScalarMode(mode)
74 scal = random.randint(0,1)
75 print "\tSetScaling(" + str(SCALING[scal]) +")"
76 anObj.SetScaling(SCALING[scal])
80 alfa = random.random()*random.randint(-100000,100000)
81 betta = random.random()*random.randint(-100000,100000)
82 aMin = alfa; aMax = betta
85 aPMin = thePattern.GetMin()
86 aPMax = thePattern.GetMax()
88 alfa = random.random()%0.5
89 betta = random.random()%0.5
90 aMin = alfa*aLen*random.randint(-1,1) + aPMin
91 aMax = betta*aLen*random.randint(-1,1) + aPMax
92 print "\tSetRange(" + str(aMin) + ", " + str(aMax) + ")"
93 anObj.SetRange(aMin, aMax)