Hey guys,
I have an issue where any time I try to use the Visibility_On scene event type I get an error message that either api or SDVapp is undefined. I wanted to see if anyone else has encountered a similar issue. I’ve spent time in the documentation, forum, and code pen and have come across a couple of instances of the code below. It seems pretty straightforward, but results in the error mentioned earlier. I can type in api.scene.camera.zoomAsync(); into the command bar and have the viewer zoom to the model extents which makes me think it isn’t an issue with the code from the direct embedded - minimal code.
api.scene.addEventListener(api.scene.EVENTTYPE.VISIBILITY_ON, function() {
// now it's safe to read the model parameters
var data = api.scene.getData();
});
The ultimate goal is to wait until the scene has finished processing before zooming to its full extents and reading data from the model. My current simplified working code is:
api.scene.addEventListener(api.scene.EVENTTYPE.VISIBILITY_ON, function() {
// now it's safe to read the model parameters
api.scene.camera.zoomAsync();
var GirderWidth = api.scene.getData({name:"GirderDimensionsManuel"}).data[0].data;
});
I can put each of these commands in the command line individually and get the desired result, I just can’t get it to work after the scene becomes visible.
That’s a lot of text for a simple problem, but I appreciate any help anyone can provide!