[Paraview] [help] Volume rendering in ParaviewWeb

le Anh Dung anh-dung.le at insa-lyon.fr
Tue May 24 10:14:30 EDT 2011


Hello everybody,
I tried to write a plugin (renderVol.py attached) to do a volume  
rendering in PWConsole of ParaviewWeb.
When I tried to set the ColorArrayName or Representation (functions in  
renderVol.py), I always got this:

Traceback (most recent call last):
   File "<jsonrpc>", line 147, in handle_request
   File "/root/ParaViewWeb/WebServer/PW-work/plugins/renderVol.py",  
line 24, in setColorArrayName
     dp.ColorArrayName = a
   File  
"/root/ParaView3/build-paraview3/Utilities/VTKPythonWrapping/site-packages/paraview/servermanager.py", line 210, in  
__setattr__
     setter(self, value)
   File  
"/root/ParaView3/build-paraview3/Utilities/VTKPythonWrapping/site-packages/paraview/servermanager.py", line 2384, in  
setProperty
     return self.SetPropertyWithName(propName, value)
   File  
"/root/ParaView3/build-paraview3/Utilities/VTKPythonWrapping/site-packages/paraview/servermanager.py", line 265, in  
SetPropertyWithName
     prop.SetData(arg)
   File  
"/root/ParaView3/build-paraview3/Utilities/VTKPythonWrapping/site-packages/paraview/servermanager.py", line 681, in  
SetData
     raise ValueError("Expected a tuple of 2 values or a string.")
ValueError: Expected a tuple of 2 values or a string.
------------------------------------------------------------
2011-05-24 15:58:57,584 - pw-logger - DEBUG - return of  
execute_command_on_plugin {'error': {'message': 'Expected a tuple of 2  
values or a string.', 'name': 'ValueError'}, 'result': None, 'id': 1}

It'll work fine if I set them fix in my renderVol.py
examples:
    dp.ColorArrayName = 'MetaImage'
or dp.Representation = 'Volume'
But I want to set them manualy in PWConsole and then get that error :(
Could anyone please help me ? :)

Thank you in advance.
Have a nice day :)

----------------------------------------------------
Anh Dung LE.
INSA de Lyon - Télécommunications, Services & Usages



-------------- next part --------------
from paraview.simple import *
import os
import threading
 
buildDir = '/root/ParaView3/build-paraview3/bin'

def init():
   global dp
   dp = GetDisplayProperties()
   dp.LookupTable = MakeBlueToRedLT(37.35, 276)
   dp.ColorAttributeType = 'POINT_DATA'

def getRepresentation():
   return  dp.GetProperty("Representation").Available

def getColorAttributeType():
   return  dp.GetProperty("ColorAttributeType").Available

def getColorArrayName():
   return  dp.GetProperty("ColorArrayName").Available

def setColorArrayName(a):
   global dp
   dp.ColorArrayName = a

def setRepresentation(b):
   global dp
   dp.Representation = b


More information about the ParaView mailing list