Opening 3D Image Viewer from Perspective

I have been asked to launch a 3rd party app to view 3D image files. The file types are PST and STL files, and the application is one made/provided by 3Shape (3Shape 3D Viewer). I can launch the app and hav it open the file from the Script Console using the system.util.execute function, but when I try to do this from a Perspective View nothing happens.
My first assumption is that since this is Perspective, the system.util.execute function executes from the “perspective” of the Gateway and NOT the client session. Is this a true assumption?
Regardless, is there a way from Perspective to launch a 3rd party app on the PC where the client is running?

Thanks.

That's correct.

Not at present. It would theoretically be possible in a Workstation session, but would absolutely not be allowed in browser or mobile device sessions.

You could potentially embed something like three.js into a Perspective component - that would let you directly display the STL files in a Perspective component. You would need a custom module, though.
https://threejs.org/examples/webgl_loader_stl.html

Thanks Paul.
I don’t think the client will bight off on creating a custom module. And I’m not the person for that anyway. Never done it before and wouldn’t even know where to start. It would be interesting, but outside the realm of thing I do.

Another question now that we have changed tacks.
I can use the system.file.readFileAsBytes and system.perspective.download functions to download the file to location of the user’s choosing.
Is there a way to force the destination location of this file?
If not, is there a way to access the last download location from within Perspective.
Once the function at this station is completed, I need to remove the files (if possible) to prevent clutter and resource usage.
My thought is that I can look for the filename in the location I expect the files to be and delete them.
I would just need to either force a destination location or know where the last download location was (and hope they did not change the name or download something else in the mean time).

Thanks.

OR, if there is a better solution to this I am absolutely all ears!

You keep asking for things that browsers don’t do. Perspective, with minor adjustments for the Workstation version, runs in a browser. If you want total access to everything in the client machine, you need to run Vision. Totally different paradigm. The paradigm you have in your head is Vision.

Yeah, well it isn’t my choice, nor are the things being asked of the system. Clients make those decisions and demands. My job is to either figure out a way that it can be done within the budget of the job, or be able to explain to them why it can’t be done. So here I am, asking for the impossible from a community that excels in doing just that! :smiley:

2 Likes

Nope. A suggested filename is all you get:

Nope. Browsers are very cagey about giving you access to local files (for obvious security reasons).

Nope. Same thing - can't read files, can't remove files.

Along the same lines of the 3d viewer - you could create your own browser extension and specifically request access to some of the capabilities you want from the browser:

1 Like

I agree with @PGriffith about the threejs methodology for displaying the data, but I am wondering if you could display it via the Inline Frame Perspective module? And have the model hosted on a simple, external web server that you control.

I’ve thought about things like this and would love to display some 3d models as well, but also have Ignition inject values into the models in order to control visual elements within them (in my case the physical location of a crane). That probably needs a public interface for requesting the values of tags from Ignition in real time. Obviously Perspective can do that in order to show live values, but I don’t believe us mere mortals have access to that.

While I’m at it, can I have a pony too?

2 Likes

2 Likes

I’ve actually accomplished this in perspective but was highly dependent on our tool stack.

For Example. We use Solidworks for 3D Design. Solidworks has a companion product edrawings that will allow you to export a solidworks model to native html. We take the resulting HTML file and make it a file resource in web dev. Using an inline frame we can view the 3D model within the perspective project. This works great for that application. But no real integrations past that.

A module based on something like threejs that exposes properties and animation would be the next step.

You can install a uri scheme on the clients pc (for windows atleast). Since they also need the 3d tool anyways, this seems like it will only be for a few targeted computers, so not to much work.

Not ideal but it works to run cmd commands on the local device. Find some inspiration on the bat file here.

A comment on this, I believe this is technically possible with apps that support deep linking. For example vscode:/path/to/my/fil/test.txt will open VS Code for that file.

The onActionPerformed script

system.perspective.navigate(url="vscode:/path/to/my/fil/test.txt")

After button click

This won't be every app, and its used much more commonly in mobile apps, but a few that I could find:

Can you confine such URL handlers to only work with specific–trusted–servers? If not, launching an executable with one seems unwise.

This is something that is defined in the third party app, not in the calling app, so you would have allowed the links to call when you installed the software and set it up. It also always prompts a user dialog for confirmation if they want to open the app or not (my screenshot is the one for VS Code)

So I would say that its on the user-end if they trust a specific app to be opened or not.

I don't think this would work with an executable, unless your "executable" was a fully written app that supported deep linking

That being said, I will admit to not reading this entire thread, which I have now, and I do not know of a 3D modeling tool that supports deeplinking. Unless maybe you could use the file:// deep link and it might prompt the user to pick an app of their choice?

EDIT: the file:// deeplink will just download the file if the browser can't open it, so this doesn't really work.

We had a similar requirement of displaying plant’s panoramic images with real time data from Ignition SCADA superimposed on it so that operator can see live plant data while taking a virtual tour of the plant using these 360-degree panoramic images. We tried three approaches to it:

  1. Host the virtual tours on a tomcat server and connect it with Ignition server to fetch real time data using a custom module in Ignition.
  2. Host the virtual tours on a nodejs server and connect it with Ignition using rest APIs
  3. Using webDev module in Ignition to serve the HTML pages having the virtual tours as well as get/post real time data.

Perhaps you could integrate your threejs HTML pages having 3D images with Ignition in one of the above three approaches!

That is exactly what my script is doing, it creates your own uri (deeplink)
in my scripts case its
explorer:
it opens the fileexplorer if its a path to a folder or if its a document it will open the document (with the default app for the file)


image
image
image

Pretty handy, ofc every client will have to install the uri for it to work, it also works with shared folders

1 Like