# twisted-builds-llc/twisted_builds_harness_designer architecture

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

- Interactive diagram: https://gitdiagram.com/twisted-builds-llc/twisted_builds_harness_designer
- Repository: https://github.com/twisted-builds-llc/twisted_builds_harness_designer

## Overview

Twisted Builds Harness Designer is a desktop application for designing wiring harnesses. Users edit electrical connections in a schematic, place and route them in a physical layout, then inspect calculated wire lengths, bundle details, and a live bill of materials; designs can be saved as local .tbh files and BOM data exported. The graph also shows editing, recovery, library, and print-related subsystems. The README documents the principal workflow; some implementation links are based on the source index, so unsampled integrations are left unverified.

Main entry points: [`src/app/ui/MainWindow.cpp`](https://github.com/twisted-builds-llc/twisted_builds_harness_designer/blob/main/src/app/ui/MainWindow.cpp) (Main window), [`src/app/Document.cpp`](https://github.com/twisted-builds-llc/twisted_builds_harness_designer/blob/main/src/app/Document.cpp) (Open document), [`src/app/layout`](https://github.com/twisted-builds-llc/twisted_builds_harness_designer/tree/main/src/app/layout) (Layout editor), [`src/app/bom/BomView.cpp`](https://github.com/twisted-builds-llc/twisted_builds_harness_designer/blob/main/src/app/bom/BomView.cpp) (BOM view and CSV)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_app["Desktop application"]
  node_main["Application startup<br/>[main.cpp]"]
  node_window["Main window<br/>[MainWindow.cpp]"]
  node_preferences["Preferences<br/>[Preferences.cpp]"]
end

subgraph group_design["Harness design"]
  node_model["Harness model<br/>[HarnessModel.cpp]"]
  node_schematic["Schematic editor"]
  node_layout["Layout editor"]
  node_editops["Edit operations<br/>[EditOps.cpp]"]
  node_selection["Selection state<br/>[SelectionModel.h]"]
  node_library[("Parts library<br/>[LibraryStore.cpp]")]
end

subgraph group_analysis["Calculations and outputs"]
  node_routing["Wire routing<br/>[WireLength.cpp]"]
  node_bundle["Bundle sizing<br/>[Bundle.cpp]"]
  node_bom["Bill of materials<br/>[Bom.cpp]"]
  node_bomview["BOM view and CSV<br/>[BomView.cpp]"]
  node_pdf["Print export<br/>[PdfExport.cpp]"]
end

subgraph group_persistence["Files and recovery"]
  node_document["Open document<br/>[Document.cpp]"]
  node_fileformat["Harness file format<br/>[TbhFile.cpp]"]
  node_autosave["Autosave recovery<br/>[Autosave.cpp]"]
end

node_user(("Designer"))

node_user -->|"starts"| node_main
node_main -->|"opens"| node_window
node_user -->|"uses editors"| node_window
node_window -->|"owns"| node_document
node_document -->|"maintains"| node_model
node_window -->|"presents"| node_schematic
node_window -->|"presents"| node_layout
node_schematic -->|"edits through"| node_editops
node_layout -->|"edits through"| node_editops
node_editops -->|"updates"| node_model
node_window -->|"tracks selection"| node_selection
node_window -->|"loads library"| node_library
node_layout -->|"shows wire lengths"| node_routing
node_routing -->|"uses wire sizing"| node_bundle
node_window -->|"shows live BOM"| node_bomview
node_bomview -->|"generates"| node_bom
node_bom -->|"uses lengths"| node_routing
node_bomview -->|"exports CSV"| node_user
node_window -.->|"exports build package"| node_pdf
node_document -->|"reads and writes"| node_fileformat
node_window -->|"recovers work"| node_autosave
node_autosave -.->|"writes recovery copy"| node_document
node_window -.->|"configures"| node_preferences

click node_main "https://github.com/twisted-builds-llc/twisted_builds_harness_designer/blob/main/src/app/main.cpp"
click node_window "https://github.com/twisted-builds-llc/twisted_builds_harness_designer/blob/main/src/app/ui/MainWindow.cpp"
click node_document "https://github.com/twisted-builds-llc/twisted_builds_harness_designer/blob/main/src/app/Document.cpp"
click node_model "https://github.com/twisted-builds-llc/twisted_builds_harness_designer/blob/main/src/core/model/HarnessModel.cpp"
click node_schematic "https://github.com/twisted-builds-llc/twisted_builds_harness_designer/tree/main/src/app/schematic"
click node_layout "https://github.com/twisted-builds-llc/twisted_builds_harness_designer/tree/main/src/app/layout"
click node_editops "https://github.com/twisted-builds-llc/twisted_builds_harness_designer/blob/main/src/app/commands/EditOps.cpp"
click node_selection "https://github.com/twisted-builds-llc/twisted_builds_harness_designer/blob/main/src/app/SelectionModel.h"
click node_library "https://github.com/twisted-builds-llc/twisted_builds_harness_designer/blob/main/src/app/LibraryStore.cpp"
click node_routing "https://github.com/twisted-builds-llc/twisted_builds_harness_designer/blob/main/src/core/calc/WireLength.cpp"
click node_bundle "https://github.com/twisted-builds-llc/twisted_builds_harness_designer/blob/main/src/core/calc/Bundle.cpp"
click node_bom "https://github.com/twisted-builds-llc/twisted_builds_harness_designer/blob/main/src/core/bom/Bom.cpp"
click node_bomview "https://github.com/twisted-builds-llc/twisted_builds_harness_designer/blob/main/src/app/bom/BomView.cpp"
click node_pdf "https://github.com/twisted-builds-llc/twisted_builds_harness_designer/blob/main/src/app/print/PdfExport.cpp"
click node_fileformat "https://github.com/twisted-builds-llc/twisted_builds_harness_designer/blob/main/src/core/io/TbhFile.cpp"
click node_autosave "https://github.com/twisted-builds-llc/twisted_builds_harness_designer/blob/main/src/app/Autosave.cpp"
click node_preferences "https://github.com/twisted-builds-llc/twisted_builds_harness_designer/blob/main/src/app/Preferences.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_main,node_window,node_preferences toneBlue
class node_model,node_schematic,node_layout,node_editops,node_selection,node_library toneAmber
class node_routing,node_bundle,node_bom,node_bomview,node_pdf toneMint
class node_document,node_fileformat,node_autosave toneRose
class node_user toneIndigo
```

## Components

### Desktop application

- [Application startup](https://github.com/twisted-builds-llc/twisted_builds_harness_designer/blob/main/src/app/main.cpp): `src/app/main.cpp`
- [Main window](https://github.com/twisted-builds-llc/twisted_builds_harness_designer/blob/main/src/app/ui/MainWindow.cpp): `src/app/ui/MainWindow.cpp`
- [Preferences](https://github.com/twisted-builds-llc/twisted_builds_harness_designer/blob/main/src/app/Preferences.cpp): `src/app/Preferences.cpp`

### Harness design

- [Harness model](https://github.com/twisted-builds-llc/twisted_builds_harness_designer/blob/main/src/core/model/HarnessModel.cpp): `src/core/model/HarnessModel.cpp`
- [Schematic editor](https://github.com/twisted-builds-llc/twisted_builds_harness_designer/tree/main/src/app/schematic): `src/app/schematic`
- [Layout editor](https://github.com/twisted-builds-llc/twisted_builds_harness_designer/tree/main/src/app/layout): `src/app/layout`
- [Edit operations](https://github.com/twisted-builds-llc/twisted_builds_harness_designer/blob/main/src/app/commands/EditOps.cpp): `src/app/commands/EditOps.cpp`
- [Selection state](https://github.com/twisted-builds-llc/twisted_builds_harness_designer/blob/main/src/app/SelectionModel.h): `src/app/SelectionModel.h`
- [Parts library](https://github.com/twisted-builds-llc/twisted_builds_harness_designer/blob/main/src/app/LibraryStore.cpp): `src/app/LibraryStore.cpp`

### Calculations and outputs

- [Wire routing](https://github.com/twisted-builds-llc/twisted_builds_harness_designer/blob/main/src/core/calc/WireLength.cpp): `src/core/calc/WireLength.cpp`
- [Bundle sizing](https://github.com/twisted-builds-llc/twisted_builds_harness_designer/blob/main/src/core/calc/Bundle.cpp): `src/core/calc/Bundle.cpp`
- [Bill of materials](https://github.com/twisted-builds-llc/twisted_builds_harness_designer/blob/main/src/core/bom/Bom.cpp): `src/core/bom/Bom.cpp`
- [BOM view and CSV](https://github.com/twisted-builds-llc/twisted_builds_harness_designer/blob/main/src/app/bom/BomView.cpp): `src/app/bom/BomView.cpp`
- [Print export](https://github.com/twisted-builds-llc/twisted_builds_harness_designer/blob/main/src/app/print/PdfExport.cpp): `src/app/print/PdfExport.cpp`

### Files and recovery

- [Open document](https://github.com/twisted-builds-llc/twisted_builds_harness_designer/blob/main/src/app/Document.cpp): `src/app/Document.cpp`
- [Harness file format](https://github.com/twisted-builds-llc/twisted_builds_harness_designer/blob/main/src/core/io/TbhFile.cpp): `src/core/io/TbhFile.cpp`
- [Autosave recovery](https://github.com/twisted-builds-llc/twisted_builds_harness_designer/blob/main/src/app/Autosave.cpp): `src/app/Autosave.cpp`

### Other components

- **Designer**

## Connections

- Designer → Application startup: starts (evidence: `README.md`)
- Application startup → Main window: opens (evidence: `src/app/main.cpp`)
- Designer → Main window: uses editors (evidence: `README.md`)
- Main window → Open document: owns (evidence: `src/app/ui/MainWindow.cpp`)
- Open document → Harness model: maintains
- Main window → Schematic editor: presents (evidence: `README.md`)
- Main window → Layout editor: presents (evidence: `README.md`)
- Schematic editor → Edit operations: edits through (evidence: `README.md`)
- Layout editor → Edit operations: edits through (evidence: `src/app/layout/LayoutView.cpp`)
- Edit operations → Harness model: updates (evidence: `src/app/commands/EditOps.cpp`)
- Main window → Selection state: tracks selection (evidence: `src/app/ui/MainWindow.cpp`)
- Main window → Parts library: loads library (evidence: `src/app/ui/MainWindow.cpp`)
- Layout editor → Wire routing: shows wire lengths (evidence: `README.md`)
- Wire routing → Bundle sizing: uses wire sizing (evidence: `src/core/calc/WireLength.cpp`)
- Main window → BOM view and CSV: shows live BOM (evidence: `README.md`)
- BOM view and CSV → Bill of materials: generates (evidence: `src/app/bom/BomView.cpp`)
- Bill of materials → Wire routing: uses lengths (evidence: `src/core/bom/Bom.cpp`)
- BOM view and CSV → Designer: exports CSV (evidence: `README.md`)
- Main window → Print export: exports build package
- Open document → Harness file format: reads and writes (evidence: `README.md`)
- Main window → Autosave recovery: recovers work (evidence: `src/app/ui/MainWindow.cpp`)
- Autosave recovery → Open document: writes recovery copy
- Main window → Preferences: configures
