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

**URL:** https://discourse.paraview.org/t/how-to-execute-a-command-on-a-filter-vtksmpropertyhelper-does-not-help/14254
**Category:** ParaView Support
**Created:** [March 25, 2024, 8:03am UTC](https://discourse.paraview.org/t/how-to-execute-a-command-on-a-filter-vtksmpropertyhelper-does-not-help/14254 "2024-03-25T08:03:27Z")
**Posts on this page:** 6
**Page:** 1

<div class="post-metadata">

### Author: ![joint](https://discourse.paraview.org/letter_avatar_proxy/v4/letter/j/dc4da7/32.png) [@joint](https://discourse.paraview.org/u/joint)
#### Post date: [March 25, 2024, 8:03am UTC](https://discourse.paraview.org/t/how-to-execute-a-command-on-a-filter-vtksmpropertyhelper-does-not-help/14254/1 "2024-03-25T08:03:27Z")

</div>

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!

---

<div class="post-metadata">

### Author: ![mwestphal](https://discourse.paraview.org/user_avatar/discourse.paraview.org/mwestphal/32/17_2.png) [@mwestphal](https://discourse.paraview.org/u/mwestphal)
#### Post date: [March 25, 2024, 8:25am UTC](https://discourse.paraview.org/t/how-to-execute-a-command-on-a-filter-vtksmpropertyhelper-does-not-help/14254/2 "2024-03-25T08:25:13Z")

</div>

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

Here is an example how to use it:

```auto
//-----------------------------------------------------------------------------
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();
      }   
    }   
  }
}

```

---

<div class="post-metadata">

### Author: ![joint](https://discourse.paraview.org/letter_avatar_proxy/v4/letter/j/dc4da7/32.png) [@joint](https://discourse.paraview.org/u/joint)
#### Post date: [March 25, 2024, 8:46am UTC](https://discourse.paraview.org/t/how-to-execute-a-command-on-a-filter-vtksmpropertyhelper-does-not-help/14254/3 "2024-03-25T08:46:47Z")

</div>

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

---

<div class="post-metadata">

### Author: ![mwestphal](https://discourse.paraview.org/user_avatar/discourse.paraview.org/mwestphal/32/17_2.png) [@mwestphal](https://discourse.paraview.org/u/mwestphal)
#### Post date: [March 25, 2024, 8:48am UTC](https://discourse.paraview.org/t/how-to-execute-a-command-on-a-filter-vtksmpropertyhelper-does-not-help/14254/4 "2024-03-25T08:48:10Z")

</div>

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

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

---

<div class="post-metadata">

### Author: ![joint](https://discourse.paraview.org/letter_avatar_proxy/v4/letter/j/dc4da7/32.png) [@joint](https://discourse.paraview.org/u/joint)
#### Post date: [March 25, 2024, 8:49am UTC](https://discourse.paraview.org/t/how-to-execute-a-command-on-a-filter-vtksmpropertyhelper-does-not-help/14254/5 "2024-03-25T08:49:16Z")

</div>

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

---

<div class="post-metadata">

### Author: ![mwestphal](https://discourse.paraview.org/user_avatar/discourse.paraview.org/mwestphal/32/17_2.png) [@mwestphal](https://discourse.paraview.org/u/mwestphal)
#### Post date: [March 25, 2024, 8:50am UTC](https://discourse.paraview.org/t/how-to-execute-a-command-on-a-filter-vtksmpropertyhelper-does-not-help/14254/6 "2024-03-25T08:50:38Z")

</div>

> [@joint](#):
>
> But what if I need to execute a command which is not a part of XML file?

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).
