Dev.to AI πŸ€– Ai πŸ‘ 0 πŸ“– 5 min read

I Applied My AI Image Pipeline to a 3D Printer (and Only Summoned One Cursed Medallion)

Full disclosure up front: I am not a serious programmer. I don't dream in C++, I don't have strong opinions about monads, and if a bash script works on the first try I assume it's a trap. What I do like is wiring tools

I Applied My AI Image Pipeline to a 3D Printer (and Only Summoned One Cursed Medallion)

Full disclosure up front: I am not a serious programmer. I don't dream in C++, I don't have strong opinions about monads, and if a bash script works on the first try I assume it's a trap.

What I do like is wiring tools together so machines do my repetitive choresβ€”and seeing how far a weird side project can take me before something catches fire.

A while back, I built a homelab automation pipeline called RedBobble on my Ubuntu/WSL2 server (claw) connected over Tailscale: generate assets, run them through a local Python pipeline, stage them for a human review gate, and ship the winners. Today I decided to steal my own homework and apply that exact same architecture to a physical Creality Ender-3 V3 KE 3D printer.

The goal? Turn a prompt for a gothic Christmas ornamentβ€”a Baroque Ouija Planchette in Matte PLAβ€”into a flat-backed, zero-support, sliced, and actively printing physical object, orchestrated almost entirely by an AI agent from the terminal.

Spoiler: It worked. It also taught me why you never trust text_to_3d with the word "Ouija."

Waitβ€”Why Reuse the RedBobble Pattern?

With RedBobble, the secret sauce wasn't "let AI do everything blindly." It was decoupling the messy creative stuff from the deterministic engineering stuff, with human-in-the-loop checkpoints in between.

Turns out, 3D printing has the exact same problem:

  1. AI is great at vibes (ornate baroque holly leaves and crescent moons).
  2. AI is terrible at physics (floating hanging loops, upright STLs, and 2 mm serif letters that turn into plastic spaghetti on a 0.4 mm nozzle).
  3. You should never let an LLM silently start a 215Β°C heater without asking you if the build plate is empty first.

So I built meshy_pipe: an isolated workspace on my homelab box that combines MCP servers, custom Agent Skills, Python geometry repair, headless PrusaSlicer, and a rooted Klipper printer.

How the Pipeline Works

Pipeline Diagram

Here is the end-to-end chain we built and ran live today:

  1. 2D Concept Generation β€” Generate a clean, studio-lit 2D relief image first (cheap, fast, easy to iterate).
  2. 3D Sculpting via Meshy MCP β€” Send the approved 2D image to Meshy Pro (image_to_3d, Ultra 4K untextured) via an MCP server tool call.
  3. Human Visual Gate #1 β€” Inspect the 3D sculpt in Meshy Studio before burning time downloading or slicing.
  4. Python Mesh Prep (Custom Agent Skill) β€” Automatically orient the mesh flat on its back, verify watertightness, scale to 90 mm, shave the back flat for zero-support printing, check hanging-loop thickness, and package a native PrusaSlicer 2.9.7 .3mf file with all 11 Matte PLA overrides baked in.
  5. Headless Slicing (PrusaSlicer CLI) β€” Slice .3mf β†’ .gcode directly in WSL2 with zero GUI.
  6. Approval-Gated Printer Dispatch (Moonraker REST API) β€” Upload the .gcode to the printer with print=false, print a pre-flight summary (time, grams, temps), and wait for my explicit approval before firing POST /printer/print/start.

Under the Hood: MCP Servers & Tool Calls

If you've heard the buzzword MCP (Model Context Protocol) and assumed it's basically "an API for AI agents," you're pretty much right. The easiest mental model is USB-C for AI agents.

Instead of writing custom glue code for every model and every service, Meshy publishes a single MCP server (@meshy-ai/meshy-mcp-server). Here is how the pieces actually talk over JSON-RPC 2.0 in my setup:

  • The Host (agy / Google Antigravity): The AI agent I'm chatting with. It decides when to call a tool and throws up confirmation prompts before spending credits or mutating remote state.
  • The Client (built into the host): Reads my local mcp_config.json, spins up the Meshy MCP server locally over stdio (no open network ports!), and asks tools/list to discover what functions exist and what JSON arguments they expect.
  • The MCP Server (@meshy-ai/meshy-mcp-server): A lightweight Node.js wrapper that translates the agent's structured tool calls (meshy_image_to_3d, meshy_download_model, etc.) into real HTTPS requests to Meshy's cloud APIβ€”handling auth, polling, and file downloads cleanly.

The magic combo was pairing MCP with a local Agent Skill (.agents/skills/stl-to-ke-3mf/):

  • MCP gave the agent connectivity to the cloud 3D generator.
  • The Agent Skill gave the agent local domain rules and a deterministic Python engine (scripts/prep_ornament.py using trimesh and manifold3d) so it wasn't guessing how to repair meshes or structure PrusaSlicer XML metadata.

Things That Went Hilariously Wrong (and Made the Pipeline Better)

No real engineering log is complete without the bloopers. Today delivered three classics:

1. The Alphabet Soup Incident

My first 2D-to-3D planchette had YES, NO, and A–Z sculpted onto it. The holly leaves looked amazing; the letters looked like a demon trying to pass a CAPTCHA.

Text-generation not great

2. Never Ask text_to_3d for a "No-Text Ouija Planchette"

"Fine," I thought, "let's test Meshy's text_to_3d tool directly and explicitly tell it no text, no letters, no words."

Meshy ignored the teardrop shape entirely, sculpted a wide baroque medallion with a smug little sun face at the top, added a paper-thin jump ring guaranteed to snap on a 0.4 mm nozzle, and still sneaked faint cursed glyphs underneath the center hole because the word "Ouija" lives rent-free in its weights.

Nothing like what I hoped would come from text-to-image

Pipeline Rule #1 locked in: Always go 2D Concept β†’ image_to_3d. Never let text_to_3d freehand a silhouette when you care about geometry. Once we generated a purely decorative, zero-text 2D planchette, image_to_3d nailed it on the first try.

3. The Haunted Floating Hanging Loop

Our Python script shaved 1.5 mm off the back of the ornament to make it print flat with zero supports. The automated checks passedβ€”until I opened the .3mf in PrusaSlicer and zoomed in on the side view.

The main body sat dead flat on the bed. The hanging loop was levitating about 0.8 mm in mid-air.

Dead... flat.

Rather than manually cutting it in the slicer every time, I had the agent upgrade scripts/prep_ornament.py to:

  1. Inspect the hanging-loop region separately from the body junction.
  2. Auto-extend the planar cut (it added +0.53 mm automatically) until both the loop gap and any rounded underside bevel hit overhang = 0.0 mmΒ².
  3. Add a pytest unit test specifically for raised/floating loops so it can never regress.

One re-run later: 759,596 watertight triangles, 91.58 mmΒ² of flat loop bed contact, and a razor-flat Layer 1.

Rooting the Printer & Closing the Loop

At this point I had a valid .3mf on my WSL2 server, and I realized I was still manually copying files to my laptop like a caveman.

So I enabled root access on my Ender-3 V3 KE, ran Guilouz's Creality Helper Script to install Moonraker + Fluidd (which took 5 minutes and kept my existing bed mesh and calibration intact!), and extracted PrusaSlicer 2.9.7's Linux AppImage into WSL2 using --appimage-extract so it runs headlessly without FUSE or X11.

Then we wired up scripts/slice_and_send.py with a strict two-stage safety contract:


bash
# Stage 1 (Default): Slice headlessly, print pre-flight stats, upload with print=false
.venv/bin/python scripts/slice_and_send.py output/baroque_planchette_ke.3mf

# Stage 2 (Explicit human approval only): Verify printer is idle, then start print
.venv/bin/python scripts/slice_and_send.py --start-file baroque_planchette_ke.gcode
πŸ“° Read the original article on Dev.to AI

Originally published by Dev.to AI. Aggregated on AIWithGhost for educational purposes β€” full credit and traffic to the original publisher.