Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Nuxt JS TypeError: this.state.models[modelID] is undefined #173

Closed
saad4software opened this issue Jan 11, 2023 · 4 comments
Closed

Nuxt JS TypeError: this.state.models[modelID] is undefined #173

saad4software opened this issue Jan 11, 2023 · 4 comments

Comments

@saad4software
Copy link

Following the basic sample with Nuxt JS (Vue) I have faced two issues:

  1. the viewer shows the grid but doesn't show the model
    Screenshot from 2023-01-11 20-05-23
    to walk around it, I used IFCLoader from web-ifc-three
import { IFCLoader } from "web-ifc-three/IFCLoader";
input.addEventListener("change",
      async (changed) => {
        const file = changed.target.files[0];
        const ifcURL = URL.createObjectURL(file);
        this.viewer.IFC.loader = new IFCLoader();
        // this.viewer.IFC.setWasmPath('../');
        await this.viewer.IFC.loadIfcUrl(ifcURL);
      },
      false
    );

this loaded the model, but it seems to cause the second issue
2. when trying to select surface using

    window.onmousemove = () => this.viewer.IFC.selector.prePickIfcItem();

I am getting this.state.models[modelID] is undefined
Screenshot from 2023-01-11 20-10-13

although clipping surfaces works, they don't show on the grid either
please help

@agviegas
Copy link
Collaborator

Hey, can you please send us a link with a minimal application where we can reproduce this? Thanks!

@saad4software
Copy link
Author

Yes of course
https://github.com/saad4software/nuxt_ifc_viewer

npm install
npm run dev

please notice that I have added multiple wasm files, it can be improved, but I tried to add them where ever the library asks
and you can reproduce the first issue by commenting line 33 in pages/index.vue

@agviegas
Copy link
Collaborator

It's never recommended to install both web-ifc-three and web-ifc-viewer, as the latter contains the first and it can cause version conflict. I was able to solve this by npm uninstall web-ifc-three, deleting the node_modules folder, executing npm install and then updating the wasm files of the folder of the image below.

I noticed multiple copies of the wasm files in the folder structure under static. I don't have previous experience with this technology, so I can't say if this is expected, but I thought it was worth mentioning it.

image

@saad4software
Copy link
Author

Thanks! it worked perfectly
Best wishes

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants