# chisomobanzi/serpentine3d architecture

> Architecture diagram of the GitHub repository chisomobanzi/serpentine3d, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-10-15). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/chisomobanzi/serpentine3d
- Repository: https://github.com/chisomobanzi/serpentine3d

## Overview

Serpentine3D is a desktop NURBS modeller whose main workflow is to create or edit a model through commands and viewport interactions, then inspect it, prepare drawing sheets, and export it. The graph also includes file exchange, scripting and MCP control, and the AI assistant. Some subsystem links are based on README descriptions or SOURCE INDEX references; unsampled implementations are represented only at their supported directory paths.

Main entry points: [`serpentine3d/app.py`](https://github.com/chisomobanzi/serpentine3d/blob/main/serpentine3d/app.py) (Desktop app), [`serpentine3d/ui/viewport.py`](https://github.com/chisomobanzi/serpentine3d/blob/main/serpentine3d/ui/viewport.py) (3D viewport), [`serpentine3d/commands/base.py`](https://github.com/chisomobanzi/serpentine3d/blob/main/serpentine3d/commands/base.py) (Command processor), [`serpentine3d/ai/agent.py`](https://github.com/chisomobanzi/serpentine3d/blob/main/serpentine3d/ai/agent.py) (AI assistant)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_app["Application"]
  node_app["Desktop app<br/>[app.py]"]
  node_viewport["3D viewport<br/>[viewport.py]"]
end

subgraph group_model["Modeling"]
  node_commands["Command processor<br/>[base.py]"]
  node_geometry["Exact geometry<br/>[geometry.py]"]
  node_scene["Scene state<br/>[scene.py]"]
  node_selection["Selection and snaps<br/>[selection.py]"]
  node_gumball["Direct manipulator<br/>[gumball.py]"]
  node_mesh["Mesh objects<br/>[mesh.py]"]
  node_printcheck["Build checks<br/>[printcheck.py]"]
end

subgraph group_draw["Drawings and exchange"]
  node_layouts["Sheet layouts<br/>[layout.py]"]
  node_layoutview["Sheet view<br/>[layout_view.py]"]
  node_fileio["File exchange"]
end

subgraph group_automation["Automation"]
  node_api["Python API<br/>[api.py]"]
  node_scripting["Scripts and batch<br/>[script_runtime.py]"]
  node_mcp["MCP server<br/>[server.py]"]
end

subgraph group_assistant["Assistant"]
  node_assistant["AI assistant<br/>[agent.py]"]
  node_ai_clients["Model providers"]
end

node_user(("Designer"))
node_provider{{"AI provider"}}

node_user -->|"uses"| node_app
node_app -->|"hosts"| node_viewport
node_user -->|"enters commands"| node_commands
node_app -->|"registers"| node_commands
node_commands -->|"builds shapes"| node_geometry
node_commands -.->|"adds objects"| node_scene
node_viewport -.->|"displays"| node_scene
node_viewport -.->|"picks objects"| node_selection
node_viewport -->|"hosts manipulator"| node_gumball
node_gumball -->|"edits shapes"| node_geometry
node_geometry -->|"supports meshes"| node_mesh
node_user -->|"creates sheets"| node_layouts
node_layouts -->|"projects model views"| node_geometry
node_layoutview -->|"renders sheets"| node_layouts
node_app -->|"hosts"| node_layoutview
node_user -->|"imports and exports"| node_fileio
node_api -->|"exchanges files"| node_fileio
node_user -->|"runs scripts"| node_scripting
node_scripting -.->|"drives model"| node_api
node_user -->|"connects client"| node_mcp
node_mcp -->|"drives live session"| node_app
node_user -->|"requests changes"| node_assistant
node_assistant -->|"runs commands"| node_commands
node_assistant -->|"checks viewport"| node_viewport
node_assistant -.->|"uses provider client"| node_ai_clients
node_ai_clients -->|"streams requests"| node_provider
node_user -->|"checks model"| node_printcheck

click node_app "https://github.com/chisomobanzi/serpentine3d/blob/main/serpentine3d/app.py"
click node_viewport "https://github.com/chisomobanzi/serpentine3d/blob/main/serpentine3d/ui/viewport.py"
click node_commands "https://github.com/chisomobanzi/serpentine3d/blob/main/serpentine3d/commands/base.py"
click node_geometry "https://github.com/chisomobanzi/serpentine3d/blob/main/serpentine3d/core/geometry.py"
click node_scene "https://github.com/chisomobanzi/serpentine3d/blob/main/serpentine3d/core/scene.py"
click node_selection "https://github.com/chisomobanzi/serpentine3d/blob/main/serpentine3d/core/selection.py"
click node_gumball "https://github.com/chisomobanzi/serpentine3d/blob/main/serpentine3d/ui/gumball.py"
click node_mesh "https://github.com/chisomobanzi/serpentine3d/blob/main/serpentine3d/core/mesh.py"
click node_layouts "https://github.com/chisomobanzi/serpentine3d/blob/main/serpentine3d/core/layout.py"
click node_layoutview "https://github.com/chisomobanzi/serpentine3d/blob/main/serpentine3d/ui/layout_view.py"
click node_fileio "https://github.com/chisomobanzi/serpentine3d/tree/main/serpentine3d/fileio"
click node_api "https://github.com/chisomobanzi/serpentine3d/blob/main/serpentine3d/api.py"
click node_scripting "https://github.com/chisomobanzi/serpentine3d/blob/main/serpentine3d/script_runtime.py"
click node_mcp "https://github.com/chisomobanzi/serpentine3d/blob/main/serpentine3d/mcp_server/server.py"
click node_assistant "https://github.com/chisomobanzi/serpentine3d/blob/main/serpentine3d/ai/agent.py"
click node_ai_clients "https://github.com/chisomobanzi/serpentine3d/tree/main/serpentine3d/ai"
click node_printcheck "https://github.com/chisomobanzi/serpentine3d/blob/main/serpentine3d/core/printcheck.py"

classDef toneNeutral fill:#f8fafc,stroke:#334155,stroke-width:1.5px,color:#0f172a
classDef toneBlue fill:#dbeafe,stroke:#2563eb,stroke-width:1.5px,color:#172554
classDef toneAmber fill:#fef3c7,stroke:#d97706,stroke-width:1.5px,color:#78350f
classDef toneMint fill:#dcfce7,stroke:#16a34a,stroke-width:1.5px,color:#14532d
classDef toneRose fill:#ffe4e6,stroke:#e11d48,stroke-width:1.5px,color:#881337
classDef toneIndigo fill:#e0e7ff,stroke:#4f46e5,stroke-width:1.5px,color:#312e81
classDef toneTeal fill:#ccfbf1,stroke:#0f766e,stroke-width:1.5px,color:#134e4a
class node_app,node_viewport toneBlue
class node_commands,node_geometry,node_scene,node_selection,node_gumball,node_mesh,node_printcheck toneAmber
class node_layouts,node_layoutview,node_fileio toneMint
class node_api,node_scripting,node_mcp toneRose
class node_assistant,node_ai_clients,node_user,node_provider toneIndigo
```

## Components

### Application

- [Desktop app](https://github.com/chisomobanzi/serpentine3d/blob/main/serpentine3d/app.py): `serpentine3d/app.py`
- [3D viewport](https://github.com/chisomobanzi/serpentine3d/blob/main/serpentine3d/ui/viewport.py): `serpentine3d/ui/viewport.py`

### Modeling

- [Command processor](https://github.com/chisomobanzi/serpentine3d/blob/main/serpentine3d/commands/base.py): `serpentine3d/commands/base.py`
- [Exact geometry](https://github.com/chisomobanzi/serpentine3d/blob/main/serpentine3d/core/geometry.py): `serpentine3d/core/geometry.py`
- [Scene state](https://github.com/chisomobanzi/serpentine3d/blob/main/serpentine3d/core/scene.py): `serpentine3d/core/scene.py`
- [Selection and snaps](https://github.com/chisomobanzi/serpentine3d/blob/main/serpentine3d/core/selection.py): `serpentine3d/core/selection.py`
- [Direct manipulator](https://github.com/chisomobanzi/serpentine3d/blob/main/serpentine3d/ui/gumball.py): `serpentine3d/ui/gumball.py`
- [Mesh objects](https://github.com/chisomobanzi/serpentine3d/blob/main/serpentine3d/core/mesh.py): `serpentine3d/core/mesh.py`
- [Build checks](https://github.com/chisomobanzi/serpentine3d/blob/main/serpentine3d/core/printcheck.py): `serpentine3d/core/printcheck.py`

### Drawings and exchange

- [Sheet layouts](https://github.com/chisomobanzi/serpentine3d/blob/main/serpentine3d/core/layout.py): `serpentine3d/core/layout.py`
- [Sheet view](https://github.com/chisomobanzi/serpentine3d/blob/main/serpentine3d/ui/layout_view.py): `serpentine3d/ui/layout_view.py`
- [File exchange](https://github.com/chisomobanzi/serpentine3d/tree/main/serpentine3d/fileio): `serpentine3d/fileio`

### Automation

- [Python API](https://github.com/chisomobanzi/serpentine3d/blob/main/serpentine3d/api.py): `serpentine3d/api.py`
- [Scripts and batch](https://github.com/chisomobanzi/serpentine3d/blob/main/serpentine3d/script_runtime.py): `serpentine3d/script_runtime.py`
- [MCP server](https://github.com/chisomobanzi/serpentine3d/blob/main/serpentine3d/mcp_server/server.py): `serpentine3d/mcp_server/server.py`

### Assistant

- [AI assistant](https://github.com/chisomobanzi/serpentine3d/blob/main/serpentine3d/ai/agent.py): `serpentine3d/ai/agent.py`
- [Model providers](https://github.com/chisomobanzi/serpentine3d/tree/main/serpentine3d/ai): `serpentine3d/ai`

### Other components

- **Designer**
- **AI provider**

## Connections

- Designer → Desktop app: uses (evidence: `README.md`)
- Desktop app → 3D viewport: hosts (evidence: `serpentine3d/app.py`)
- Designer → Command processor: enters commands (evidence: `README.md`)
- Desktop app → Command processor: registers (evidence: `serpentine3d/app.py`)
- Command processor → Exact geometry: builds shapes (evidence: `serpentine3d/commands/base.py`)
- Command processor → Scene state: adds objects
- 3D viewport → Scene state: displays
- 3D viewport → Selection and snaps: picks objects
- 3D viewport → Direct manipulator: hosts manipulator (evidence: `serpentine3d/ui/viewport.py`)
- Direct manipulator → Exact geometry: edits shapes (evidence: `serpentine3d/ui/gumball.py`)
- Exact geometry → Mesh objects: supports meshes (evidence: `serpentine3d/core/geometry.py`)
- Designer → Sheet layouts: creates sheets (evidence: `README.md`)
- Sheet layouts → Exact geometry: projects model views (evidence: `serpentine3d/core/layout.py`)
- Sheet view → Sheet layouts: renders sheets (evidence: `serpentine3d/ui/layout_view.py`)
- Desktop app → Sheet view: hosts (evidence: `serpentine3d/app.py`)
- Designer → File exchange: imports and exports (evidence: `README.md`)
- Python API → File exchange: exchanges files (evidence: `serpentine3d/api.py`)
- Designer → Scripts and batch: runs scripts (evidence: `README.md`)
- Scripts and batch → Python API: drives model
- Designer → MCP server: connects client (evidence: `README.md`)
- MCP server → Desktop app: drives live session (evidence: `README.md`)
- Designer → AI assistant: requests changes (evidence: `README.md`)
- AI assistant → Command processor: runs commands (evidence: `README.md`)
- AI assistant → 3D viewport: checks viewport (evidence: `README.md`)
- AI assistant → Model providers: uses provider client
- Model providers → AI provider: streams requests (evidence: `serpentine3d/ai/client.py`)
- Designer → Build checks: checks model (evidence: `README.md`)
