I’m playing with some concept of rendering some geometries on an PWA we are building, but offline, Since we are building most of this integration with Speckle it would be quite useful for us to just recycle the same script.
My idea is using the Viewer for js/ts, I’m trying to pass an object that looks like this (It’s a serialized object from grasshopper):
what I’m still really failing at is finding a way to load this into the viewer itself. None of the loaders that comes on the package work and I’m struggling a bit with the docs (or previous comments here).
Currently there is no standardized way of loading offline speckle data within the viewer. However, the viewer does have a flexible loader system, so you can implement it yourself. As a matter of fact, I’ve already made a live example with such implementation. While writing it I realize the viewer unnecessarily hides some types and variables that might prove useful in a use case such as yours so I’ll make sure they get exposed in the next viewer update
It’s important to note that, the example I’ve provided above works only in cases where you have relatively simple disjointed and complete speckle objects. Speckle data inside an entire speckle stream can get more complicated with instancing, detached objects, data chunks, proxies, etc. That’s why the viewer library uses the object-loader to do most of the heavy lifting when it comes to interpreting and navigating speckle data.
I’m sorry to hear you are struggling with the docs. We would love to hear what would make that experience better for you.
Hi @Nikos and @alex thank you soooo much!
Alex’s solution was very very very close to what I was thinking! It was the SpeckleJSON loader that I didn’t fully get.
It’s pretty much working now! Thanks a ton! I did a whole implementation for React using Typescript. Let me know if would be useful for you to publish a gist with it.
As for the docs my biggest issue at the moment is that I feel like all the docs are a bit fragmented and I hit too many dead ends (from pages in WIP to broken links). I had a brief chat about this with @Matteo during the meetup in Amsterdam and we have some ideas on how to help with this.
Thanks a lot people! It’s wild how fast one can build things with you!