V3 iFrame API reflector?

I’m trying to access the API through my V3 iFrame and having trouble.

This article is really helpful for doing so with the V2 iFrame:

But I’m unable to find supporting documentation regarding how I may interact with the V3 iFrame through the API. Ideally, I could get the API object from outside of the iframe. For example, saving to the window object seems to have been doable with V2. Does the API reflector exist anymore?

Also, I noticed a dead link on the page under “API differences when embedding an iframe”. I’m not sure if this link would have been helpful.

On the other hand, if this is not the case, then is the typescript library my best shot?

Thanks so much for your time. Maintaining technical forums is tough work.

The viewer API feature is now only available through direct embedding of your ShapeDiver models, and not through the iframe anymore. The iframe version of the API had many limitations in the first place. You can check the difference between iframe embedding and direct embedding on the pricing page.

1 Like

@mathieu1

Does this mean that -when using the iFrame- it is not possible to use any API functionality at all?

In my use case, I will need to save/set parameters state as described here:

Plus, I will need to extract some values using direct data output, in order to display them in the html or for price calculations.

I would like to achieve this without having to design my own parameter interface, which is some extra work I do not need nor want at this stage.

Can you confirm if it is possible to directly embed the viewer, while still using the default parameter interface? I just quickly went through the viewer documentation and some of the sandbox example, but I could not find an answer.

Cheers
Matteo

You are correct that it is not possible to use any functionality at all through iframe embedding. It is also not possible at the moment to directly embed models and get the same UI as in the iframe. The reason for this is that the dependency for all UI elements is nested in the new ShapeDiver platform and it would be overblown to include all these dependencies for embedding a single ShapeDiver model.

We have produced a code example with a simple UI that you could use as is or customize a little using some basic CSS: UI example - CodeSandbox

OK @mathieu1 can you confirm that:

  • V2 Viewer will remain available for the time being

  • V2 Viewer will remain on the original UI with a simple flat list of parameters

  • The save/load model parameters code I developed ~2 years ago and linked to above will remain useable in the V2 viewer with original UI?

AND

  • The iFrame V3 Viewer has no option to access the model parameters/save/reload like I did with the V2 iFrame

  • To achieve a parameter save/reload option with the V3 viewer would require direct embedding of the viewer and a custom made UI?

Could I perhaps propose a ShapeDiver push forward with a project that will allow local save and reload of parameters?

How I would imagine this looking from a GH/SD developer point of view is there would be two new SD components SAVE SD PARAMETERS and LOAD SD PARAMETERS

These would add extra buttons under the EXPORTS tab in the iFrame:

On the back end I would imagine the complete list of parameters being bundled into a JSON object and sent to the user as a txt file.

As a developer I would just like the ability to add my own file extension rather than .txt.

Upload would work in a similar manner - click on the LOAD SD PARAMETERS, select the local JSON/txt file and have the model change to the save state.

Is this something ShapeDiver can consider?

Thanks

DK

1 Like

@mathieu1 Thanks for the detailed answer.

Is there any future plan to include API functionality in the iFrame V3?

Considering the amazing work you did on the the new iFrame, it does not makes much sense having to re-invent the wheel just to get a few data out of the model, or save/load parameters.

From a user perspective, this solution would also serve my application perfectly.

1 Like

There is no plan to allow API access from the iframe in the future, for technical and product-related reasons. We will add a functionality close to was @kiteboardshaper suggested related to saving/loading parameters. We will also add an output explorer that allows to display the value contained in data outputs.

1 Like

Hi @mathieu1 , is there any progress with these functionalities? (save/load parameters and output explorer)

Could you share a generic time frame? Like 1 month, 6 months, 1 year?

Thank you!

Matteo

1 Like

We are getting close to a solution regarding displaying the value of data outputs and even stored attributes in various parts of the model. This will happen over the summer.

I cannot give a schedule regarding the save/load parameters feature as it has been discusse in this topic but I can confidently say that some version of it will be implemented before the end of this year.

1 Like

Thank you @mathieu1 , that is great news.

Besides of extracting value of data outputs, I think it would be equally useful to be able to send data input to the iFrame (json format). Would that be possible?

You can send json objects to the iframe by using the “Import Text” component (upload a .json file) or the “Direct Text Input” component (enter a json string directly into one of the inputs). There will not be a way to programmatically send json inputs to the iframe, this is a viewer API feature.