Is there a possibility to change an existing model from server-side?

Hi there,

Even though I’m not really confident, that I will get an answer here anytime soon, I still want to give the forum a try.
I am trying to create a web-application which uses the Hoops library to create an own instance of the Streaming Cache Server.

The model that’s used is created from scratch using the Hoops Authoring library link://docs.techsoft3d.com/communicator/latest/build/prog_guide/data_import/authoring/data-import-stream-cache-models.html.

It works all well for now, but we are using a simulation software in the background, that’s changing how the model should look like, after the initial creation.

So my question is now, is there a way to tell the Streaming Cache Server, that the model has changed, after it was first uploaded to the Hoops Webviewer in the browser?

My workaround for now is to create a new model everytime something changes and then use the switchToModel link://docs.techsoft3d.com/communicator/latest/build/api_ref/typedoc/classes/communicator.model.html#switchtomodel method to see the changes.

But that has major downsides: I have to periodically request the server if there is a new model available (using my own webserver endpoint, because I didn’t find any Hoops method that can check this), the camera gets reset everytime and the Webviewer has to fetch all the data again.

I get the impression, that changing the model after it was once created is simply not the desired use-case for hoops. Is this correct, or am I missing some functionality?

Best regards

Laurenz

BTW: Why do you forbid to add links to your own documentation resources? That doesn’t make any sense.

Hi Laurenz,

thanks for asking to the Community. I confirm you that the editing workflow is not something yet available with HOOPS Webplatform. You are doing the right thing with generating a new model and using switchToModel functionality.

In addition, it should be possible to limit the problems you encounter by interrogating the scene status to get the camera, and to apply the camera back once you load the new model.

Another way to do this is also to use the method:

  1. load an empty scene at the beginning
  2. use https://docs.techsoft3d.com/communicator/latest/build/api_ref/typedoc/classes/communicator.model.html#loadsubtreefrommodel to load your model
  3. when replacing, delete the previous model (https://docs.techsoft3d.com/communicator/latest/build/api_ref/typedoc/classes/communicator.model.html#deletenode) and go back to step 2.

In order to detect the change, this is something that needs to be performed following your business logic. If you want the user to get notified as soon as possible, I would recommend you to open a websocket so your server can send information to the client as there is no function to do that within our infrastructure currently.

As for the links to our documentation, I am not aware of this limitation and am trying to add some links in my answer there to test, I will feed thick back to our team managing the forum.

Have a good day,

1 Like

Hi Florian,
Thank you very much for your fast and very complete answer.
This helps me very much i think :slight_smile:
Best wishes
Laurenz

1 Like

I tried to implement your proposed solution with the “loadsubtreefrommodel” method.
But I always get this error when i call it on an empty scene: Uncaught (in promise) Error: Incompatible load types.
When i try to load the model on a scene which already has a loaded model (using the model property in the Webviewer constructor) this error does not happen.
What could be the reason for this?

Additionally, when I call the deleteNode function it actually deletes the nodes from the assebly tree (checked that with getNodeChildren) but it does not delete the nodes from the actual viewer? Do I have to call another function to trigger that?

Okay nevermind, i fixed it by specifying " model: Communicator.EmptyModelName" in the Webviewer constructor.
Hoops is a great piece of software, but finding the right information can be very tricky :wink:

1 Like

Hi Laurenz,

Sorry for my incomplete explanation, it seems the empty: true implies using SCS.

In order to start with an empty scene using streaming you can generate a webviewer using these parameters:

viewer = new Communicator.WebViewer({

containerId: “container”,

endpointUri: endpoint,

model: “_empty”,

rendererType: Communicator.RendererType.Client // exercise: specify client or server

});

viewer.start();

Hopefully with this you should be able to move forward and give it a try,

2 Likes

Return to techsoft3d.com