# tcherditkothir/vikicad architecture

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

- Interactive diagram: https://gitdiagram.com/tcherditkothir/vikicad
- Repository: https://github.com/tcherditkothir/vikicad

## Overview

VikiCAD is a Linux CAD and PCB-fabrication editor: users create and edit 2D drawings, build and modify 3D solids, inspect or edit Gerber/Excellon data, then save native projects or export interoperable files. The GUI and headless CLI provide separate interaction modes; the CLI and GUI IPC also expose command-driven automation and JSON queries. The graph preserves the README’s major CAD, fabrication, interoperability, and agent-facing capabilities. Source excerpts were partial, so uncertain internal call wiring is omitted; paths for unsampled subsystems use existing tree entries.

Main entry points: [`core/cmd/Commands3D.cpp`](https://github.com/tcherditkothir/vikicad/blob/main/core/cmd/Commands3D.cpp) (CAD commands), [`cli/main.cpp`](https://github.com/tcherditkothir/vikicad/blob/main/cli/main.cpp) (Headless CLI), [`gui/ipc/RpcServer.cpp`](https://github.com/tcherditkothir/vikicad/blob/main/gui/ipc/RpcServer.cpp) (JSON-RPC server), [`gui/MainWindow.cpp`](https://github.com/tcherditkothir/vikicad/blob/main/gui/MainWindow.cpp) (Desktop GUI)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_interaction["Interaction"]
  node_gui["Desktop GUI<br/>[MainWindow.cpp]"]
  node_canvas["2D canvas<br/>[CanvasWidget.cpp]"]
  node_view3d["3D view<br/>[OcctViewWidget.cpp]"]
end

subgraph group_cad["CAD Editing"]
  node_processor["Command processor"]
  node_commands["CAD commands<br/>[Commands3D.cpp]"]
  node_model["Document model"]
  node_geometry["2D geometry<br/>[GeomUtil.cpp]"]
  node_snapping["Object snaps<br/>[SnapEngine.cpp]"]
  node_solids["Solid operations<br/>[SolidOps.cpp]"]
  node_features["Feature history<br/>[FeatureTree.cpp]"]
end

subgraph group_fabrication["PCB Fabrication"]
  node_gerber["Gerber and Excellon<br/>[GerberIo.cpp]"]
  node_gerberwrite["CAM exporters<br/>[GerberWriter.cpp]"]
end

subgraph group_formats["File Interchange"]
  node_native[("Native project store<br/>[NativeStore.cpp]")]
  node_dxf["DXF interchange<br/>[DxfImporter.cpp]"]
  node_step["STEP interchange<br/>[StepIo.cpp]"]
  node_otherformats["Other CAD formats<br/>[ObjIo.cpp]"]
  node_pdf["PDF plotting<br/>[PdfPlotter.cpp]"]
  node_animation["Animation export<br/>[GlbExporter.cpp]"]
  node_offscreen["Offscreen renderer"]
end

subgraph group_automation["Automation"]
  node_cli["Headless CLI<br/>[main.cpp]"]
  node_rpc["JSON-RPC server<br/>[RpcServer.cpp]"]
  node_query["JSON queries<br/>[QueryJson.cpp]"]
end

node_user(("CAD user"))

node_user -->|"interacts with"| node_gui
node_user -->|"runs commands"| node_cli
node_user -->|"draws and edits"| node_canvas
node_user -->|"navigates and picks"| node_view3d
node_gui -->|"serves requests"| node_rpc
node_cli -->|"connects to"| node_rpc
node_cli -->|"loads and saves"| node_native
node_cli -->|"requests JSON views"| node_query
node_cli -->|"executes commands"| node_processor
node_rpc -->|"serves queries"| node_query
node_processor -->|"dispatches"| node_commands
node_commands -->|"edits"| node_model
node_commands -->|"performs 3D operations"| node_solids
node_commands -->|"edits feature history"| node_features
node_commands -->|"uses geometry"| node_geometry
node_canvas -->|"queries snap points"| node_snapping
node_snapping -->|"reads entities"| node_model
node_view3d -->|"displays solids"| node_model
node_native -->|"reads and writes"| node_model
node_gerber -->|"imports fabrication data"| node_model
node_model -->|"exports fabrication data"| node_gerberwrite
node_dxf -->|"imports drawing data"| node_model
node_model -->|"reads and writes STEP"| node_step
node_model -->|"imports or exports"| node_otherformats
node_model -->|"plots layouts"| node_pdf
node_animation -->|"renders frames"| node_offscreen

click node_gui "https://github.com/tcherditkothir/vikicad/blob/main/gui/MainWindow.cpp"
click node_canvas "https://github.com/tcherditkothir/vikicad/blob/main/gui/canvas/CanvasWidget.cpp"
click node_view3d "https://github.com/tcherditkothir/vikicad/blob/main/gui/occview/OcctViewWidget.cpp"
click node_cli "https://github.com/tcherditkothir/vikicad/blob/main/cli/main.cpp"
click node_rpc "https://github.com/tcherditkothir/vikicad/blob/main/gui/ipc/RpcServer.cpp"
click node_processor "https://github.com/tcherditkothir/vikicad/blob/main/core/cmd/CommandProcessor.cpp"
click node_commands "https://github.com/tcherditkothir/vikicad/blob/main/core/cmd/Commands3D.cpp"
click node_geometry "https://github.com/tcherditkothir/vikicad/blob/main/core/geom/GeomUtil.cpp"
click node_snapping "https://github.com/tcherditkothir/vikicad/blob/main/core/snap/SnapEngine.cpp"
click node_solids "https://github.com/tcherditkothir/vikicad/blob/main/core/solid/SolidOps.cpp"
click node_features "https://github.com/tcherditkothir/vikicad/blob/main/core/solid/FeatureTree.cpp"
click node_native "https://github.com/tcherditkothir/vikicad/blob/main/core/io/NativeStore.cpp"
click node_query "https://github.com/tcherditkothir/vikicad/blob/main/core/io/QueryJson.cpp"
click node_gerber "https://github.com/tcherditkothir/vikicad/blob/main/core/io/GerberIo.cpp"
click node_gerberwrite "https://github.com/tcherditkothir/vikicad/blob/main/core/io/GerberWriter.cpp"
click node_dxf "https://github.com/tcherditkothir/vikicad/blob/main/core/io/DxfImporter.cpp"
click node_step "https://github.com/tcherditkothir/vikicad/blob/main/core/io/StepIo.cpp"
click node_otherformats "https://github.com/tcherditkothir/vikicad/blob/main/core/io/ObjIo.cpp"
click node_pdf "https://github.com/tcherditkothir/vikicad/blob/main/core/io/PdfPlotter.cpp"
click node_animation "https://github.com/tcherditkothir/vikicad/blob/main/core/anim/GlbExporter.cpp"
click node_offscreen "https://github.com/tcherditkothir/vikicad/blob/main/offscreen/OffscreenRenderer.cpp"

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_gui,node_canvas,node_view3d,node_user toneBlue
class node_processor,node_commands,node_model,node_geometry,node_snapping,node_solids,node_features toneAmber
class node_gerber,node_gerberwrite toneMint
class node_native,node_dxf,node_step,node_otherformats,node_pdf,node_animation,node_offscreen toneRose
class node_cli,node_rpc,node_query toneIndigo
```

## Components

### Interaction

- [Desktop GUI](https://github.com/tcherditkothir/vikicad/blob/main/gui/MainWindow.cpp): `gui/MainWindow.cpp`
- [2D canvas](https://github.com/tcherditkothir/vikicad/blob/main/gui/canvas/CanvasWidget.cpp): `gui/canvas/CanvasWidget.cpp`
- [3D view](https://github.com/tcherditkothir/vikicad/blob/main/gui/occview/OcctViewWidget.cpp): `gui/occview/OcctViewWidget.cpp`

### CAD Editing

- [Command processor](https://github.com/tcherditkothir/vikicad/blob/main/core/cmd/CommandProcessor.cpp): `core/cmd/CommandProcessor.cpp`
- [CAD commands](https://github.com/tcherditkothir/vikicad/blob/main/core/cmd/Commands3D.cpp): `core/cmd/Commands3D.cpp`
- **Document model**
- [2D geometry](https://github.com/tcherditkothir/vikicad/blob/main/core/geom/GeomUtil.cpp): `core/geom/GeomUtil.cpp`
- [Object snaps](https://github.com/tcherditkothir/vikicad/blob/main/core/snap/SnapEngine.cpp): `core/snap/SnapEngine.cpp`
- [Solid operations](https://github.com/tcherditkothir/vikicad/blob/main/core/solid/SolidOps.cpp): `core/solid/SolidOps.cpp`
- [Feature history](https://github.com/tcherditkothir/vikicad/blob/main/core/solid/FeatureTree.cpp): `core/solid/FeatureTree.cpp`

### PCB Fabrication

- [Gerber and Excellon](https://github.com/tcherditkothir/vikicad/blob/main/core/io/GerberIo.cpp): `core/io/GerberIo.cpp`
- [CAM exporters](https://github.com/tcherditkothir/vikicad/blob/main/core/io/GerberWriter.cpp): `core/io/GerberWriter.cpp`

### File Interchange

- [Native project store](https://github.com/tcherditkothir/vikicad/blob/main/core/io/NativeStore.cpp): `core/io/NativeStore.cpp`
- [DXF interchange](https://github.com/tcherditkothir/vikicad/blob/main/core/io/DxfImporter.cpp): `core/io/DxfImporter.cpp`
- [STEP interchange](https://github.com/tcherditkothir/vikicad/blob/main/core/io/StepIo.cpp): `core/io/StepIo.cpp`
- [Other CAD formats](https://github.com/tcherditkothir/vikicad/blob/main/core/io/ObjIo.cpp): `core/io/ObjIo.cpp`
- [PDF plotting](https://github.com/tcherditkothir/vikicad/blob/main/core/io/PdfPlotter.cpp): `core/io/PdfPlotter.cpp`
- [Animation export](https://github.com/tcherditkothir/vikicad/blob/main/core/anim/GlbExporter.cpp): `core/anim/GlbExporter.cpp`
- [Offscreen renderer](https://github.com/tcherditkothir/vikicad/blob/main/offscreen/OffscreenRenderer.cpp): `offscreen/OffscreenRenderer.cpp`

### Automation

- [Headless CLI](https://github.com/tcherditkothir/vikicad/blob/main/cli/main.cpp): `cli/main.cpp`
- [JSON-RPC server](https://github.com/tcherditkothir/vikicad/blob/main/gui/ipc/RpcServer.cpp): `gui/ipc/RpcServer.cpp`
- [JSON queries](https://github.com/tcherditkothir/vikicad/blob/main/core/io/QueryJson.cpp): `core/io/QueryJson.cpp`

### Other components

- **CAD user**

## Connections

- CAD user → Desktop GUI: interacts with
- CAD user → Headless CLI: runs commands
- CAD user → 2D canvas: draws and edits
- CAD user → 3D view: navigates and picks
- Desktop GUI → JSON-RPC server: serves requests
- Headless CLI → JSON-RPC server: connects to
- Headless CLI → Native project store: loads and saves
- Headless CLI → JSON queries: requests JSON views
- Headless CLI → Command processor: executes commands
- JSON-RPC server → JSON queries: serves queries
- Command processor → CAD commands: dispatches
- CAD commands → Document model: edits
- CAD commands → Solid operations: performs 3D operations
- CAD commands → Feature history: edits feature history
- CAD commands → 2D geometry: uses geometry
- 2D canvas → Object snaps: queries snap points
- Object snaps → Document model: reads entities
- 3D view → Document model: displays solids
- Native project store → Document model: reads and writes
- Gerber and Excellon → Document model: imports fabrication data
- Document model → CAM exporters: exports fabrication data
- DXF interchange → Document model: imports drawing data
- Document model → STEP interchange: reads and writes STEP
- Document model → Other CAD formats: imports or exports
- Document model → PDF plotting: plots layouts
- Animation export → Offscreen renderer: renders frames
