3MF export need?

Hey guys, I’m finalizing a basic 3MFexporter from IVerticeData to 3MF files for internal use. I may share it or add it to Babylon if there’s interest from the community.

Please share your use cases or thoughts. I’ll be happy to share the Git repo or make a PR if it’s relevant.

3 Likes

That would be great!

1 Like

That could directly go to our exporters:
Babylon.js/packages/dev/serializers/src at master · BabylonJS/Babylon.js

2 Likes

I started adding 3MF support under the serializer. So far it is straightforward, but I have one open question that I do not have an easy answer for.

A 3MF file is a ZIP container, so to serialize it we likely need to handle ZIP compression. In my current implementation, which works well, I chose fflate because it is the most lightweight library I found that supports compression and is MIT licensed.

However, I understand that we cannot add third-party libraries like this to the project. What is the best practice in this case? And if adding a dependency is acceptable, what is the recommended way to keep it attached to the serializer only, without affecting the rest of the project?

if you may send me the pirat for my tests… :grin:

You can look at what I did for exr image format
You can dynamically load the fflate

(Sorry for brevity, I’m on my iPhone)

1 Like

That’s fine for me. I can take it through producing the babylon.threemfSerializer.min.js bundle. Now I need to understand what tools you put in place to test this serializer.

1 Like

Everything is ready and seems to work well. I still have a few tests to run with submeshes and instances. For v1, I decided to focus on geometry only, and everything looks good so far.

The serializer is integrated into Babylon.js in my fork, and I will open a PR soon.

For anyone curious,here is a sample of what is generated.

Happy testing and coding. Tomorrow I am going for a long run with the squirrels (i do not have bears here…) :slight_smile:

4 Likes

To All, PR #17858 has been issued…

G.

4 Likes

Now that 3MF export is integrated in Babylon.js, the next logical step could be an Inspector v2 plugin focused on last mile printing workflows. The main use case is web configurators and visualization apps that need to package the final scene state into a production oriented 3MF (units, orientation, instances, basic color and metadata) without turning Babylon into a slicer. UI wise it could stay minimal with a single 3D Printing side panel split into Profile, Preflight, and Export sections, plus an optional per mesh override in the Properties panel and a toolbar button to open the panel.

2 Likes

@Deltakosh @sebavan If we want to build a loader for 3MF, where do you plan/guess to put the common code (3MF interfaces and definitions)? I mean, using the same approach as GLTF with babylonjs-gltf2interface seems overkill for a format that isn’t central to the framework.

cc @ryantrem :slight_smile:

What about something like the objloader?
Pretty simple and not a lot of externals
Babylon.js/packages/dev/loaders/src/OBJ at master · BabylonJS/Babylon.js

3MF is more complex than Obj, like gltf, with extensions and other features. I’ve already begun working on an OBJ approach for a first version.

2 Likes

Happy birthday my friend!!!

1 Like

Greetings to all,

is there a PG where I can see how it works? I tried but I couldn’t get it to work. I receive problems with ExportAsync.

my attempt

scene export to 3MF

thanks

Mean that the ThreeMFSerializer is not imported into the playground… we may have to update this