lib3mf

raw JSON →
2.5.0 verified Sat May 09 auth: no python

lib3mf is the official Python binding for the 3D Manufacturing Format (3MF) library, enabling reading, writing, and manipulation of 3MF files. Version 2.5.0 is current. Release cadence is irregular, driven by upstream spec changes.

pip install lib3mf
error ModuleNotFoundError: No module named 'lib3mf'
cause lib3mf not installed or pip install failed silently due to missing C library.
fix
Install with pip: 'pip install lib3mf'. If that fails, install the 3MF SDK first (see lib3mf.org).
error ImportError: cannot import name 'Model' from 'lib3mf'
cause Attempting to import Model as a top-level attribute, but it is nested within the module.
fix
Use 'import lib3mf' and then 'lib3mf.Model'.
breaking Version 2.x uses a completely different API from 1.x. The old functions (e.g., 'createModel', 'loadModel') are removed. You must rewrite code using the new object-oriented API.
fix Refer to official documentation for the 2.x API. Use 'lib3mf.Model()' instead of 'createModel()'.
gotcha The Python package only provides bindings; the actual 3MF library must be installed separately or bundled. On some systems, `pip install lib3mf` may not work without a preinstalled 3MF SDK.
fix Ensure the lib3mf C library is installed (e.g., via system package manager) or use the official binary wheels if available.

Prints the version of the underlying lib3mf C++ library and creates a new empty model.

import lib3mf

wrapper = lib3mf.getLibraryVersion()
print('Version', wrapper.getMajor(), wrapper.getMinor(), wrapper.getMicro(), wrapper.getBuild())

model = lib3mf.Model()
print('Model created')