Skip to content

Archat

Archat is an AI tool that automatically generates Grasshopper node graphs from a single natural language sentence.

Core trick

Gemini emits node() and wire() calls that an AST whitelist validator checks before executing them into a Grasshopper canvas.

Tags

Description

Archat is an AI tool that automatically generates Grasshopper node graphs from a single natural language sentence. Core idea: User types a natural language prompt like "make a cube with pentagonal roofs on its four sides" Gemini AI generates DSL code consisting solely of node() / wire() function calls The script extracts the code block from Gemini's response → validates safety via AST → executes in a sandbox Nodes and wires are automatically placed on the Grasshopper canvas Supports Archicad components (Wall, Slab, Column) as well Technical highlights: AST-based whitelist validation completely blocks arbitrary code execution Chatbot UI (Eto.Forms) runs directly from Rhino ScriptEditor Also available as a GhPython component running inside Grasshopper itself No external library dependencies — standard library only
seeewd/hackathon★ 00 forksPythonCreated Feb 28, 2026 · last push Feb 28, 2026

README excerpt

# GH Gemini Node Builder — 자연어로 Grasshopper 노드를 자동 생성

> **해커톤 제출작** | Rhino 8 + Grasshopper + Archicad + Google Gemini

---

## 프로젝트 한 줄 요약

한국어 자연어 프롬프트를 입력하면, Gemini AI가 Grasshopper 노드 배치 코드를 생성하고, 이를 즉시 실행해 Grasshopper 캔버스에 노드와 와이어를 자동으로 생성하는 도구입니다.

---

## 문제 의식

Grasshopper는 건축·제품 설계에 강력한 파라메트릭 모델링 환경이지만, **노드를 하나씩 찾아 연결하는 과정은 전문가에게도 반복적이고 진입 장벽이 높습니다.** 특히 Archicad 연동 컴포넌트는 적절한 포트 연결 방법을 모르면 사용하기 어렵습니다.

이 프로젝트는 "**자연어 한 문장 → 노드 그래프 자동 완성**"을 목표로, 비전문가도 Grasshopper를 사용할 수 있도록 AI가 노드 배치를 대신해 줍니다.

---

## 핵심 기능

| 기능 | 설명 |
|------|------|
| 자연어 → 노드 생성 | 한국어/영어 프롬프트 → Gemini → Grasshopper 노드 자동 배치 |
| DSL 코드 추출 | Gemini 응답에서 `node()` / `wire()` 코드블록만 안전하게 추출 |
| AST 기반 보안 검증 | 허용된 함수 호출만 실행, 임의 코드 주입 차단 |
| 실행 실패 시 롤백 | 노드 생성 중 오류 발생 시 생성된 객체 전체 자동 제거 |
| 챗봇 UI | Rhino 내 Eto 기반 챗봇 창으로 대화형 사용 가능 |
| GhPython 컴포넌트 | Grasshopper 캔버스 안에서 직접 실행하는 컴포넌트 모드 |
| Archicad 호환 | Wall, Slab, Column 등 Archicad 컴포넌트 자동 탐색 및 배치 |

---

## 동작 흐름

```
사용자 입력 (자연어)
        ↓
Gemini API 호출 (systemInstruction + user prompt)
        ↓
응답 텍스트에서 python 코드블록 추출
        ↓
AST 검증 (node / wire 호출만 허용)
        ↓
샌드박스 exec() 실행
        ↓
Grasshopper 캔버스에 노드 + 와이어 생성
        ↓
Archicad로 데이터 전달 (선택)
```

---

## 사용 방법

### A. 챗봇 창 모드 (권장)

1. Rhino 8에서 ScriptEditor 열기
2. `scripts/rhino_gh_chatbot_window.py` 실행
3. Gemini API 키 입력
4. 프롬프트 입력 예시:
   - `"정육면체 하나와 그 네 면에 올라가는 오각형 지붕을 만들어줘"`
   - `"Curve를 Archicad Wall에 연결하는 노드를 만들어줘"`
5. `Generate Nodes` 클릭 → Grasshopper 캔버스에 자동 생성

### B. GhPython 컴포넌트 

Team