Automatically load data into ParaView Glance?

I have created a desktop app and am exporting simulation data in VTP format compatible with ParaView Glance. Is there an easy way to automatically link the Glance app with the data file so that the end user doesn’t have to “open/load” the data into Glance. I don’t really plan to change, recompile or host my own Glance app, but just automatically add or pre-select the data file?

2 Likes

If your data are available out in the wild, you can provide the information on where to load the data in the url, this also support several files if need be.

Here is an example https://kitware.github.io/paraview-glance/app/?name=202-t.glance&url=https://raw.githubusercontent.com/Kitware/paraview-glance/v3.0.1/data/202-t.glance

3 Likes

Thank you, just the functionality I was looking for.

It does not seem to work with local files or files served with only http, is there possibly some workaround or fix for this?

I have not been able to get this to work with my own data hosted on my own domain, for example

https://kitware.github.io/paraview-glance/app/?name=featool-multiphysics-airfoil.glance&url=https://www.featool.com/download/featool-multiphysics-airfoil.glance

Does the glance app maybe need to be hosted on the same domain as the data?

Yes, exactly. When I try that link, I get this error message in Chrome:
Access to XMLHttpRequest at ‘https://www.featool.com/download/featool-multiphysics-airfoil.glance’ from origin ‘https://kitware.github.io’ has been blocked by CORS policy: No ‘Access-Control-Allow-Origin’ header is present on the requested resource.

So if you host ParaView Glance, you can either get data from the same domain, or set the policy to allow downloads from your data server.

Thank you, that clears it up, and thanks for making Glance available.

I have a similar question. Suppose that I have a html document with an iframe pointing to ParaView Glance:

<iframe src="https://kitware.github.io/paraview-glance/app" id="iframe"></iframe>

(How) Can I upload data in the html document via using that iframe? Will this have the same restrictions as mentioned above or can I upload local data this way?

Via the URL, you will get the same restriction. But you should be able to host Glance locally if need be as well.

You could also use https://unpkg.com/paraview-glance@3.1.1/dist/ParaViewGlance.html which may not have the CORS limitation.

Thank you for the fast answer. For me, pointing to

https://unpkg.com/paraview-glance@3.1.1/dist/ParaViewGlance.html/?name=202-t.glance&url=https://raw.githubusercontent.com/Kitware/paraview-glance/v3.0.1/data/202-t.glance

doesn’t work, it just continues to the standard ParaViewGlance.html. It works for the kitware.github.io url.

I would anyway prefer to enter the normal address and use javascript from there to set the name and url. How would this work?

Thanks, I was able to host the server locally and load the data in the url as you have suggested but I could not get multiple files version to run,

http:localhost:9999/?name=Indian_Hill.stl&url=http://localhost:9999/cfm_data/Indian_Hill.stl&name=San_Jose.stl&url=http://localhost:9999/cfm_data/San_Jose.stl

You can not have the same key used several times, you need to do something like that

?url=url1,url2,url3&name=name1,name2,name3

1 Like

Arg parser fails to parse the name=name1,name2
It see it as a single filename.

The following files errored while loading:
 IndianHill.stl,SanJose.stl

try by surrounding the list with [] so it will be ?name=[a,b]&url=[c,d]

Worked!!! Now I just to have to figure out if I can color them differently.
Thanks for the great tool.

Hello. I’m trying your example but glance keep says “Error: no data for …”
Must be mistaking something but cannot find out

https://kitware.github.io/paraview-glance/app/?name=dataset.vti&url=https://github.com/JaewonAC/dcmdb/raw/master/sample/dataset.vti

Access to XMLHttpRequest at 'https://github.com/JaewonAC/dcmdb/raw/master/sample/dataset.vti' from origin 'https://kitware.github.io' has been blocked by CORS policy: The 'Access-Control-Allow-Origin' header has a value 'https://render.githubusercontent.com' that is not equal to the supplied origin.
1 Like

Oops Sorry missed Aron Helser’s reply on above. guess I understand the problem.

Just to follow up on this thread. I have now seen there are Glance html builds that can be used to bundle vtkjs files. I wonder if this would also be possible with plain ascii vtk or vtp files (without the views)? I have tried with

Glance.loadFiles/openFile("path_to_my_local_file")

calls instead of “importBase64Dataset” but just can not get that to work. Should this be possible at all?

Alternatively, should this be possible to run everything locally as:

file:///C:/temp/ParaViewGlance.html/?name=test.vtp&url=file:///C://temp//test.vtp

as this will not work either?

importBase64Dataset() can indeed support any file that glance support (i.e.: vtp, vti). But the file in question needs to be properly encoded inside the HTML file. You can see the way we bundle a dataset here.

In other words importBase64Dataset decode the data and call loadFiles internally.

Hi Seb,
This is also work for ParaView Web?
How can i test it just on my own pc?
like, if i already run server by “.\bin\pvpython.exe .\share\paraview-5.8\web\visualizer\server\pvw-visualizer.py --content .\share\paraview-5.8\web\visualizer\www --data .\examples\ --port 8080

Then how to modify “http://localhost:8080/” to auto load file “can.ex2” under “examples” folder?

Thanks and Best Regards,
Sharon