Verge3d send back data to perspective

Hello
Everyone
I want to know is online here has experience working with verg3d in perspective.
The basic setup is easy with iframe in perspective but what makes it hard I want to send data from Verge3d back to perspective base on user action.
Thanks for any help

We have make some integration with an ignition module and an iframe.
The module expose user JS code in ignition webserver with a dedicated port.

From the JS code you can interact with perspective message handler and exchange realtime data with websocket.
If you are interested I will send you a demo version of the module and an example of JS code for sending receiving ignition data.

2 Likes

Thanks Lionel
Please send me demo module.
I really love to this module for a long time

1 Like

I’d be curious to see this as well, do you have it on GitHub or something?

1 Like

@mazeyrat I second this, if you do share it, I would really appreciate a demo! I tried doing this exact thing, but couldn’t get the websocket identifier (I don’t remember what it was exactly)

1 Like

Here is the module:

and a view example to exchange data with the code executed in the iFrame.

On the provided view:
Start the gateway side with the button ws configure web server

2 examples files for a basic example are created on the gateway in the directory: C:\ProgramFiles\InductiveAutomation\Ignition\data\modules\com.bouyguesenergiesservices.utilsperspective:

  • client.js
  • index.html
    You have to put JS/HTML files and subfolders in this directory

:warning: Disclamer: The purpose of this module is not to create some well packaged/secure component for perspective, but only to exchange “realtime” data with external JS code.

Script package system.byes.utils.perspective.websocket

  • configureWebsocketServer
  • stopWebsocketServer
  • isStarted
  • getPort
  • send
  • reply

Note: other package and script function of this modules are used for other purpose.

5 Likes

@mazeyrat
Edits to the index.html page get overriden on page refresh?

Making new files seems to work though, pretty cool work to load in html/js files.
What is the main diffrence with the webdev module? (i havent really used it but i thoguht it was also possible to load in html pages in there)

the main difference with webdev and the purpose of this module is to be able to interact (in realtime and bi-directionnal) between the javascript code executed inside the iFrame and other Ignition stuff, for example some component on the view.

A websocket is opened between the module and the iframe, and script function enable to send message from ignition and message handler eanble to receive message in the ignition view

1 Like

Hi Nader,
What are your need with verg3d? do you have digital twin or bio in mind? If so, we started a 3D engine module for that, have a look here https://demo.axone-io.com/data/perspective/client/OnlineDemo/BIM

8 Likes

i thought you could interact with igntion too in the webdev module with http.get and posts
its quite a bit more work to set though

Oh my god, yes that’s what I really need, I want to have a 3d Model of a car component and the operator invests it with a real model and adds comments on rejected parts in 3D and saves it in the database.
Did you use THREE.JS lib for that?
Is there any trial demo too?

The module has no trial at the moment but it will be done in the next days. Then you could have a trial module.
We do not use three.js but another library (don’t have it in mind, I’m just the sale’s guy ;)); our goal is to be able to ingest any kind of 3D model and serve it to a perspective session with all the fancy things you know.
I’ll send you the module asap.

4 Likes

You can interact easily one way, namely, from the Perspective view to the httpGet endpoint in an iframe. However, it is not trivial to go the other way, from the iframe back to the Perspective view. Say you pass in some data into the endpoint, you do a query and build out a custom JS chart, which you then place in an iframe in the Perspective view. How would you then notify the view when a selection happens in your custom chart? Since Perspective already uses the Websockets protocol for its messaging system, what @mazeyrat built fits right in.

You can do a post to the gateway too?
with some js function like ajax/axios or whatever is used nowadays

Yes you can. But it gets clunky. You can use a message handler from the POST endpoint to notify the view. But that means you also need to pass in the sessionId and pageId properties into your iframe so that you can use them on the POST side. Also, what if the data you want to send back is a dataset or a complex object or something less trivial than one value? It’s possible, but from my own experience, not very clean.

You should be able to pass json in the body of a post.
But yeah it does get messy, in the example of mazeyrat he also passes along some session id/info though. But idk if its nececarry for it to work.

Hi,

You can download the module AS IS at https://www.axone-io.com/Files/Modules/3DENGINE/1.0.0/doc/index.html.
You can chat with @e.sagnelonge for technical point and first use (Paris local time).
All feedback are welcome.

3 Likes

Module download and documentation (with video) updated here https://www.axone-io.com/Files/Modules/3DENGINE/1.0.0/doc/index.html

1 Like

Thanks this one is really helpful.
By the way, what is the price range?

We hope around 1k€/usd but price is under review actually. Any feedback is welcome.