Skip to content

Add support for object.name attribute + Color Group in 3MF Materials Extension + Bambu Studio/3MF Production Extension component path#58

Open
ansonl wants to merge 23 commits intoGhostkeeper:masterfrom
ansonl:master
Open

Add support for object.name attribute + Color Group in 3MF Materials Extension + Bambu Studio/3MF Production Extension component path#58
ansonl wants to merge 23 commits intoGhostkeeper:masterfrom
ansonl:master

Conversation

@ansonl
Copy link
Contributor

@ansonl ansonl commented Oct 18, 2023

  1. Added export support for retaining the object name in the object.name attribute that is supported for naming individual objects in the GUI of slicers such as Prusaslicer. Cura seems to export object.name set within Cura but not import existing object.name in files.

image

  1. Added user toggle-able import/export support for writing material colors to Color Group/Color from the 3MF Materials and Properties Extension. Toggles between color group and base material. This supports 3MF viewers such as the online 3D preview on Printables.com that support Color Group to display objects in producer specified colors.

image

  1. Updated README to remove TESTING category.

@CptJackieSparrow
Copy link

Can this version import color data to blender?

@ansonl
Copy link
Contributor Author

ansonl commented May 13, 2024

@CptJackieSparrow @Ghostkeeper I added support importing 3MF Color Groups, added some tests, and cleaned the code to pass the code style tests.

Sorry, there were a lot of individual commits until I figured out how to run the code style test locally.

@ansonl
Copy link
Contributor Author

ansonl commented May 13, 2024

Attached redblue.zip if a sample project with base material and color group is needed for testing.

@dvoros
Copy link

dvoros commented Jun 22, 2024

Thanks for this. Exporting the object names is must-have. 🙏 Verified that it works perfectly. 👍

Ghostkeeper and others added 15 commits December 7, 2024 15:41
This is the Python version of the latest Blender release, as of this writing.
Otherwise it tries to install Python 3.1, which is not available on the latest Ubuntu version.
This is mandated by pycodestyle now.
As mandated by pycodestyle nowadays.
Apparently this has changed with more recent Blender versions.
Add note on manual installation location of addon for development.
No "3MF extensions" ... works -> 3MF +format+ extensions
being .3mf also a file extension better to be clear
It's clearly a malformatted 3mf, but it also shouldn't crash the loading
This makes the message a bit more readable
@ansonl
Copy link
Contributor Author

ansonl commented Dec 8, 2024

@Ghostkeeper Circling back to see if the object name and colorgroup feature can be merged into the main addon branch. I merged the latest main version with my branch with the colorgroup functionality. Let me know if you see any needed changes I should to make to merge. Thanks.

I've been using the import/export color feature the past 6 months and it seems stable with no issues.

I squashed my extra commits that I previously made before figuring out how to run the linter locally.

@ansonl
Copy link
Contributor Author

ansonl commented Jan 3, 2025

Added Bambu Studio file import support by following referenced p:path as mentioned in the 3MF Production Extension spec

Similar to #70 but this version should be more robust because Bambu Studio specifies a path for each component and the component objectid is should be found in the referenced model file path.

<resources>
  <object id="2" p:UUID="00000001-61cb-4c03-9d28-80fed5dfa1dc" type="model">
   <components>
    <component p:path="/3D/Objects/object_1.model" objectid="1" p:UUID="00010000-b206-40ff-9872-83e8017abed1" transform="1 0 0 0 1 0 0 0 1 0 0 0"/>
   </components>
...

image
image

Bambu Studio exports object names in the model_settings.config so Bambu exported object names are currently not supported but Bambu Studio will import 3MF spec object names from this addon. Bambu Studio will successfully read the color group when the 3MF is imported but will not export Bambu Studio material assignments as color groups. So object names and color group need to be set in Blender before importing to Bambu Studio.

@ansonl
Copy link
Contributor Author

ansonl commented Jan 3, 2025

Installable release zip for this branch is at
https://github.com/ansonl/Blender3mfFormat/releases/tag/1.0.3

@ansonl ansonl changed the title Add support for object.name attribute and Color Group in 3MF Materials Extension Add support for object.name attribute + Color Group in 3MF Materials Extension + Bambu Studio/3MF Production Extension component path Jan 3, 2025
@Fasteroid
Copy link

Fasteroid commented Jun 22, 2025

What should a Bambu model look like when imported? How do I see which parts of the model are using which colors? It's not in the materials tab like I'd expect it to be...

@Tomato6966
Copy link

Tomato6966 commented Sep 11, 2025

Python: Traceback (most recent call last):
File "C:\Users\chris\AppData\Roaming\Blender Foundation\Blender\4.3\scripts\addons\io_mesh_3mf\export_3mf.py", line 116, in execute
xml.etree.ElementTree.register_namespace("m", MODEL_MATERIALS_EXTENSION_NAMESPACE)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
NameError: name 'MODEL_MATERIALS_EXTENSION_NAMESPACE' is not defined

I'm getting this error

EDIT: It was a caching issue, a restart and cache clean fixed it!
However the colours are not matched correctly. propably due to not recognising colours from the uvs

@ansonl
Copy link
Contributor Author

ansonl commented Nov 19, 2025

What should a Bambu model look like when imported? How do I see which parts of the model are using which colors? It's not in the materials tab like I'd expect it to be...

Bambu Studio doesn't treat Blender colors as materials 1:1 because materials represent a physical type of plastic and not just the color defined in the 3MF. Blender materials are for rendering and are not equal to Bambu Studio materials.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

8 participants