manyfold icon indicating copy to clipboard operation
manyfold copied to clipboard

.3mf files not rendering preview

Open HappyPants9999 opened this issue 1 year ago • 9 comments

Preview is not being rendered for .3mf files.

HappyPants9999 avatar Sep 06 '24 15:09 HappyPants9999

Is it a 3MF saved from a slicer? It could be to do with the lack of support for the "production extension", like #2438.

Floppy avatar Sep 06 '24 15:09 Floppy

Possibly, I first noticed it on files that I downloaded some time ago. I'm not sure, but I probably downloaded it from makerworld since it is an ams y splitter for bambu printers. I then uploaded another file that although I can't be sure I think was something I exported from fusion. I will export one of my designs as 3mf to test and report results.

HappyPants9999 avatar Sep 06 '24 23:09 HappyPants9999

Confirmed that a file that I designed in Fusion 360 and exported as .3mf file is not rendering a preview when uploaded.

HappyPants9999 avatar Sep 07 '24 02:09 HappyPants9999

Thanks; could you upload a sample file so I can replicate the problem exactly, please?

Floppy avatar Sep 07 '24 08:09 Floppy

Here is a phone mount that I designed and exported from Fusion 360. Phone mount v5.zip

HappyPants9999 avatar Sep 07 '24 13:09 HappyPants9999

The console reports an error THREE.3MFLoader: Unsupported resource type.

That's reported from https://github.com/manyfold3d/threejs-webworker-3mf-loader/blob/main/src/index.js#L1152, which is not the most helpful error message in the world...

Floppy avatar Sep 18 '24 22:09 Floppy

Anyway, it's a different error from that which we get for production extension files; so it's a different cause and this issue will remain open until I solve it 😄

Floppy avatar Sep 18 '24 22:09 Floppy

Another file failing the same way in #2734.

Floppy avatar Sep 22 '24 14:09 Floppy

I can also provide examples if needed for further debugging if that helps at any point - feel free to tag me :-)

TheFitzZZ avatar Oct 08 '24 20:10 TheFitzZZ

Happens with every 3mf-file i tried so far. Most downloads are from makerworld, most of my own projects are saved with bambu studio. I'd be happy if this could be solved, it's the only reason not to work with manyfold. :(

randombenny avatar Nov 17 '24 18:11 randombenny

This is getting higher and higher priority, I'm gonna have to deal with it soon :)

Floppy avatar Nov 17 '24 21:11 Floppy

Would really like this!

diggforbeer avatar Jan 13 '25 03:01 diggforbeer

https://github.com/manyfold3d/manyfold/pull/3584 fixes a lot of 3MF issues, but not the phone mount file linked above, that has some other problem which I'll keep looking into. I'd be interested to know if the next release improves things for you and it's just that one left that's problematic, or if there are still more.

Floppy avatar Feb 13 '25 15:02 Floppy

Was hoping that this Bambu Labs 3mf files were working, just installed on unraid and install went fine however still no joy with the 3mf files. There is a program called printinventory that has both mac and windows installs that are in bets. It looks to be able to handle the 3mf file structure. Would so love to have a docker ver though..

dertbv avatar Feb 14 '25 01:02 dertbv

The console reports an error THREE.3MFLoader: Unsupported resource type.

That's reported from https://github.com/manyfold3d/threejs-webworker-3mf-loader/blob/main/src/index.js#L1152, which is not the most helpful error message in the world...

This issue happens because colorgroup resource entries are not read at all, so the lookup for resource with id 4 (= property type of object 3) fails. I suspect this is because that resource entry is namespaced as m:colorgroup so the issue already is here.

t-paul avatar Feb 14 '25 02:02 t-paul

It seems that any model exported from Fusion 360 in .3mf format does not load a preview still.

HappyPants9999 avatar Feb 14 '25 03:02 HappyPants9999

LOL, you're all way too fast for me! I've just released improved 3MF code in v0.101.0, so unless you were trying the edge tag, you wouldn't see any change until now. Give it another go, and see if it works better! Also, I've just realised that github auto-closed this issue because I wrote "doesn't fix #2640" in the relevant PR, so that's a mistake anyway!

On the colorgroup thing for the specific file mentioned above: I was probing into the file yesterday to see what was up, and you're right, those are the ones being warned about. However, because we don't use them anyway, it shouldn't really matter. The file should still be loaded, it's not aborting the load process. But, for some reason, it's not loading any geometry into the two meshes (ids 1 and 3). I'll keep investigating that aspect in this issue, though a load of related display problems issues (#2438 and #2734) should now be fixed.

Floppy avatar Feb 14 '25 08:02 Floppy

As you can see we're all eager to try this :) Thank you for your hard work!

TheFitzZZ avatar Feb 14 '25 08:02 TheFitzZZ

When adding 3MF color/basematerial handling to OpenSCAD, I found another great sample file. As far as I know, it was colored in Microsoft 3D Builder and has a very interesting multi-level nested object structure with transforms on both builditems and object references.

https://www.printables.com/model/844491-pylon - file 24-114-Leitkegel.colored.3mfwith comment "colored multipart - VIEWER ONLY!"

This file also does not show in Manyfold Version: 0.101.0 (376cfa77).

t-paul avatar Feb 14 '25 09:02 t-paul

great, thanks! I'll look into it. I'm also checking against the official 3mf-samples to check that we can handle all of those.

Floppy avatar Feb 14 '25 09:02 Floppy

After uploading my first design to 3dprint.social (thanks!), I hit this issue again. The uploaded 3MF files are not showing up at all. The files are generated from OpenSCAD.

I've tracked down the issue as much to have a "fix" for threejs-webworker-3mf-loader, although I'm not sure if that's the best solution. The issue does not happen with the upstream ThreeJS loader.

As suspected in an earlier comment, it's the (monkey-patched) select() call failing for the material data (colorgroup) as it's using the material namespace m: in my files.

The workaround passes along the extension/namespaces collected from the model element to the parsing functions and prefixes the selector with the namespace, e.g. select("m\\:colorgroup") which makes it find the data.

A much easier solution would be finding a selector library that has direct namespace support or even better a flag to just ignore namespaces, digging a bit on npmjs.com did not bring any quick result. Considering all the lookups I've seen so far happen via trivial selectors, using only full names of elements, a simple manual tree search might be an option too.

Trimmed down snipped of the color section

<model xmlns:m="http://schemas.microsoft.com/3dmanufacturing/material/2015/02">
        <resources>
                <m:colorgroup id="2">
                        <m:color color="#3E999FFF" />
                        <m:color color="#EAB700FF" />
                </m:colorgroup>

t-paul avatar Jun 29 '25 02:06 t-paul

Never mind, xmldom has getElementsByTagNameNS() with support for wildcard namespaces and even though I missed the descendant selectors before, those are simple enough. The PR linked above fixes the issue for me.

t-paul avatar Jun 29 '25 04:06 t-paul

Great, I've merged the PR and it should make it into the next release!

Floppy avatar Jun 29 '25 13:06 Floppy