Hi,
I would like to develop a plugin based on VTKPythonAlgorithmBase.
This plugin take as input a vtkDataset and 3 coordinates representing the position of a camera.
With the following code, I’ve managed to expose these 3 coordinates in Paraview’s properties panel:
@smproperty.doublevector(name="Camera", default_values=[1, 1, 1], label="Camera")
@smdomain.doublerange()
def Set1_Camera(self, x, y, z):
value = np.r_[x, y, z]
if not np.allclose(self._camera, value) :
self._camera = value
self.Modified()
I also succeed in adding a button which prints the position of the camera in the output window:
@smproperty.xml('''<Property name="Print Camera Position" command="CameraButton" panel_widget="command_button"></Property>''')
def CameraButton(self, *args):
import paraview.simple
camera = paraview.simple.GetActiveCamera()
print('Camera position : ', camera.GetPosition())
Instead of printing the camera position in the output window, I would like to fill the properties panel with these values.
How can I access to theses properties from the CameraButton function ?
Thanks for your help,
Regards,
Loic