I’m wondering if it’s possible for a plugin filter using PythonAlgorithms to add a method that can be invoked in a pvbatch script to retrieve some information.
I’m trying to build such a filter, imitating the example PythonAlgorithmExamples.py, but if I add any function in the class derived from VTKPythonAlgorithmBase, it’s not available in a pvbatch script using it.
Moreover I’m trying also to access from the pvbatch script some variables that I’ve assigned to DoubleVector SMProperties but I cannot control when and how those properties are updated (It seems that their value, that I would like to be dependent on other properties settings, cannot be changed by assigning those other properties).
Thank you Mathieu for your answer.
I’m currently using information properties but, using the same example you cited, the question is: suppose that the return values of GetValueRange function that populate ValueRangeInfo property depend on Thickness Property, when Thickness value is modified the function SetThickness is executed, but ValueRangeInfo must be updated, and although I try to call GetValueRange function from SetThickness, the property doesn’t change. Is it possible to force its updating ?
Thanks
The information properties are updated during the request information pass, but I’m not sure to follow what are you trying to do and what is not working exactly.
This adds a “coneTest” source that is a vtkConeSource which radius is changeble with a DoubleVector property that corresponds to a slider in the UI. The height is set in the RequestInformation function as 2x radius. The same height is assigned to an information property.
If I use this plugin in a paraview session and I change the radius value with the slider, at the next “Apply” button pressure, the debug prints tell me that the GetHeight function is called each time updating the “Height” property.
But if I ran the following script with pvbatch and I try to access to the “Height” property, it seems that also after an UpdatePipeline() the Height property value has not been updated though Radius has changed. myScript.py (370 Bytes)
Utkarsh, thank you for your answer. Very helpful as usual!
Is there a way to update properties without a “full” UpdatePipeline call?
I mean: the real intent of this matter is that I’m writing a reader plugin where properties are used to select which parts of a big hdf5 file are to be loaded, and information properties should be used to comunicate to the main script some info about what is contained in that big file. So it would be very useful to set some parameters to choose what is to be read (depending on what it’s available in the file) without performing RequestData phase (that effectively reads the file and creates objects in the pipeline) but only RequestInformation one (possibly more than once), of course calling UpdatePropertyInformation after it.
Probably that could be achieved by adding a further “toggle” parameter to have, on demand, a “dry” execution of RequestData without reading heavy data but only retrieving all the needed information, and doing a real execution (by setting that parameter to false) only at the end. But I was wandering if something easier could be done.
I hope I made myself clear, it’s a quite complicated project to explain.