# ⚡ `bambu-3mf-cli`
> An ultra-fast Bambu Studio & Orca Slicer `.3mf` inspection tool, thumbnail extractor, and microservice powered by **[Ferrox Framework](https://ferrox-rust.dev/)** in Rust.
---
## 🌟 Features
- ⏱️ **Ultra-Fast 3MF Parsing:** Parse Bambu Studio & Orca Slicer `.3mf` file metadata in milliseconds using Rust's in-memory zip decompression & XML extraction.
- ⚖️ **Filament & AMS Tracking:** Extract per-plate print times, total weights, and per-slot AMS filament details (materials, colors, meters, grams).
- 💵 **Cost Estimation:** Instantly calculate estimated print material cost based on customizable filament price per kg.
- 🖼️ **Thumbnail Extraction:** Extract high-resolution plate thumbnail PNGs directly from `.3mf` archives.
- 🌐 **Ferrox Framework API Server:** Spin up a lightweight HTTP microservice (`bambu-3mf serve`) powered by `ferrox-app` and `ferrox-transports` for remote file analysis via REST API (`POST /api/v1/analyze`).
---
## 🚀 Installation & Usage
### 🛠️ Build from Source
```bash
cargo build --release
```
### 🔍 1. Inspect a `.3mf` File (CLI)
```bash
bambu-3mf inspect path/to/model.3mf --filament-cost-per-kg 25.0
```
#### JSON Output (for scripts / farm automation):
```bash
bambu-3mf inspect path/to/model.3mf --json
```
### 🖼️ 2. Extract Thumbnails
```bash
bambu-3mf extract-thumbnails path/to/model.3mf --output ./thumbnails
```
### 🌐 3. Launch Ferrox Framework API Microservice
```bash
bambu-3mf serve --port 3000
```
#### API Endpoints:
- `GET /api/v1/health` - Check Ferrox server status
- `POST /api/v1/analyze` - Multipart `.3mf` file upload for instant JSON analysis
```bash
curl -F "file=@model.3mf" http://localhost:3000/api/v1/analyze
```
---
## 📜 License
Dual-licensed under `MIT` OR `Apache-2.0`. Created with ❤️ for the Bambu Lab 3D Printing & Rust Community by **AI-Autistic-Intelligence**.