How to execute a command on a filter? vtkSMPropertyHelper does not help(

Hello dear paraview developers!

How to force an execution of a command on my filter?

vtkSMPropertyHelper does not seem to be appropriate for that.

Thank u!

You need to create a property with just a command, like this:

Here is an example how to use it:

//-----------------------------------------------------------------------------
void pqCommandPropertyWidget::buttonClicked()
{
  vtkSMProxy* smproxy = this->proxy();
  vtkSMProperty* smproperty = this->property();
  if (smproperty != nullptr && smproxy != nullptr)
  {
    const char* pname = smproxy->GetPropertyName(smproperty);
    if (pname)
    {   
      smproxy->InvokeCommand(pname);

      // Update pipeline information, if possible, otherwise, simple update
      // information properties.
      vtkSMSourceProxy* source = vtkSMSourceProxy::SafeDownCast(smproxy);
      if (source)
      {   
        source->UpdatePipelineInformation();
      }   
      else
      {   
        smproxy->UpdatePropertyInformation();
      }   
    }   
  }
}
1 Like

I dont get it, could you explain it please?
Where is property created here?

The property is coming from a XML file, as all properties are.

The call that trigger the command server side is smproxy->InvokeCommand(pname);

But what if I need to execute a command which is not a part of XML file?
( but is present in ClientServer wrapping )

Then this is a RMI call, it is much more complex, Iā€™d suggest not to do it but to rely on a XML property instead (which basically handle all the complex stuff for you).