representation of filter not updated

As I mentioned before, I developed web based solution based on paraview-web (from 5.7)

Recently I try to upgrade paraview bins from 5.7 to 5.10 (5.8 or 5.9 or 5.10)
However ClipClosedSurface dose not operate properly when I changed back module(pvpython) to 5.10.

We create clipclosedsurface first and then make ImplicitPlaneWidgetRepresentaion.

    newProxy_g = simple.servermanager.filters.ClipClosedSurface(Input=parentProxy)
    print(dir(newProxy_g))
    rep = simple.servermanager.CreateRepresentation(newProxy_g, activeView)
    pm.RegisterProxy("sources", "clip", newProxy_g)
    pm.RegisterProxy("representations", "cliprep", rep)

Just after create Filter, change origin of clippingplane property works.
I can see clip origin changed.

However when I change widget and event fired, It dose not work even I changed Origin of clipping plane.
(I tryed lots of things but no one works)
def test(a,b):
# global newProxy_g
print(‘testt’)

            # simple.clearAll()

            pm=servermanager.ProxyManager()
            p = pm.GetProxy("sources", "clip")
            # view = pm.GetProxy("views", "RenderView2")
            # simple.SetActiveView(view)
            r = pm.GetProxy("representations", "cliprep")

            plane = simple.servermanager.CreateProxy("implicit_functions", 'Plane', None)
            print(plane)
            print(dir(plane))
            print(type(plane))

            p.GetProperty('ClippingPlane').SetData(plane)
            p.UpdatePipeline()
            p.UpdatePipelineInformation()
            p.UpdateVTKObjects()


            # proxy = pm.GetProxy("sources", "ClipClosed")
            # p.ClippingPlane.GetProperty('Origin').SetData([1590,800,-1400])
            # p.ClippingPlane.UpdateProperty('Origin')
            # p.UpdateProperty('ClippingPlane')
            # # p.ClippingPlane.GetProperty('Origin').UpdatePipeline()
            # # p.ClippingPlane.GetProperty('Origin').UpdatePipelineInformation()
            # p.UpdatePipeline()
            # p.UpdatePipelineInformation()

However It’s totally OK when I changed paraview backend to 5.7 version.

Is there any clue…
I am almost crazy on this issue…

Thanks in advance…

I do remember some API change on the widget side. How did you bound the widget to the filter? That is probably where you should look at.

HTH

During I follow the issue,
I notice that wierd thing.

servemanager.py (paraview 5.10)

def CreateRepresentation(aProxy, view, **extraArgs):
“”"Creates a representation for the proxy and adds it to the render
module.

This method can also be used to initialize properties by passing
keyword arguments where the key is the name of the property.In addition
registrationGroup and registrationName (optional) can be specified (as
keyword arguments) to automatically register the proxy with the proxy
manager.

This method tries to create the best possible representation for the given
proxy in the given view. Additionally, the user can specify proxyName
(optional) to create a representation of a particular type."""

global rendering
if not aProxy:
    raise RuntimeError ("proxy argument cannot be None.")
if not view:
    raise RuntimeError ("view argument cannot be None.")
if "proxyName" in extraArgs:
  display = CreateProxy("representations", extraArgs['proxyName'], None)
  del extraArgs['proxyName']
else:
  display = view.SMProxy.CreateDefaultRepresentation(aProxy.SMProxy, 0)
  if display:
    display.UnRegister(None)
if not display:
    return None
proxy = _getPyProxy(display)
proxy.Input = aProxy
for param in extraArgs.items():
    setattr(proxy, items[0], items[1])
proxy.UpdateVTKObjects()
view.Representations.append(proxy)
return proxy

From above source, items variables are not defined but used.
Is it correct?

for param in extraArgs.items():
setattr(proxy, items[0], items[1])

I will follow issue continuously.

I think representation from clipclosedsurface filter dose not know it should be updated (because origin property of clippingPlane in clipclosedsurface filter updated)

newProxy_g = simple.servermanager.filters.ClipClosedSurface(Input=parentProxy)
pm.RegisterProxy("sources", "ClipClosed", newProxy_g)
rep = simple.GetRepresentation(newProxy_g, simple.GetActiveView())
newProxy_g.ClippingPlane.GetProperty('Origin').SetData([1670,800,-1400])
# newProxy_g.MarkModified(newProxy_g.ClippingPlane)

proxy = simple.servermanager.CreateProxy("representations", 'ImplicitPlaneWidgetRepresentation', None)
pythonWrap = simple.servermanager.rendering.findClass(proxy)()
pythonWrap.GetProperty('WidgetBounds').SetElements(initialValues['bounds']);
  
simple.GetActiveView().Representations.append(pythonWrap)

class IPWCallback:
    def __init__(self):
        pass

    def __call__(self, caller, ev):
        rep.Input.ClippingPlane.SetPropertyWithName('Origin', pythonWrap.GetProperty('Origin'))

my_callback = IPWCallback()
pythonWrap.AddObserver(vtkCommand.InteractionEvent, my_callback)

these are my codes.

Firstly when I make clip fillter and set origin, It works.
But When I set origin by dragging widget, I dose not work.

I can see origin of ClippingPlane Property in filter is changed after I dragged widget.
However, Only the REPRESENTATION!! of clip filter dose not chnage.
(VIsibility ON/OFF do work.)

I think algorithm? reuqestdata? dose not being called when I change origin of clipping-plane in filter…

Maybe related to this changing?

https://kitware.github.io/paraview-docs/v5.8.0/cxx/MajorAPIChanges.html

… Thank you…

Because you are using the C++ API for setting properties, you do need to call UpdateVTKObject() or something like that to commit those changes to the actual VTK class. And from that point of view it looks like a fix rather than a bug in the newer releases.

Further investigation would be needed to really help. If you want, you can reach out to Kitware for support.

Good luck

Anyway, I really appreciate for your help Jourdain.
I will see deep inside what cause this issue.
Thank you.

1 Like

Finally I found the reason.

Struggle with it for 3 weeks but the only thing I have to do was commnet a line.

renderView.UseCache = 1

I am not sure how this cache option works.
However, Changing clip origin dose not work when I use that option above version of paraview 5.7

With paraview 5.7, It works.

This may be not a big deal… but I hope this info would help poor someone like me.

Thanks.

1 Like