1 # -*- coding: iso-8859-1 -*-
2 # Copyright (C) 2007-2012 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
24 # VISU VISU_SWIG : binding of C++ implementation and Python
25 # File : batchmode_visu.py
28 from batchmode_salome import *
32 myVisu = visu.Initialize(orb,naming_service,lcc,myStudyManager,myStudy,10)
34 raise RuntimeError, "myVisu is none, VISU component is not loaded or found"
36 myVisu.SetCurrentStudy(salome.myStudy)
38 def try_mesh_parameters(theMeshPattern):
40 if theMeshPattern is None : return aResult ;
41 theMeshPattern = theMeshPattern._narrow(VISU.Mesh)
42 if theMeshPattern is None : return aResult ;
44 aTYPES = [VISU.POINT, VISU.WIREFRAME, VISU.SHADED, VISU.INSIDEFRAME, VISU.SHRINK]
45 import copy; import os;
47 aNewMesh = copy.deepcopy(theMeshPattern);
48 aNewMesh.SetPresentationType(ind)
49 aResult.append(aNewMesh)
53 def try_scalarmap_parameters(thePattern, theNum):
55 if thePattern is None : return aList
56 thePattern = thePattern._narrow(VISU.ScalarMap)
57 if thePattern is None : return aList
58 SCALING = [VISU.LINEAR, VISU.LOGARITHMIC]
61 for ind in range(0,theNum):
62 anObj = copy.deepcopy(thePattern);
64 #try incorrect value deliberately (but allowed by idl description)
65 #try SetScalarMode(long)
66 mode = random.randint(-100000,100000); #incorrect value deliberately
68 #correct value of ScalarMode
69 mode = random.randint(0, 3)
71 print "\tSetScalarMode(" + str(mode) +")"
72 anObj.SetScalarMode(mode)
75 scal = random.randint(0,1)
76 print "\tSetScaling(" + str(SCALING[scal]) +")"
77 anObj.SetScaling(SCALING[scal])
81 alfa = random.random()*random.randint(-100000,100000)
82 betta = random.random()*random.randint(-100000,100000)
83 aMin = alfa; aMax = betta
86 aPMin = thePattern.GetMin()
87 aPMax = thePattern.GetMax()
89 alfa = random.random()%0.5
90 betta = random.random()%0.5
91 aMin = alfa*aLen*random.randint(-1,1) + aPMin
92 aMax = betta*aLen*random.randint(-1,1) + aPMax
93 print "\tSetRange(" + str(aMin) + ", " + str(aMax) + ")"
94 anObj.SetRange(aMin, aMax)