展示HN:为你的3D模型编写Vibe代码
Show HN: Vibe Code your 3D Models

原始链接: https://github.com/ierror/synaps-cad

## SynapsCAD:AI驱动的3D建模 SynapsCAD 是一款桌面应用程序,结合了 OpenSCAD 代码编辑器、实时 3D 视口和集成的 AI 助手。用户编写 OpenSCAD 代码创建 3D 模型,立即可视化,然后利用自然语言修改设计——甚至可以直接与 3D 视图交互来指导更改。 目前 SynapsCAD 仍处于早期原型阶段,支持 Linux、macOS 和 Windows。它完全使用 Rust 构建,并利用 Anthropic、OpenAI 和 Gemini 等 AI 提供商(或通过 Ollama 使用本地模型进行离线使用,需要云服务的 API 密钥)。 该应用程序具有用于编码和 AI 聊天的侧边栏,并采用响应式系统,后台任务(如编译和 AI 请求)不会冻结视口。主要功能包括网格拾取、Blender 风格的相机控制以及 3MF、STL 和 OBJ 格式的导出选项。 欢迎提交错误报告,因为该项目正在积极开发中。

## SynapsCAD:基于AI的OpenSCAD 3D建模 一款名为SynapsCAD的新开源桌面应用程序,允许用户使用OpenSCAD编写3D模型,并借助AI辅助功能。SynapsCAD使用Rust构建,UI采用Bevy和egui,具有实时3D视口,并允许用户通过自然语言提示(使用OpenAI或Gemini等LLM)修改代码。 该项目拥有纯Rust编译流程,避免了外部依赖。目前仍为原型,OpenSCAD兼容性存在限制,开发者正在寻求反馈,特别是关于编译器的问题。 一位评论员指出OpenSCAD在专业用途上的局限性,建议专注于生成STEP和Brep等行业标准格式将是一个重要的进步。他还思考了AI在重建Open Cascade等CAD内核方面的潜力。 项目和下载地址在GitHub上:[https://github.com/ierror/synaps-cad](https://github.com/ierror/synaps-cad)
相关文章

原文

SynapsCAD

The AI-powered 3D CAD IDE — edit code, visualize in 3D, and reshape your designs with natural language.

Vibe Code your 3D models!


⚠️ Early Prototype — Not all OpenSCAD code will compile correctly yet. Start with simple models and expect rough edges. Bug reports with code snippets that cause issues are very welcome!

SynapsCAD Screenshot

▶ See it in action

A desktop 3D CAD application that combines an OpenSCAD code editor, a real-time 3D viewport, and an AI assistant. Write OpenSCAD code, compile it to 3D models, visualize them interactively, and use AI to modify your designs through natural language — including context from 3D click interactions.

Pre-built binaries for Linux, macOS (Apple Silicon & Intel), and Windows are available on the Releases page.

macOS users: Since SynapsCAD is not signed with an Apple Developer certificate, macOS will block the app on first launch. To fix this, run:

sudo xattr -rd com.apple.quarantine /path/to/SynapsCAD.app

We don't pay for an Apple Developer account at this point — if you prefer, you can always build from source instead.

  • Rust (stable toolchain)
  • An AI provider API key (e.g. ANTHROPIC_API_KEY) for the chat assistant

SynapsCAD uses the genai crate to connect to AI providers — including local models via Ollama for fully offline, private usage (no API key needed). Set the API key for your chosen cloud provider as an environment variable:

Provider Environment Variable
Anthropic ANTHROPIC_API_KEY
OpenAI OPENAI_API_KEY
Gemini GEMINI_API_KEY
Groq GROQ_API_KEY
DeepSeek DEEPSEEK_API_KEY
Cohere COHERE_API_KEY
Fireworks FIREWORKS_API_KEY
Together TOGETHER_API_KEY
xAI XAI_API_KEY
ZAI ZAI_API_KEY
Ollama (no key needed)
export ANTHROPIC_API_KEY="sk-..."
cargo run

When an env var is set, the UI shows it as active. You can also enter or override the key in ⚙ AI Settings within the app.

This opens a window with a 3D viewport on the right and a side panel on the left containing the code editor and AI chat.

  1. Write or edit OpenSCAD code in the editor panel
  2. Click Compile — SynapsCAD parses and evaluates the code using scad-rs and renders CSG geometry via csgrs
  3. Ask the AI assistant to modify your model — it sees your current code and part labels, and can update the code automatically

SynapsCAD is a single-binary Rust application built on three main pillars:

Layer Technology Role
Rendering & ECS Bevy 0.15 3D viewport, entity management, frame loop
UI bevy_egui (egui 0.31) Side panel with code editor and chat interface
OpenSCAD parsing openscad-rs Lossless, resilient OpenSCAD parser
CSG rendering csgrs Constructive solid geometry — boolean ops, primitives, mesh output
Export lib3mf 3MF export with per-part colors; STL and OBJ exported natively
AI genai Unified client for OpenAI / Anthropic / Gemini APIs
Async Tokio Background runtime for AI network calls
  • Bevy owns the main thread. The Bevy app loop drives rendering and ECS systems. A separate Tokio runtime is stored as a Bevy Resource and used only for spawning async AI tasks.

  • std::sync::mpsc bridges async to sync. Background tasks (compilation, AI streaming) send results through channels. Bevy systems poll with non-blocking try_recv() each frame, keeping the viewport responsive.

  • Pure-Rust compilation pipeline. OpenSCAD code is parsed by scad-syntax, evaluated by a built-in AST walker, and rendered to triangle meshes via csgrs — no external tools or WASM required.

  • Built-in mesh picking. Bevy 0.15's MeshPickingPlugin provides ray-cast picking via the observer pattern — no external picking crate needed.

ui_layout_system          — render egui side panel (editor + chat)
    ↓
trigger_compilation_system — if code is dirty, spawn compilation in a thread
    ↓
poll_compilation_system    — check if compilation finished, load mesh
    ↓
ai_send_system             — if chat submitted, spawn AI request on tokio
    ↓
ai_receive_system          — poll AI response, update chat + code
    ↓
adjust_camera_viewport     — resize 3D viewport to account for side panel
    ↓
orbit_camera_system        — process mouse/keyboard input for 3D navigation
    ↓
zoom_to_fit_system         — auto-frame model after compilation
Action Key
Toggle gizmos G
Toggle labels L
Keyboard shortcuts ?

SynapsCAD uses Blender-style camera controls:

Action Control
Orbit Middle mouse button drag or Right mouse button drag
Pan Shift + Middle mouse button drag
Zoom Scroll wheel, +/- keys
Move focus W/A/S/D or Arrow keys
Front view 1
Back view 2
Right view 3
Left view 4
Top view 5
Bottom view 6
Isometric 7

@[email protected]

GPL v3

联系我们 contact @ memedata.com