Paraview Lite change default representation

I have just tried with Linux with no luck

I think I know why… You’ve loaded a file, not created a source. I did not patch the file loading… Just any proxy creation.

Try to create a “Cone”.

If you want to do it at file loading, that will be the method to override as well https://github.com/Kitware/ParaView/blob/master/Web/Python/paraview/web/protocols.py#L2808-L2809

Hi Sebastien,

We are hitting the right key now.

I got a trace in this overloaded pv.proxy.manager.create.reader

however I got an error when trying to call the original code:

@exportRpc(“pv.proxy.manager.create.reader”)

def customOpen(self, relativePath):

    """

    Open relative file paths, attempting to use the file extension to select

    from the configured readers.

    """

    print('custom open')

    response = self.pxm.reader(relativePath)
    #response = self.pxm.create.reader(relativePath)

    rep = simple.Show()

    rep.Representation = 'Surface With Edges'

    self.getApplication().InvokeEvent('UpdateEvent')

    return response

both attemps fail with:

ParaView Lite: not available
Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/88.0.4324.146 Safari/537.36

{
  "code": -32001,
  "message": "Exception raised",
  "data": {
    "method": "pv.proxy.manager.create.reader",
    "exception": "AttributeError(\"'ParaViewWebProxyManager' object has no attribute 'reader'\")",
    "trace": "Traceback (most recent call last):\n  File \"C:\\ParaView-5.8.1-Windows-Python3.7-msvc2015-64bit\\bin\\Lib\\site-packages\\wslink\\websocket.py\", line 370, in onMessage\n    results = func(obj, *args, **kwargs)\n  File \"C:\\projects_web\\evoker\\client\\server\\lite_protocols.py\", line 69, in customOpen\n    response = self.pxm.reader(relativePath)\nAttributeError: 'ParaViewWebProxyManager' object has no attribute 'reader'\n"
  }
}

How do I properly call the original code?

Thanks,

Francesc

The method name is open so you should use that name.

response = self.pxm.open(relativePath)

It was given to you in my previous link

1 Like

Works like a charm!!!

Thank you Sebastien!

image

1 Like