Unable to get sha value from vtkSynchronizableRenderWindow setFetchArrayFunction

Hi,

I am trying to run vtk.js RemoteViewLocalRendering using angular 12.

Below is my code block.

const synchCtx = vtkSynchronizableRenderWindow.getSynchronizerContext();
synchCtx.setFetchArrayFunction((sha: any) => {
      console.log("setFetchArrayFunction SHA :: ", sha);
      //this.session.call('viewport.geometry.array.get', [sha, true]);
      return Promise.resolve(sha);
});

The console log inside the setFetchArrayFunction is not logged on browser console.

Can anyone help me to get the sha / hash value from this synch context.

For server support i am running below file from py-web-vue.

examples/VTK/ContourGeometry/RemoteViewLocalRendering/app.py

Did you provide a scene description? Without a scene, you will not have requests for the any binary arrays that compose your mesh(s).

Hi @Sebastien_Jourdain , Thank you for replying back.
Can you please give one example how can i provide a scene description.

You can either use that example directly otherwise, you will have to look into the code server and client.

Hi @Sebastien_Jourdain,
I tried the example links you have shared. But still unable to get the array fetcher from

setFetchArrayFunction

Can you help me out here, how can i get this done.
For server connect i am using this file examples/VTK/ContourGeometry/RemoteViewLocalRendering/app.py

Client side code:

vtkWSLinkClient.setSmartConnectClass(SmartConnect);
this.clientToConnect = vtkWSLinkClient.newInstance();

// Handles Error event of smart connect
this.clientToConnect.onConnectionError((httpReq: any) => {
  console.log("connection error");
  const message = (httpReq && httpReq.response && httpReq.response.error) || `Connection error`;
  console.error(message);
  console.log(httpReq);
});

// Handles connection close event of smart connect
this.clientToConnect.onConnectionClose((httpReq: any) => {
  console.log("connection close");
  const message = (httpReq && httpReq.response && httpReq.response.error) || `Connection close`;
  console.error(message);
  console.log(httpReq);
});

// hint: if you use the launcher.py and ws-proxy just leave out sessionURL
// (it will be provided by the launcher)
const config = {
  application: 'cone',
  sessionURL: 'ws://localhost:8080/ws',
};

// Connect to Server
this.clientToConnect
  .connect(config)
  .then((validClient: any) => {
    this.session = validClient.getConnection().getSession();//get the connection session with callback from server
    console.log('this.session', this.session)
  })
  .catch((error: any) => {
    console.error(error);
  });
this.synchCtx = vtkSynchronizableRenderWindow.getSynchronizerContext(this.contextName);
    console.log("synchCtx ", this.synchCtx);

    this.synchCtx.setFetchArrayFunction((hash: any) => {
      console.log("setFetchArrayFunction ", hash);
      this.session.call('viewport.geometry.array.get', [hash, true]);
      // return Promise.resolve(hash);
    });
    
    this.renderWindow = vtkSynchronizableRenderWindow.newInstance({
      synchronizerContext: this.synchCtx,
      viewId: "1",
    });

    let container = document.createElement('div')
	  let rootContainer = this.document.getElementsByClassName('view-container-large');
    rootContainer[0].appendChild(container);

    // OpenGlRenderWindow
    this.openglRenderWindow = vtkOpenGLRenderWindow.newInstance({
      pointType: 'default'
    });
    this.openglRenderWindow.setContainer(container);
    this.renderWindow.addView(this.openglRenderWindow);

    this.interactor = vtkRenderWindowInteractor.newInstance();
    this.interactor.setView(this.openglRenderWindow);
    this.interactor.initialize();

    // this.renderWindow.synchronize(state);
    this.renderWindow.render();

type or paste code here

It is both the server+client. That’s why you can see how it was done by looking at the code.
But if you need more help, you can reach out to kitware for some paid support so we can provide a tailored solution to your needs.