Skip to main content

API Discovery

Other Blender addons can discover and feature-check the 3MF API without hard-importing it. The addon registers itself in bpy.app.driver_namespace["io_mesh_3mf"] on startup.

Discovery Functions

is_available

def is_available(,
) -> bool

Check if the 3MF API is registered and available.

Returns: bool — True if the API is registered in bpy.app.driver_namespace.

get_api

def get_api(,
)

Get the registered 3MF API module.

has_capability

def has_capability(capability: str,
) -> bool

Check if a specific API capability is available.

ParameterTypeDescription
capabilitystrCapability name (e.g., "paint_mode", "batch").

Returns: bool — True if the capability is supported.

check_version

def check_version(minimum: Tuple[int, int, int],
) -> bool

Check if the API version meets a minimum requirement.

ParameterTypeDescription
minimumTuple[int, int, int]Tuple of (major, minor, patch) minimum version.

Returns: bool — True if API_VERSION >= minimum.

Standalone Discovery Helper

For addons that want zero runtime dependency on the 3MF addon, copy io_mesh_3mf/threemf_discovery.py into your addon. It provides the same discovery functions without importing io_mesh_3mf directly.

# In your addon — no dependency on io_mesh_3mf
from .threemf_discovery import is_available, get_api, has_capability

if is_available():
    api = get_api()
    if has_capability("paint_mode"):
        result = api.export_3mf("output.3mf", use_orca_format="PAINT")

The standalone module re-exports import_3mf, export_3mf, and inspect_3mf as convenience wrappers that return None if the 3MF addon isn't installed.