Shapediver AR - API V3

Hi!

I’m starting the migration from API V2 to V3. I have read the documentation and I cant access this examples: Viewers - The “simple example”. Can you help me, please?

And…

We already have the V2 API fully working. Example: Estante movêu

To implement the V3 API do we have to do all the calling methods again to get the parameters, change the way each element is changed, etc? Is this really the way?

In V2, we use the “api.scene.getData()” method to get the OUTPUTS sent by the model. How can we use this method in this new version? Is it by “window.sdv.api.sessions.mySession.outputs”?

Thanks :slight_smile:

1 Like

The link to the simple example is fixed in the documentation, let me know if you can see it.

About the viewer 3, it is not backwards compatible with the viewer 2 API, so you will indeed need to update your code to make it work with it. The new API should make things easier, and the documentation contains an example comparing the same code in viewer 2 and 3 to get started.

Regarding the outputs: there is no easy way to do this call at the moment, thanks for pointing it out. We are working on adding some helper functions that will make the data output values more accessible.

Hi @mathieu1.

Where can we find this? I looked through the documentation and couldn’t find it.

Also, is there any update to the backend API? Is there some updated/actual documentation for it now?

You can check this page in the new documentation: Migration Guide

It is a work in progress but already contains some hints for migrating to viewer 3.

We will update the backend API documentation soon as well.

1 Like

Hi Mathieu!
Thanks for the reply. Understood!

About the outputs, is there an example of how I can get them currently, or do you recommend that we wait? Because, in the current version, we use them to calculate the price…

Thanks!

If you have a data output called “Price” in your definition, you will be able to read the contents of this output by calling

SDV.api.sessions.mySession.getOutputByName("Price")

This function will give you back an array with only one element if you only have one output called “Price”. Within this object, you will find a content array that contains the value of the output. Again, the content is an array that will only have one element if you only send a single number to it (the price). So in your case, the call would look something like this:

SDV.api.sessions.mySession.getOutputByName("Price")[0].content[0].data

Make sure to update to the latest viewer version (1.8.3 as of today), as there are some breaking changes.

@seltzdesign the new help page does not yet include a section about using the geometry backend without the viewer, but this section is going to be there soon. However you can already find the core information about it here: @shapediver/sdk.geometry-api-sdk-v2 - npm

Thank you, Mathieu!
Everything went well to implement this!

We implement the V3 API on this page:
https://moveismoveu.com/meus-designs/estante-2021-11-23-06-44-23/

The augmented reality isn’t loading… from what I could debug it gives an error as if the object had some problem. Can you help us with what we need to check? The method I’m using is:

window.SDV.api.viewableInAR();

Thanks!

I have communicated the issue to the team and will get back to you when we have investigated it. As a follow up question, did you check that the AR view works when you use it directly on the new shapediver beta platform (shapediver.com/app)?

Hey Mathieu! Thanks for replying.

On the beta platform it’s not working too. The error is the same as the site… it keeps rendering and doesn’t finish.

What can we do to solve it? Is it something that needs to be changed in the model?

Thanks

Can you give me the link of the model on the platform so that our developers can look into the issue there?

Yes of course!
Here’s the link: ShapeDiver

Hey Mathieu, do you need anything else from us to see this item?
Thanks!

We have identified several issues and our developer have already fixed some. The last remaining issue concerns the text tags, which seem to cause an issue when exporting the scene to AR. We are still investigating this issue and expect to fix it this week. I will get back to you when we make progress.

Thank you so much for letting me know Mathieu!

I’ll wait when it’s finished! Thanks!

1 Like

@mariana.camargo We have fixed all found issues on our side for your case in the latest version of viewer 3 (1.813)

However, there is still an issue regarding the 3d text tags that is on the side of the android quick look feature. Therefore if you want to already test AR with your model, you would need to create a version without the text tags. You could add a toggle to the grasshopper file and using the API, you can switch off the tags and then call the AR function of the API. Let me know if you have issues with such a version using the latest version of our viewer.