Back to the Shapespark home page

Get names of predefined views

Hi!

Is it possible to query for a list of defined views through the API?

I’ve added some hidden views that I would like to present and trigger programmatically. Would be very nice (and less error prone) if it was possible to query the API instead of copying the names manually from the editor.

The public viewer API doesn’t include and document the internal scene representation object because it is too low level and changes too often to be exposed, but for such a simple task you could use it:

<script>
WALK.getViewer().onSceneReadyToDisplay(function(scene) {
 for (var view of scene.views) {
   console.log(view.name);
 }
})
</script>
1 Like