Skill 详情
wireframe-to-3d
Specialized orthographic wireframe-to-model conversion.
使用前先检查
自动化审核只检查相关性,不代表安全审查或推荐。使用前请阅读来源中的说明。
SKILL.md
这段内容是审核时保存的快照。外部来源才是完整且最新的版本。
---
name: wireframe-to-3d
description: Convert 2D orthographic wireframe PNG drawings to 3D Blender models exported as glTF/GLB. Use this skill whenever the user provides wireframe images (technical drawings, line drawings, orthographic views, side/front/back panels) and wants to generate a 3D model, mesh, or .glb file. Triggers on phrases like "convert this wireframe to 3D", "make a 3D model from these drawings", "build a model from this wireframe", "generate GLB from these views", or any image-to-3D-mesh request involving line drawings. Make sure to use this skill even if the user does not explicitly say "wireframe" — also covers "orthographic views", "technical drawings", "line drawings of objects", "front and side views". Requires the Blender MCP addon to be running (port 9876) and Python with opencv-python, numpy, scipy installed.
when_to_use: User provides one or more PNG wireframe images and wants a 3D model. Also use when user asks to model an object from front/side/back drawings, or to convert technical line art to glTF/GLB.
allowed-tools: Read Bash Glob Grep mcp__blender__execute_blender_code mcp__blender__get_scene_info mcp__blender__get_object_info mcp__blender__get_viewport_screenshot
---
# Wireframe-to-3D Conversion
Convert 2D orthographic wireframe images to parametric 3D Blender models, exported as glTF 2.0 binary (`.glb`).
## Overview
The skill drives a four-stage pipeline:
1. **Analyze** wireframe images locally with `scripts/wireframe_analyzer.py` (OpenCV → Bezier control points in JSON).
2. **Generate** Blender Python code that recreates the contours as parametric Bezier curves.
3. **Execute** code in Blender via `mcp__blender__execute_blender_code`, converting curves to meshes with PBR materials.
4. **Export** as optimized GLB (≤ 15 MB), validating size and topology.
You (Claude) are the orchestrator. The `scripts/` directory contains the only standalone code (`wireframe_analyzer.py`); everything else is patterns you emit and run via MCP.
## Prerequisites — check first
Before any wireframe work, verify the environment:
1. **Blender MCP is reachable**. Call `mcp__blender__get_scene_info`. If it errors with "Could not connect to Blender", stop and tell the user:
> "Blender's MCP addon isn't running. Start Blender, enable the BlenderMCP addon (port 9876), then re-run."
2. **Python deps for the analyzer**. Run:
```
python3 -c "import cv2, numpy, scipy" 2>&1
```
If it errors, run `pip install opencv-python numpy scipy Pillow` (or instruct the user to).
3. **Image input**. Confirm the user provided at least one PNG. Reasonable bounds: ≥ 400×400 px, black-on-white or white-on-black line art.
## Decision flow
### Q1: How many views?
- **Single view** → flat 2D extrusion only (warn the user; depth must be supplied or assumed).
- **Front + side** → full 3D reconstruction (silhouette × depth profile).
- **Front + side + back** → use back view for symmetry validation.
### Q2: Detail level?
- **`preview`** — RDP epsilon = 4.0, target ~1–2k tris, < 1 MB GLB.
- **`production`** — RDP epsilon = 2.0, target ~5–8k tris, 2–4 MB GLB. **Default.**
- **`high`** — RDP epsilon = 1.0, target ~10–20k tris, may need Decimate to stay under 15 MB.
### Q3: Geometry type?
- **`wires`** — frames, arms, hinges. Use `bevel_depth` on curves.
- **`surfaces`** — lenses, domes. Use lofted profiles or fill caps.
- **`hybrid`** — both. **Default for glasses-like objects.**
### Q4: Real-world scale?
- If the user gave dimensions (e.g., "glasses are 140 mm wide"), use them.
- Otherwise infer from wireframe aspect ratio and assume a sensible default (140 mm width for glasses, 180 mm for helmets, etc.). Confirm with user if not obvious.
## Stage 1 — Run the analyzer
Run the bundled analyzer once per view:
```bash
python3 ${CLAUDE_SKILL_DIR}/scripts/wireframe_analyzer.py <input.png> <output.json>
```
The script outputs JSON with this shape:
```json
{
"metadata": {"image_size": [W, H], "num_contours": N, "parameters在 GitHub 阅读完整来源 (打开外部页面)