Issue with initializing "second-level" settings in shapediver

Hi everyone,

I am trying to initialize the viewer on my page with specific settings. This works fine for ‘top level settings’ but not for settings that are part of an object. Let me make an example:

Intiliazing the settings works fine for me when they are ‘top level settings’. Let me make an example.

  let settings = {
    ticket: 'XXX' //works fine
    container: _container, //works fine
    blurSceneWhenBusy: false, //works fine
    scene:{
      gridVisibility: true //does not work
    },
    'scene.gridVisibility': true //also does not work

  };

  window.api = new SDVApp.ParametricViewer(settings);  //no error is thrown but the gridVisiblity setting is not applied

Basically, I would love to specify a long list of parameters when initializing the model.

Thank you!

David

Your example is not working as expected because the viewer constructor accepts a separate set of constructor settings, as opposed to the settings you can change using api.updateSettingsAsync (changing multiple settings at once) or api.updateSettingAsync (changing single settings).

This is the list of constructor settings available in version 2.17.0 of the ShapeDiver viewer:
https://viewer.shapediver.com/v2/2.17.0/doc/SDVApp.ParametricViewer.html

Please refer to this example which demonstrates how to achieve what you are looking for: https://codepen.io/ShapeDiver/pen/xxxrBxz

Here you can find the complete list of settings available in 2.17.0: https://viewer.shapediver.com/v2/2.17.0/doc/module-ApiInterfaceV2-ApiInterfaceV2.html#updateSettingAsync

1 Like

Thank you!

I was sort of expecting this, but was also unsure where to put the initial api.updateSettingsAsync command. The example and your explanation have cleared up everything though.

Best
David