pattern-x / gemini-viewer-examples

Examples and demos for gemini-viewer sdk, which is a WebGL based BIM model viewer, built on three.js. It is used to view dwg/dxf, gltf, obj, ifc models, etc.
182 stars 42 forks source link

failed to load dxf with image in it #64

Open jshenguru opened 1 year ago

jshenguru commented 1 year ago

When loading a DXF file with linked image in it, the viewer gets stuck at "Loading 45.00%". Please help. The console output is below

image

The same issue happens when loading a DXF file with OLE image in it.

pattern-x commented 1 year ago

Is the image an xref? It doesn't support xref yet.

jshenguru commented 1 year ago

NOT XREF. Just the IMAGE entity.

It is highly appreciated if you could support IMAGE entity. My CAD drawings have a lot of IMAGE entity.

As I expressed before, I would love to spend time making contribution to the gemini-viewer-threejs if you folks can add me into your development team.

Based on the following discussion, it is safe to say that implementing this feature should not be a rocket science.

https://stackoverflow.com/questions/60200623/how-can-i-load-a-local-image-in-three-js

yanzexuan1 commented 1 year ago

Could you share the dxf file with image? Loading images in dxf is supported, there maybe a bug for your case.

We beleive that is the direction to open it source, and there is still no decision yet. And, even if we decided, we should spend some time to refine, cleanup current code.

jshenguru commented 1 year ago

Here you go.

Drawing1.zip

yanzexuan1 commented 1 year ago

Got it. Well, as I can see that the image is actually an xref. You can check it with "xref" command. But we'll think about if we can support it... The major trouble is that an xref is another file, we need to think about how to handle the url.

image

jshenguru commented 1 year ago

When you mentioned, as quoted, "Loading images in dxf is supported", what did you mean exactly? Is there another way of inserting image in dxf?

yanzexuan1 commented 1 year ago

Sorry, what I said is wrong. I checked again and image is not supported yet!

Let's talk with my colleagues for how it is possible to support images. The major trouble is that an image is another file rather than embeded into dxf.

yanzexuan1 commented 1 year ago

We can load image as x-ref now, but there are some limitations. The problem is that, as a web page, we cannot read any file from local disk, so we need to use file explorer to select the dxf and image files.

It support the case when your dxf and images are under the same folder (the are under the same folder when you create the x-ref in AutoCAD), and you upload these files via file explorer. You can try it with https://pattern-x.github.io/gemini-viewer-examples/#/Upload_your_local_dxf