- Home
- Plugins
- UI Enhancements
- 3d-magic-house
3d-magic-house
kmeng/3d-magic-house
A left-sidebar workshop for a child with a Bambu Lab P2S: spin or pick a print idea, size it in a hand-written 3D view of the 256 mm build volume, move it along an idea-to-done board with a six-item checklist, read LAN print progress and temperatures (read-only), and collect a star per finished print. The magic_house agent tool reads and updates the same board.
Install
dsh plugin --profile web add github:kmeng/3d-magic-houseREADME
3D dream foundry · 3D造梦工场
A five-step 3D-printing workshop for a child, as a DeepSeek Harness plugin. It lives in the left sidebar and walks a kid from "what should I make" to "look, it's done, I got a star" on a Bambu Lab P2S.

⚠️ The panel is a workshop, not a slicer. It never slices, never starts a print, and never talks to Bambu's cloud.
Jumpy, the pet
Jumpy (跳跳) is a red panda cub with a turquoise neckerchief. It tilts its head when idle, kicks to the beat during a print, curls around its striped tail when paused, lowers its ears on error, and claps to celebrate a finished print. Tap it to see it touch a paw to its cheek or use Bigger / Smaller to see it at 1.75×.
The printer speed controls the dance tempo. The idle head turn, dancing kick and celebratory clap each play a sequence of twelve drawings registered to the same ground line.
Under the pet, a rhythm strip makes the link visible: the beat pips march on every beat that moves the body, a bar fills with the printer's speed mode, and the live rate reads N Hz.
There is no accelerometer involved — macOS exposes none to a browser page — so the shake is derived from the printer's own telemetry (state, progress, layer changes) rather than the desk's actual vibration. Motion respects prefers-reduced-motion.
AI modelling, colours, materials, STL
Pressing 让 AI 帮我建模 on an idea card (or the idea wheel) no longer leaves the panel. It creates the project, opens Design and asks the host to model the idea:
- The host accepts bounded JSON parameters or up to four constructive solid geometry operations. Keychains, cups, and shades use fixed templates that calculate hole placement, wall thickness, and floor thickness. A failed model response falls back to a local template or an editable base shape, with its source shown in the panel.
- The geometry engine evaluates union and subtraction, then checks for a single closed solid seated on the bed and inside the 256 mm build volume. The preview and binary STL use the same evaluated surface. If an older design fails validation, it remains available to regenerate.
- Colours and material stay with the project. Binary STL carries the geometry. Both AI designs and manually sized shapes can be exported for slicing in Bambu Studio.

Five pages, one job each
The panel is split the way slicers and printer hosts split their work — Bambu Studio puts setup, preview and monitoring on separate tabs, OctoPrint gives state, files and temperature their own pages. Here each tab is one step of the flow, the tab still needing work is marked, and the last page is remembered.
| Page | What actually happens |
|---|---|
| Overview | Dashboard: the project in progress, a live progress ring with nozzle/bed readouts, the next step to take, and the finished prints with the star total. |
| Ideas | Spin a wheel of subject × job × limit (dinosaur / it must glow / smaller than a hand), or pick one of ten curated kid-sized projects, filterable by difficulty. Every card carries rough time, rough grams, three steps and a suggested shape and size — pressing Start this one creates the project, makes it the current one and opens Design with that size already seeded. |
| Design | A hand-written 3D view, framed on the model and expandable to most of the window. Drag to rotate, scroll to zoom, choose box / cylinder / sphere / cone / ring, set length × width × height; volume, a solid-PLA weight guess and an oversized warning update live, and Use this size stores it on the project. When the current project came from an idea card, the card's three steps sit above the viewport. While a job runs, the printed height is drawn as a glowing plane. |
| Projects | The board: idea → design → printing → done, one click per stage, Done earning a star. Plus the six-item pre-print checklist and four safety rules. |
| Printer | LAN address + serial + access code, then a read-only device console: progress ring, remaining minutes, layer count, nozzle / bed / chamber temperatures and the job name. |
Anything in step 1 or 2 can be handed to a conversation with one click: the prompt is built from the card or from the exact 3D dimensions, so the model starts from "256 × 256 × 256 mm, 0.4 mm nozzle, PLA" instead of guessing.

Install
The plugin needs no build step. Before adding a source checkout, run npm ci from its root to install the host-side Manifold geometry engine.
From the app: Plugins → Add plugin → pick this directory. The entry appears in the left sidebar as Dream foundry / 3D造梦工场.
From npm: the same package is published as dsh-3d-magic-house — add that package name the same way.
A saved printer configuration reconnects on the next start.
Connect the printer (LAN only)
On the printer screen: Settings → Network → LAN Only mode. Note the IP and serial number on that page, tap Access Code and copy the code. Enter all three in step 4.
- Transport: MQTT over TLS on port 8883, user
bblp, topicdevice/<serial>/report. - The only thing ever published is one
pushallstatus request. There is no code path that starts, pauses, cancels or rewrites a print. - Firmware newer than early 2025 may reject unsigned commands; status pushes usually still arrive. If nothing arrives, enable Developer mode too.
- The access code is stored in plain text in
data/printer.jsonwith0600permissions. It is never returned by a route and never printed by a tool. Delete the file to forget it.
Privacy
- The panel talks only to the printer on your own network, and to the plugin's own host routes.
- No Bambu account, no cloud, no third-party request, no telemetry.
- The 3D view renders with a few hundred lines of JavaScript on a 2D canvas: no three.js, no CDN, no network.
Data
| File | Contents |
|---|---|
data/ideas.json | Shipped idea cards and the spin word lists (edit freely). |
data/state.json | The board: projects, stages, stars, checklist, the project in progress. Created at runtime, git-ignored. |
data/printer.json | LAN address, serial, access code (0600). Created at runtime, git-ignored. |
Both are plain JSON. Back them up or edit them by hand.
The agent side
The host half registers the magic_house tool:
read · ideas · printer · add · status · remove
So a child can ask "打到哪了" (how far along is it) or say "帮我把今天的乌龟存钱罐记下来" (remember today's turtle bank), and the panel reflects the same board. The printer address and access code are only ever entered in the panel — they are deliberately not parameters of the tool.
Layout
index.js host: same-origin routes + the magic_house tool + JSON storage
lib/design.js AI generation, plan validation and fallback
lib/design-templates.js functional templates and dimensional constraints
lib/geometry.js solid boolean operations, validation and mesh evaluation
lib/mqtt-lite.js dependency-free MQTT 3.1.1 client (TLS, subscribe, keepalive, reconnect)
lib/printer-link.js printer config, connection lifecycle, report merging
client.js sidebar entry + five pages + the 3D renderer (plain JS, only `react`)
data/ideas.json idea cards and spin words
locale/{en,zh}.json Plugin Manager title and description
icon.svg plugin icon
docs/ the preview images above
test/ the checks below: `npm test`
The page screenshots in this README are rendered from the panel's own components and stylesheet in a headless browser; the data in them is a fixture, not a live printer.
Tests
npm test
The checks cover MQTT, printer connection, model responses and fallbacks, solid geometry, and the panel. Geometry tests cover closed spheres, ring dimensions, unions, through-holes, and the cup cavity and floor. The panel checks the exported STL for open edges. Sample keychain, cup, and shade models have also been sliced offline with a 0.4 mm nozzle and 0.2 mm layers.
The suite simulates the printer so it runs anywhere. Separately, the transport and the link have been run against a real P2S in LAN-only mode and read live progress, layer counts, nozzle/bed temperatures and the job name — so the protocol fields below are not guesses.
Notes for contributors
- One
connection.fetch.registerper path. A second registration for the same path throws, and that throw also disposes the effect that owns the first — the panel then gets a plain-textnot foundand shows a JSON error. - Use
requestBody: 'buffered'. A streamed GET body is not a validRequest. socket.setTimeoutis an inactivity timeout, not a handshake deadline: use a one-shot timer cleared on CONNACK, or an idle-but-healthy connection dies between reports.- Printer reports can arrive as several JSON documents back to back (sometimes NUL-separated, because one MQTT message caps at 16 KB). Split by brace balance, ignoring braces inside strings.
License
MIT. See LICENSE.
Related plugins
dsh-web (dsh-task-board)
zhu1090093659/dsh-web
dsh-web (dsh-web-all)
zhu1090093659/dsh-web
dsh-TUI
ccch1mneyyy/dsh-tui
dsh-web-ui (dsh-task-board)
zhu1090093659/dsh-web-ui