I need to store/restore the values of the Settings panel. How can I do that?
I used the following but it was not successful.
In my scenario, I changed Ghost hidden objects
and Display Unit
, then:
let current_profile = NOP_VIEWER.profileManager.getProfileOrDefault();
let profile = new Autodesk.Viewing.Profile(current_profile);
After that, I changed Ghost hidden objects and Display Unit to some others again, then:
NOP_VIEWER.setProfile(profile);
The solution is using viewer.getState()
:
Storeing settings:
let current_state = NOP_VIEWER.getState();
let render_options = current_state.renderOptions;
Restore Settings:
let state = {renderOptions: render_options}
NOP_VIEWER.restoreState(state);
More Info: https://autodeskviewer.com/viewers/latest/docs/tutorial-viewer_state.html
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.