ThatOpen / web-ifc-viewer

Graphics engine and toolkit for client applications.
MIT License
947 stars 235 forks source link

Error while trying to run computeAllPlanViews #203

Closed LeviSTA closed 1 year ago

LeviSTA commented 1 year ago

Currently, we have a viewer made with web-ifc-three. And we're trying to use the IfcViewerAPI to computeAllPlanViews to generate plan views.

Our code that does this: await this.ifcViewerAPI?.plans.computeAllPlanViews(this.ifcModels[0].modelID);

Where our IfcModel is loaded into the ifcModels array.

Currently we get this error when executing this: image

ThomasvanHoutum commented 1 year ago

I get the same error when following this code: https://github.com/IFCjs/hello-world/blob/main/examples/web-ifc-viewer/floorplans/app.js Is this an issue with the IfcViewerAPI?

ThomasvanHoutum commented 1 year ago

The issue was that I was using the expressId of the model we loaded in with web-ifc-three. I needed to load the model with IfcViewerAPI and use that model to generate the plans.

agviegas commented 1 year ago

Web-ifc-viewer already contains web-ifc-three. When using web-ifc-viewer, you can access the instance of web-ifc-three like this: viewer.IFC.loader. Generally, importing web-ifc-three explicitly and using it separately is not recommended.

In other words, you can't load a model in web-ifc-three, and then try to use the tools of web-ifc-viewer. Either you load the model in web-ifc-viewer, or you extract the tools that you want from web-ifc-viewer manually to create your own tools on top of web-ifc-three.

Might this be the cause of your problem @LeviSTA?

LeviSTA commented 1 year ago

Web-ifc-viewer already contains web-ifc-three. When using web-ifc-viewer, you can access the instance of web-ifc-three like this: viewer.IFC.loader. Generally, importing web-ifc-three explicitly and using it separately is not recommended.

In other words, you can't load a model in web-ifc-three, and then try to use the tools of web-ifc-viewer. Either you load the model in web-ifc-viewer, or you extract the tools that you want from web-ifc-viewer manually to create your own tools on top of web-ifc-three.

Might this be the cause of your problem @LeviSTA?

Yes I figured.

Today we actually converted the whole computeAllPlans to work in web-ifc-three and nodejs. So there are no problems there anymore, we just converted it from typescript to javascript and added esm to them so we can use it in node and the rest of threejs. It's all still working well so I guess that closes this issue.