Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

3MF exporter #120

Closed
wants to merge 23 commits into from
Closed

3MF exporter #120

wants to merge 23 commits into from

Conversation

Floppy
Copy link
Contributor

@Floppy Floppy commented Feb 20, 2024

My current need for Mittsu is to be able to convert files into more efficient forms, as a feature for https://manyfold.app. So, I'm working on a 3MF exporter. This is NOT an existing THREE.js feature, so you may want it to be in a separate addon gem - up to you.

It adds two dependencies; builder which was already a transitive dependency from minitest, and rubyzip which is completely new. It also uses rexml in dev for testing the output.

THREE.js annoyingly uses parse for exporting which makes no sense; I've rename it export and made parse an alias for consistency with the original.

@Floppy
Copy link
Contributor Author

Floppy commented Feb 25, 2024

Getting there with this; it now generates valid 3MF files. Just working on getting the child object traversal and relationships right, because at the moment running the example produces a version of male02.obj without various parts, which is... suboptimal :)

@Floppy
Copy link
Contributor Author

Floppy commented Feb 26, 2024

OK, the root cause of my problem is in the OBJ loader, rather than the 3MF output, and I've filed it for a rainy day as #123.

I'll update the converter example to use a simpler model, and then this should be done, at least for an initial basic form.

@Floppy
Copy link
Contributor Author

Floppy commented Feb 26, 2024

OK, working 3MF export is ready! There are probably plenty of edge cases to find, but as an MVP, I'm happy with it.

Screenshot 2024-02-26 at 14 56 05

@Floppy Floppy marked this pull request as ready for review February 26, 2024 14:59
@Floppy
Copy link
Contributor Author

Floppy commented Feb 28, 2024

This is also green now, I was missing a gem dependency for rexml.

@Floppy
Copy link
Contributor Author

Floppy commented Mar 31, 2024

@danini-the-panini it's just occurred to me that while I'm writing mesh analysis code in https://github.com/manyfold3d/manyfold/pull/1981/files#diff-b33a35020b14550d6b315e9628edd985f88159a26555ab2f4027358e592ebfab, this is actually required to check that meshes are valid for 3MF files before exporting. Would you like me to PR that stuff into the mittsu core? It checks that meshes are manifold, and that they aren't inside out.

@danini-the-panini
Copy link
Owner

As in, generic manifold checks for all meshes? I'm not sure that's necessary, since inside out meshes are useful in some cases, and are still valid in mittsu

@Floppy
Copy link
Contributor Author

Floppy commented Mar 31, 2024

Yeah, that's what I was thinking, it's probably too specific as those things are totally valid unless you're trying to bring things into the real world. I wonder if that has similar implications for this PR, because it currently could produce invalid 3MF files.

@Floppy
Copy link
Contributor Author

Floppy commented Mar 31, 2024

What with 3mf being non-threejs functionality, that might be another argument that this should be in a separate extension gem, not core.

@danini-the-panini
Copy link
Owner

No i think it's fine in Core, at least for now

@danini-the-panini
Copy link
Owner

@Floppy after thinking about this for a bit, I think it would make more sense as a separate gem, especially due to the extra dependency

@Floppy
Copy link
Contributor Author

Floppy commented Nov 12, 2024

OK, cool, I can move it out. 👍

@Floppy
Copy link
Contributor Author

Floppy commented Nov 12, 2024

I'll probably create couple of addon gems; mittsu-analysis for things like the mesh structure checks, and mittsu-3mf for 3MF export (and later import too). Are you OK with that naming?

@danini-the-panini
Copy link
Owner

That sounds good 👍🏻

Floppy added a commit to manyfold3d/mittsu-3mf that referenced this pull request Nov 12, 2024
@Floppy
Copy link
Contributor Author

Floppy commented Nov 13, 2024

Right, I've got a gem nearly done for this at https://github.com/manyfold3d/mittsu-3mf. Just need to get it tested and publish, then I'll close this. I've also created https://github.com/manyfold3d/mittsu-mesh_analysis, which has the manifold checks in it, so that I can use them into the 3mf exporter. This approach works nicely!

@Floppy Floppy marked this pull request as draft November 13, 2024 09:32
@Floppy Floppy closed this Nov 13, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants