Restarting the model

(Bodibodileg) #1

Hi,

is it possible to restart the model without refreshing the site?

0 Likes

(Mathieu Huard) #2

There is no direct functionality to do that at the moment. What is your exact goal?

If you are trying to restore the default parameter values, it can be done easily by looping through the parameters and updating them to the defval value that is stored in their definition:

var parameters = api.parameters.get().data;
var updateArray = [];
for (let i=0; i<parameters.length; i++) {
	let param = parameters[i];
	updateArray.push({id: param.id, value: param.defval});
}

api.parameters.updateAsync(updateArray);

If you are trying to restore the default settings of the scene (camera position, lights, etc…), that is only possible if you manually save them right after loading the model, and then restore them using the settings you stored.

// when the model is loaded
var initialSettings = api.getSettings();
[...]
api.updateSettingsAsync(initialSettings);

Let me know if that helps, and what type of functionality would help if it doesn’t.

0 Likes