omrips / viewstl

Viewstl Javascript plugin - STL/OBJ 3D files Viewer by viewstl.com
MIT License
199 stars 49 forks source link

"Error parsing the file" when trying to load 3mf files #18

Closed AlbertMN closed 3 years ago

AlbertMN commented 3 years ago

Hey there. Running the latest version I get the following in the console whenever I try to load a .3mf file; ERROR: Error parsing the file

I can load 3mf files on https://www.viewstl.com/ though, so don't really know where it's going wrong. obj and stl files are loaded just fine. Load them using the following code;

stlViewer = new StlViewer(document.getElementById("stl_cont"), {
  allow_drag_and_drop: false,
  auto_rotate: true,
  models: {
    id: 1,
    filename: (url to .3mf, .stl or .obj model),
    rotationx: -90,
    scale: 0.5,
    color: "#29ABE2",
  }
});

Any tips?

tristanluther28 commented 3 years ago

Hi AlbertMN,

3mf and vsb files also require JSZip in order to be parsed correctly. See the Dependency on JSZip library section in the README.md

Do you already have JSZip installed?

omrips commented 3 years ago

It can be JSZip, but in such case you should also see an error "JSZip is missing".

It can be also server-side problem (as the client gets invalid result from the server). Are the plugin files and the model files are both on the same server?

AlbertMN commented 3 years ago

Same server, same method used when getting obj and stl files.

I don't have the dependency you're talking about, so that could be it, but no error saying that.

AlbertMN commented 3 years ago

Adding the JSZip library fixed it - sorry for missing that part, thanks for your help! :)