VTK API: Working with values inside the python shell
Dear all,
I have some problems with the VTK API. The problem is a value which I have calculated before in a python script. I want now to import and to work with it inside the python shell. That is what I have done so far: s_kero = 3.4 #dummy value, normally calculated in a python script Calculator2 = Calculator() Calculator2.AttributeMode = 'cell_data' Calculator2.Function = 'a*s_kero' # a: value from the CFD simulation Calculator2.ResultArrayName = 's_kerosene' Of course this is not working.... Does anyone have a suggestion? Thanks for your help. |
Greetings Thomas,
I'm not sure I understand the problem. Assuming you're using ParaView, the code seems to work, at least up to a point. On ParaView 3.14.1, these following commands worked for me: Code:
from paraview.simple import * Bruno |
Hey Bruno,
thank you very much for your response. Yes, I am working with paraview. I need to do some modifications on the results stored in a vtk-file. Because I want to display these results later in Paraview, I am working with the calculator. The problem is, that my value, s_kero (your 2), is a value, that comes from a complex python script. It is computed for every cell and the numbers are changing depending on the input values. I do not want to translate the entire phyton script with calculators in paraview. It would be too much work... I hope to find a way to create an interface between the value from pyhton and paraview. So I have the calculator function: Calculator2.Function = 'p*s_kero' where s_kero is a value, calculated for every cell and corresponds every time to a different number. Regards, Thomas |
Hi Thomas,
Sorry about that, it was late and I was tired. Right now it also took some time to finally understand the problem. But still, there are (at least) two possibilities, because I'm not 100% certain of what you need. So:
Bruno |
Hey Bruno.
Thank you very much!! Actually I can use both of your suggestions!! |
All times are GMT -4. The time now is 04:38. |