Kitware / vtk-js

Visualization Toolkit for the Web
https://kitware.github.io/vtk-js/
BSD 3-Clause "New" or "Revised" License
1.23k stars 371 forks source link

HttpSceneLoader can't load local file #723

Closed gute-kunst closed 6 years ago

gute-kunst commented 6 years ago

Hi there,

I'm new to vtkjs and tried to run some examples and tried to fit them to my needs. I ran into a problem on the HttpSceneLoader. I tried to change the Attribute of setUrl() to my local vtkjs file. sceneImporter.setUrl('cone.vtkjs'); (cone.vtkjs is located in my /dist folder. I tried the cone.vtkjs file on the SceneLoader example - it's working)

I stumbled upon the following two errors: GET http://localhost:8081/cone.vtkjs/index.json 404 (Not Found) Error fetching scene [object Object]

So after finding no issues or topics that fit to my problem I have some questions regarding the error message. 1) Am I right that the cone.vtkjs is like a container for other files like the index.json file? 2) Am I right that the cone.vtkjs file is found by the HttpSceneLoader but another problem prevents correct functionality?

jourdain commented 6 years ago

vtkjs file are in fact zip file which contains the various pieces of the data. The setURL expect the root path to an unpacked version, but you can handle the zip version by doing something similar to the example here in the section if (options.fileURL) { ....

https://kitware.github.io/vtk-js/examples/SceneExplorer.html

gute-kunst commented 6 years ago

cheers sebastien, it works now. Thanks.