Assistance Required with Loading Entire Models in Speckle Viewer for Vue Application


I am currently trying to integrate the Speckle viewer into a Vue.js application and have been following the official documentation for guidance. My process so far includes:

  1. Setting up a new instance of the viewer:
    const speckleViewer = new Viewer(container, DefaultViewerParams);

  2. Initializing the viewer instance:
    await speckleViewer.init();

However, I am encountering an issue when attempting to load an entire model from a specific stream. The API seems to offer only a method to load single objects:
speckleViewer.loadObject(url, token);

In this function, the URL format appears to be:
This format includes the stream ID, followed by a route to “objects” and then the ID of the particular model object. I have experimented with various approaches, such as providing only the stream URL to this function, but these attempts were unsuccessful.

Moreover, the documentation suggests using the stream URL directly, which seems to be a misprint :

To summarize, my main question is: How can I load all objects from a stream using the Speckle viewer in a Vue application?

Thank you for your assistance.

if you want to load the whole stream, you should use the root object ID.
It will be:${streamId}/objects/${rootObjectId}

You can grab the root object ID from the top level of the data view.


Thank you so much. It works now.

1 Like

Hi @Nikita_Sneg

Indeed, like @DanielSBoba suggested the loadObject method expects an object URL and the documentation does not clearly specify that. Good catch!

I also want to mention that in case you need to get the URL of the commit base object from a commit URL, there is the URLHelper we use for the viewer sandbox for the same purposes

Additionally I would strongly suggest you use the viewer API 2.0 which is publicly available here under the viewer-next tag. The old viewer API will soon be deprecated and ultimately retired. API 2.0 does not yet have an official development guide, since it’ still pre-release, but there is a quick reference available and if you ever get stuck we’re always happy to help you here on the forum!


1 Like

Thank you for the information. The API 2.0 does seem to offer significant improvements; however, I’ve noticed it lacks comprehensive documentation and examples, which are essential for effective implementation. I look forward to these resources being made available in the near future.

Thanks for the feedback @Nikita_Sneg

Viewer api 2 is under heavy development and documentation for a dynamic project can be a challenge to produce and maintain. We consider documentation to be part of the definition of done, so we will be working on supporting your needs as the project moves towards completion