assimp icon indicating copy to clipboard operation
assimp copied to clipboard

Support 3MF triangle paint_color attribute? (for multimaterial 3D printing slicers compatibility)

Open ochafik opened this issue 1 year ago • 2 comments

Is your feature request related to a problem? Please describe.

Hi! I'm trying to integrate assimp to OpenSCAD, a CAD tool with a large 3D-printing hobbyist user base, to benefit from its large set of color-aware 3D file formats (see https://github.com/openscad/openscad/pull/5180#issuecomment-2179356486 ).

A core motivation is to be able to write models that can be printed by multimaterial printers (e.g. Prusa + MMU or BambuLab + AMS). The two main slicers in that space (PrusaSlicer and its fork BambuStudio) use 3MF with custom attributes.

In particular, when it comes to writing which material to "paint" a triangle with, they use a rather convoluted serialization scheme and the attribute paint_color or slic3rpe:mmu_segmentation (more details here) to describe how the face is painted.

Describe the solution you'd like

So, it would be amazing if assimp were able to write a .3mf that can be recognized as native by PrusaSlicer & BambuStudio.

Not sure how that fits into the assimp ethos, but if it's too specific a use case, I was wondering if you'd consider at leaast allowing custom key-value attributes for faces (and maybe custom metadata), so we can generate a model slicers will accept / read face painting info from.

It may be overkill to support the serialization scheme, but at least allowing passing along the serialized values would be great.

image

Describe alternatives you've considered

Alternatively I might just write to a blob, read the zip and surgically edit the model XML to add the attributes, leaving some matIdx breadcrumbs to know what to edit.

Orrr fork assimp and alter D3MFExporter::writeFaces somehow.

Thanks for the amazing work on assimp & for reading this!

ochafik avatar Jun 19 '24 20:06 ochafik

I worked at SLM-Solutions for years. So yes, I will try to solve this feature.

kimkulling avatar Jul 08 '24 21:07 kimkulling

@kimkulling Thanks!

FYI I've now hacked a workaround into the OpenSCAD Web Playground where I post-process in JavaScript the 3MF generated by Assimp (compiled to WASM w/ OpenSCAD by Emscripten)

  • materialize.ts unzips the .3mf, projects its colors against the nearest extruder color (in cielab color space), adds the relevant metadata, and rezips the result to create files that BambuStudio & PrusaSlicer seem happy with 🎉
  • The 3MF export itself required a couple of fixes I'll send you PRs for once I wrap my head around how to test them (see this branch)

ochafik avatar Jul 09 '24 01:07 ochafik

@ochafik Any updates on the PR?

tellypresence avatar Apr 15 '25 01:04 tellypresence

3MF issues tracked via epic #6180

tellypresence avatar May 14 '25 15:05 tellypresence