# harisharandangi/textocad architecture

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

- Interactive diagram: https://gitdiagram.com/harisharandangi/textocad
- Repository: https://github.com/harisharandangi/textocad

## Overview

TextoCAD turns natural-language part requests into editable parametric CAD models, then builds and exports geometry. The principal workflow runs from the local web app or CLI through generation, a mode-specific geometry engine, and file export; users can also rebuild with changed parameters. README-described modes include precision, printing, organic, and robotics, plus optional requirement checking and repair. Edges are limited to relationships documented in the README or visible in the source index; unsampled subsystems are included where documented, without asserting their internal call sequence.

Main entry points: [`textocad/generate.py`](https://github.com/harisharandangi/textocad/blob/main/textocad/generate.py) (Generate or rebuild), [`textocad/services/codegen_pipeline.py`](https://github.com/harisharandangi/textocad/blob/main/textocad/services/codegen_pipeline.py) (Parametric codegen), [`textocad/services/llm_service.py`](https://github.com/harisharandangi/textocad/blob/main/textocad/services/llm_service.py) (LLM service), [`textocad/services/robot_pipeline.py`](https://github.com/harisharandangi/textocad/blob/main/textocad/services/robot_pipeline.py) (Robotics pipeline)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_entry["User entry"]
  node_web["Local web app<br/>[server.py]"]
  node_cli["Command line<br/>[cli.py]"]
  node_generation_api["Generate or rebuild<br/>[generate.py]"]
  node_keystore[("Local API keys<br/>[keystore.py]")]
end

subgraph group_generation["Generation and AI"]
  node_config["Runtime settings<br/>[config.py]"]
  node_models["Model selection<br/>[llm_models.py]"]
  node_llm["LLM service<br/>[llm_service.py]"]
  node_provider["AI providers<br/>[providers.py]"]
  node_codegen["Parametric codegen"]
  node_intent["CAD intent<br/>[cad_intent.py]"]
  node_schema["CAD document schema<br/>[cad_schema.py]"]
  node_operations["CAD operations<br/>[cad_operations.py]"]
end

subgraph group_engines["CAD engines"]
  node_precision["Precision compiler"]
  node_printing["Printing engine<br/>[openscad_engine.py]"]
  node_organic["Organic SDF<br/>[sdf_organic.py]"]
  node_robotics["Robotics pipeline<br/>[robot_pipeline.py]"]
  node_robot_compiler["Robot compiler<br/>[robot_compiler.py]"]
  node_sandbox["Code sandbox<br/>[codegen_sandbox.py]"]
end

subgraph group_quality["Validation and repair"]
  node_requirements["Requirement extraction"]
  node_verification["Geometry verification<br/>[verification.py]"]
  node_repair["Verified build repair<br/>[verified_build.py]"]
end

subgraph group_output["Geometry and export"]
  node_export["Part export<br/>[part_export.py]"]
  node_artifacts["CAD files"]
end

node_user(("Part designer"))
node_external_ai{{"AI provider"}}

node_user -->|"describes part"| node_web
node_user -->|"describes part"| node_cli
node_web -->|"requests build"| node_generation_api
node_cli -->|"requests build"| node_generation_api
node_web -->|"manages keys"| node_keystore
node_generation_api -->|"reads settings"| node_config
node_generation_api -->|"selects model"| node_models
node_generation_api -->|"generates model"| node_codegen
node_generation_api -->|"builds organic"| node_organic
node_generation_api -->|"builds robot"| node_robotics
node_generation_api -->|"runs build"| node_sandbox
node_generation_api -->|"exports result"| node_export
node_models -->|"resolves provider"| node_provider
node_llm -->|"uses selection"| node_models
node_llm -.->|"sends prompts"| node_external_ai
node_llm -->|"uses intent"| node_intent
node_llm -->|"uses schema"| node_schema
node_llm -->|"uses operations"| node_operations
node_codegen -->|"requests generation"| node_llm
node_codegen -->|"extracts requirements"| node_requirements
node_codegen -->|"checks geometry"| node_verification
node_codegen -->|"uses engine"| node_printing
node_codegen -->|"executes code"| node_sandbox
node_codegen -->|"exports build"| node_export
node_precision -->|"validates document"| node_schema
node_precision -->|"compiles operations"| node_operations
node_printing -->|"validates document"| node_schema
node_printing -->|"compiles operations"| node_operations
node_robotics -->|"plans robot"| node_llm
node_robotics -->|"generates link geometry"| node_codegen
node_robotics -->|"exports assembly"| node_export
node_robot_compiler -->|"reads robot schema"| node_schema
node_repair -->|"extracts requirements"| node_requirements
node_repair -->|"checks build"| node_verification
node_repair -->|"requests repair"| node_llm
node_export -->|"writes files"| node_artifacts

click node_web "https://github.com/harisharandangi/textocad/blob/main/textocad/server.py"
click node_cli "https://github.com/harisharandangi/textocad/blob/main/textocad/cli.py"
click node_generation_api "https://github.com/harisharandangi/textocad/blob/main/textocad/generate.py"
click node_config "https://github.com/harisharandangi/textocad/blob/main/textocad/core/config.py"
click node_models "https://github.com/harisharandangi/textocad/blob/main/textocad/services/llm_models.py"
click node_llm "https://github.com/harisharandangi/textocad/blob/main/textocad/services/llm_service.py"
click node_provider "https://github.com/harisharandangi/textocad/blob/main/textocad/services/providers.py"
click node_codegen "https://github.com/harisharandangi/textocad/blob/main/textocad/services/codegen_pipeline.py"
click node_intent "https://github.com/harisharandangi/textocad/blob/main/textocad/services/cad_intent.py"
click node_schema "https://github.com/harisharandangi/textocad/blob/main/textocad/services/cad_schema.py"
click node_operations "https://github.com/harisharandangi/textocad/blob/main/textocad/services/cad_operations.py"
click node_precision "https://github.com/harisharandangi/textocad/blob/main/textocad/services/cadquery_compiler.py"
click node_printing "https://github.com/harisharandangi/textocad/blob/main/textocad/services/openscad_engine.py"
click node_organic "https://github.com/harisharandangi/textocad/blob/main/textocad/services/sdf_organic.py"
click node_robotics "https://github.com/harisharandangi/textocad/blob/main/textocad/services/robot_pipeline.py"
click node_robot_compiler "https://github.com/harisharandangi/textocad/blob/main/textocad/services/robot_compiler.py"
click node_requirements "https://github.com/harisharandangi/textocad/blob/main/textocad/services/requirement_spec.py"
click node_verification "https://github.com/harisharandangi/textocad/blob/main/textocad/services/verification.py"
click node_repair "https://github.com/harisharandangi/textocad/blob/main/textocad/services/verified_build.py"
click node_sandbox "https://github.com/harisharandangi/textocad/blob/main/textocad/services/codegen_sandbox.py"
click node_export "https://github.com/harisharandangi/textocad/blob/main/textocad/services/part_export.py"
click node_keystore "https://github.com/harisharandangi/textocad/blob/main/textocad/keystore.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_web,node_cli,node_generation_api,node_keystore toneBlue
class node_config,node_models,node_llm,node_provider,node_codegen,node_intent,node_schema,node_operations toneAmber
class node_precision,node_printing,node_organic,node_robotics,node_robot_compiler,node_sandbox toneMint
class node_requirements,node_verification,node_repair toneRose
class node_export,node_artifacts,node_user,node_external_ai toneIndigo
```

## Components

### User entry

- [Local web app](https://github.com/harisharandangi/textocad/blob/main/textocad/server.py): `textocad/server.py`
- [Command line](https://github.com/harisharandangi/textocad/blob/main/textocad/cli.py): `textocad/cli.py`
- [Generate or rebuild](https://github.com/harisharandangi/textocad/blob/main/textocad/generate.py): `textocad/generate.py`
- [Local API keys](https://github.com/harisharandangi/textocad/blob/main/textocad/keystore.py): `textocad/keystore.py`

### Generation and AI

- [Runtime settings](https://github.com/harisharandangi/textocad/blob/main/textocad/core/config.py): `textocad/core/config.py`
- [Model selection](https://github.com/harisharandangi/textocad/blob/main/textocad/services/llm_models.py): `textocad/services/llm_models.py`
- [LLM service](https://github.com/harisharandangi/textocad/blob/main/textocad/services/llm_service.py): `textocad/services/llm_service.py`
- [AI providers](https://github.com/harisharandangi/textocad/blob/main/textocad/services/providers.py): `textocad/services/providers.py`
- [Parametric codegen](https://github.com/harisharandangi/textocad/blob/main/textocad/services/codegen_pipeline.py): `textocad/services/codegen_pipeline.py`
- [CAD intent](https://github.com/harisharandangi/textocad/blob/main/textocad/services/cad_intent.py): `textocad/services/cad_intent.py`
- [CAD document schema](https://github.com/harisharandangi/textocad/blob/main/textocad/services/cad_schema.py): `textocad/services/cad_schema.py`
- [CAD operations](https://github.com/harisharandangi/textocad/blob/main/textocad/services/cad_operations.py): `textocad/services/cad_operations.py`

### CAD engines

- [Precision compiler](https://github.com/harisharandangi/textocad/blob/main/textocad/services/cadquery_compiler.py): `textocad/services/cadquery_compiler.py`
- [Printing engine](https://github.com/harisharandangi/textocad/blob/main/textocad/services/openscad_engine.py): `textocad/services/openscad_engine.py`
- [Organic SDF](https://github.com/harisharandangi/textocad/blob/main/textocad/services/sdf_organic.py): `textocad/services/sdf_organic.py`
- [Robotics pipeline](https://github.com/harisharandangi/textocad/blob/main/textocad/services/robot_pipeline.py): `textocad/services/robot_pipeline.py`
- [Robot compiler](https://github.com/harisharandangi/textocad/blob/main/textocad/services/robot_compiler.py): `textocad/services/robot_compiler.py`
- [Code sandbox](https://github.com/harisharandangi/textocad/blob/main/textocad/services/codegen_sandbox.py): `textocad/services/codegen_sandbox.py`

### Validation and repair

- [Requirement extraction](https://github.com/harisharandangi/textocad/blob/main/textocad/services/requirement_spec.py): `textocad/services/requirement_spec.py`
- [Geometry verification](https://github.com/harisharandangi/textocad/blob/main/textocad/services/verification.py): `textocad/services/verification.py`
- [Verified build repair](https://github.com/harisharandangi/textocad/blob/main/textocad/services/verified_build.py): `textocad/services/verified_build.py`

### Geometry and export

- [Part export](https://github.com/harisharandangi/textocad/blob/main/textocad/services/part_export.py): `textocad/services/part_export.py`
- **CAD files**

### Other components

- **Part designer**
- **AI provider**

## Connections

- Part designer → Local web app: describes part (evidence: `README.md`)
- Part designer → Command line: describes part (evidence: `README.md`)
- Local web app → Generate or rebuild: requests build (evidence: `textocad/server.py`)
- Command line → Generate or rebuild: requests build (evidence: `textocad/cli.py`)
- Local web app → Local API keys: manages keys (evidence: `textocad/server.py`)
- Generate or rebuild → Runtime settings: reads settings (evidence: `textocad/generate.py`)
- Generate or rebuild → Model selection: selects model (evidence: `textocad/generate.py`)
- Generate or rebuild → Parametric codegen: generates model (evidence: `textocad/generate.py`)
- Generate or rebuild → Organic SDF: builds organic (evidence: `textocad/generate.py`)
- Generate or rebuild → Robotics pipeline: builds robot (evidence: `textocad/generate.py`)
- Generate or rebuild → Code sandbox: runs build (evidence: `textocad/generate.py`)
- Generate or rebuild → Part export: exports result (evidence: `textocad/generate.py`)
- Model selection → AI providers: resolves provider (evidence: `textocad/services/llm_models.py`)
- LLM service → Model selection: uses selection (evidence: `textocad/services/llm_service.py`)
- LLM service → AI provider: sends prompts
- LLM service → CAD intent: uses intent (evidence: `textocad/services/llm_service.py`)
- LLM service → CAD document schema: uses schema (evidence: `textocad/services/llm_service.py`)
- LLM service → CAD operations: uses operations (evidence: `textocad/services/llm_service.py`)
- Parametric codegen → LLM service: requests generation (evidence: `textocad/services/codegen_pipeline.py`)
- Parametric codegen → Requirement extraction: extracts requirements (evidence: `textocad/services/codegen_pipeline.py`)
- Parametric codegen → Geometry verification: checks geometry (evidence: `textocad/services/codegen_pipeline.py`)
- Parametric codegen → Printing engine: uses engine (evidence: `textocad/services/codegen_pipeline.py`)
- Parametric codegen → Code sandbox: executes code (evidence: `textocad/services/codegen_pipeline.py`)
- Parametric codegen → Part export: exports build (evidence: `textocad/services/codegen_pipeline.py`)
- Precision compiler → CAD document schema: validates document (evidence: `textocad/services/cadquery_compiler.py`)
- Precision compiler → CAD operations: compiles operations (evidence: `textocad/services/cadquery_compiler.py`)
- Printing engine → CAD document schema: validates document
- Printing engine → CAD operations: compiles operations
- Robotics pipeline → LLM service: plans robot (evidence: `textocad/services/robot_pipeline.py`)
- Robotics pipeline → Parametric codegen: generates link geometry (evidence: `textocad/services/robot_pipeline.py`)
- Robotics pipeline → Part export: exports assembly (evidence: `textocad/services/robot_pipeline.py`)
- Robot compiler → CAD document schema: reads robot schema (evidence: `textocad/services/urdf_worker.py`)
- Verified build repair → Requirement extraction: extracts requirements (evidence: `textocad/services/verified_build.py`)
- Verified build repair → Geometry verification: checks build (evidence: `textocad/services/verified_build.py`)
- Verified build repair → LLM service: requests repair (evidence: `textocad/services/verified_build.py`)
- Part export → CAD files: writes files (evidence: `README.md`)
