I’d like to initialise the ShapeDiver Viewer and during mount apply a set of parameters.
A couple of issues: when applying them, this could result in a white screen.
code:
Object.keys(applyParameters).forEach(async key => {
await api.current.parameters
.updateAsync({name: key, value: applyParameters[key]})
…and then:
await api.current.plugins.refreshPluginAsync(“CommPlugin_1”)
// finally show the scene
await api.current.updateSettingAsync(“scene.show”, true)
I do get it to work, by applying the parameters afterwards, with a timeout.
code:
setTimeout(() => {
Object.keys(applyParameters).forEach(async key => {
await api.current.parameters
.updateAsync({name: key, value: applyParameters[key]})
.then((data) => console.log(data))
})}, 500)
But then, you first get the model rendered without the parameters applied, and that’s a shame.
Any suggestions?
Next point: I don’t seem to be able to apply multiple parameter values at once, as an array (it is stated in the documentation though: Requesting parameter updates – ShapeDiver - Documentation and Support).
code:
api.parameters.updateAsync([{name: “Length”, value: 100}, {name: “Width”, value: 50}]);