VTKPythonAlgorithmBase object in Python shell

I created a VTKPythonAlgorithmBase source for ParaView. Within the constructor the return object _mp of createMachine() is stored as attribute.

@smproxy.source( name="dtOOReaderName", label="dtOOReaderLabel" )
class dtOOReader(VTKPythonAlgorithmBase):
  def __init__(self):
    VTKPythonAlgorithmBase.__init__(self,
      nInputPorts=0,
      nOutputPorts=1,
      outputType='vtkPolyData'
    )
    self.mp_ = createMachine()
    [...]

Is there any way to get a reference to my source class within the Python shell of ParaView? I would like to have access to my attribute mp_ within the shell. I already figured out that I can access the sources like this:

>>> from paraview.simple import *
>>> type(GetSources()[('dtOOReaderLabel1', '9414')])
<class 'paraview.servermanager.dtOOReaderLabel'>

But this object is not my original one. I guess this is kind of a proxy.

Thanks in advance.
Alex

Indeed, ParaView do not manipulate the algorithm classes directly but only proxies.

The correct way is to create some property to access the information you want. Some documentation here: 5. Programmable Filter — ParaView Documentation 5.11.0 documentation

Hi Nicolas,

thank you very much for the answer. What a pity that it does not work.

The correct way is to create some property to access the information you want.

To be sure that I understand you correct: You do not mean that I should store id(self) (the id of my object) within a property and access it?

For me as a temporary workaround, I can access the original class by a static class attribute:

class dtOOReader(VTKPythonAlgorithmBase):
  SELF = None
  def __init__(self):
    [...]
    dtOOReader.SELF = self
    [...]

I know this is a “crowbar solution”.

Thanks,
Alex