Zoom To Fit? (Embedded SD)

I’m using the ShapeDiver Web UI to embed a model on a web page.
I would like the model to show up as large as possible when it is loaded.

Can someone show me how to zoom to fit the model within the current window?

Thanks

You just call api.scene.camera.zoomAsync(); to zoom to the extends. You can do it as a callback after updating a parameter like so:

api.parameters.updateAsync({name: "Couch Length (cm)", value: 210}).then(
  function(result){
    api.scene.camera.zoomAsync();
  }
);

It’s taken from the example here: https://support.shapediver.com/hc/en-us/articles/360014884512-First-steps-with-the-API

Unfortunately its still super hard to find out about specific things the API can do. Everything is spread around in different articles and across 2 different documentations. I really wish they had many more smaller examples for everything.

1 Like

Thank you. That is just what I needed.