[Paraview] PvPython: Usage Syntax TransformFilter

Tobias Fröbel tfroebel at gmx.de
Wed Apr 23 08:28:11 EDT 2008


Hello,

I'm trying to apply the TransformFilter to a objekt. Here is a example python code



	#!/usr/bin/python
	import sys
	import os
	import math

	sys.path.insert(0 ,"/usr/lib/paraview-3.2/")

	from paraview import servermanager

	if not servermanager.ActiveConnection:
        	connection = servermanager.Connect()

	#objekt
	coneSource = servermanager.sources.ConeSource(Resolution=32)



	#Transformation Filter
	transformedCone = servermanager.filters.TransformFilter(Input=coneSource)

	#--> define some transformation Operations like translation, rotation or scaling
        #


	view = servermanager.CreateRenderView()
	rep = servermanager.CreateRepresentation(transformedCone, view)
	view.StillRender()



Actually I understand that the TransformFilter has the property 'Transform', which
shoud be the right one to assign a translations-, rotation or scaling operation.

>>> transformedCone.ListProperties()
['Input', 'Transform']
>>> transformedCone.GetProperty('Transform')
Property name= Transform value = None

Unfortunately I don't know which kind of value must be assigned to the property 'Transform'.
>From paraview I expect a nine value tuple (three coefficients for every operation). 



I've tried something like :

>>> transformedCone.SetPropertyWithName('translation',[1,0,0])
Traceback (most recent call last):
  File "<stdin>", line 1, in ?
  File "/usr/lib/paraview-3.2/paraview/servermanager.py", line 162, in SetPropertyWithName
    raise exceptions.RuntimeError, "Property %s does not exist. Please check the property name for typos." % pname
RuntimeError: Property translation does not exist. Please check the property name for typos.

or

>>> transformedCone.SetPropertyWithName('Transform',[0,0,0,0,0,0,1,1,1])
Traceback (most recent call last):
  File "<stdin>", line 1, in ?
  File "/usr/lib/paraview-3.2/paraview/servermanager.py", line 163, in SetPropertyWithName
    prop.SetData(arg)
  File "/usr/lib/paraview-3.2/paraview/servermanager.py", line 487, in SetData
    self.SMProperty.AddProxy(value_proxy)
TypeError: function takes exactly 2 arguments (1 given)


Up to now I don't know how to solve this problem because I am unable to detect the correct syntax via help() or dir()...

That's why I post this problem here, hoping anybody knows how to use a TransformFilter via Python->Servermanager 
and is willing to post the right syntax.

Thanks for your help, Tobias.  





More information about the ParaView mailing list