ThatOpen / engine_web-ifc

Reading and writing IFC files with Javascript, at native speeds.
https://thatopen.github.io/engine_web-ifc/demo
Mozilla Public License 2.0
617 stars 190 forks source link

[Feat]: IFC to gLTF conversion using Azure functions #395

Closed yadunandan6176 closed 1 year ago

yadunandan6176 commented 1 year ago

What is your idea?

Hello,

I am trying to create a conversion module using IFC.js for converting IFC files to gLTFs on Azure functions. I am getting a lot of issues achieving it.

Is it possible to convert IFC to gLTF without a browser or any GUI?

I am facing issues while creating a context for web-gl since it is expecting an element on the browser.

Exception: Error creating WebGL context. Stack: Error: Error creating WebGL context. at new WebGLRenderer (C:\Users\Downloads\ifc2gltf_functoins\BlobTrigger1\index.js:25483:12) at new IfcRenderer (C:\Users\Downloads\ifc2gltf_functoins\BlobTrigger1\index.js:101880:30) at new IfcContext (C:\Users\Downloads\ifc2gltf_functoins\BlobTrigger1\index.js:107553:25) at new IfcViewerAPI (C:\Users\Downloads\ifc2gltf_functoins\BlobTrigger1\index.js:115746:24) at CreateViewer (C:\Users\Downloads\ifc2gltf_functoins\BlobTrigger1\index.js:115903:18) at module.exports (C:\Users\Downloads\ifc2gltf_functoins\BlobTrigger1\index.js:115911:14) at t.InvocationModel.<anonymous> (C:\Program Files\Microsoft\Azure Functions Core Tools\workers\node\dist\src\worker-bundle.js:2:52632) at Generator.next (<anonymous>) at C:\Program Files\Microsoft\Azure Functions Core Tools\workers\node\dist\src\worker-bundle.js:2:50957 at new Promise (<anonymous>).

I am following the tutorial which is on the official website of IFC.js the link is here.

Can anyone help me solve this issue or suggest a workaround that I can consider using further in my project?

Thank you.

beachtom commented 1 year ago

OK - so I don't think this is really part of the web-ifc functionality - but you can get all the basic geometry out of this library i.e. the vertexes and edges. You can see how this is done here: https://github.com/IFCjs/web-ifc/blob/main/examples/viewer/web-ifc-three.ts

I guess you would need to use a library such as https://www.npmjs.com/package/@gltf-transform/core to then write out the geometry to a new gltf file