three-3mf-exporter
TypeScript icon, indicating that this package has built-in type declarations

0.0.4 • Public • Published

Three.js 3MF Exporter

Export 3D models to 3MF format in Three.js

npm docs sponsors

While developing Bekuto3D, I discovered that Three.js lacked support for the 3MF format, which is essential for modern 3D printing workflows. Unlike STL, 3MF supports colors, materials, and print settings metadata. This exporter bridges the gap between web development and 3D printing, making it easier for Three.js developers to create 3D printable models with rich features.

Features

  • Export Three.js models to 3MF format
  • BambuStudio compatible
  • Support for multiple materials and colors
  • Automatic model centering on print bed
  • Customizable print settings
  • Preserves model names and hierarchy

Usage

Basic usage

import { exportTo3MF } from 'three-3mf-exporter'

// Parse the three.js object and generate the 3MF encoded output
const blob = await exportTo3MF(mesh)

// Download the file
const url = URL.createObjectURL(blob)
const link = document.createElement('a')
link.href = url

With custom print settings (BambuStudio compatible)

const blob = await exportTo3MF(meshOrGroup, {
  printer_name: 'Bambu Lab A1',
  filament: 'Bambu PLA Basic @BBL A1',
  printableWidth: 256,
  printableDepth: 256,
  printableHeight: 256,
  printerSettingsId: 'Bambu Lab A1 0.4 nozzle',
  printSettingsId: '0.20mm Standard @BBL A1',
})

// Download the file
const url = URL.createObjectURL(blob)
const link = document.createElement('a')
link.href = url

Sponsors

This project is made possible by all the sponsors supporting my work
You can join them at my sponsors profile:

Why 3MF?

The 3MF format offers significant advantages over alternatives like STL for 3D printing:

  • Color & Material Support: Export models with multiple colors and materials
  • Print Settings: Embed printer-specific configurations directly in the file
  • Modern Standard: An open, industry-supported format designed specifically for 3D printing
  • Slicer Compatibility: Works directly with popular slicers like BambuStudio without conversion

This exporter was created to enable web developers to easily bridge the gap between Three.js projects and physical 3D printing.

Dependencies (2)

Dev Dependencies (0)

    Package Sidebar

    Install

    npm i three-3mf-exporter

    Weekly Downloads

    54

    Version

    0.0.4

    License

    MIT

    Unpacked Size

    18.8 kB

    Total Files

    6

    Last publish

    Collaborators

    • oikawa_rizumu