# mariow98/cad_zero architecture

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

- Interactive diagram: https://gitdiagram.com/mariow98/cad_zero
- Repository: https://github.com/mariow98/cad_zero

## Overview

CAD_0 is a dual-representation CAD kernel with a desktop modeling application and Python interfaces. A user creates or edits scene features— including sketch profiles extruded and subtracted into solids—then views, exports, or saves the result. The scene layer coordinates SDF and B-Rep operations; the kernel also supports mesh extraction, interchange formats, and conversion between representations. The README and source index establish these major branches, but several UI and kernel implementations were not sampled, so their internal call paths are not expanded here.

Main entry points: [`core/scene/include/CAD_0/scene/scene.hpp`](https://github.com/mariow98/cad_zero/blob/main/core/scene/include/CAD_0/scene/scene.hpp) (Feature Scene), [`app/src/CAD_0/__init__.py`](https://github.com/mariow98/cad_zero/blob/main/app/src/CAD_0/__init__.py) (Python API), [`app/src/CAD_0/ui/main_window.py`](https://github.com/mariow98/cad_zero/blob/main/app/src/CAD_0/ui/main_window.py) (Desktop App), [`app/src/CAD_0/ui/sketch_workbench.py`](https://github.com/mariow98/cad_zero/blob/main/app/src/CAD_0/ui/sketch_workbench.py) (Sketch Workbench)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_ui["Desktop UI"]
  node_desktop["Desktop App<br/>[main_window.py]"]
  node_sketch_ui["Sketch Workbench"]
  node_canvas["Sketch Canvas<br/>[sketch_canvas.py]"]
  node_viewport["3D Viewport<br/>[viewport_widget.py]"]
end

subgraph group_app["Python Interfaces"]
  node_python_api["Python API<br/>[__init__.py]"]
  node_cli["CLI<br/>[cli.py]"]
  node_bindings["Native Bindings<br/>[module.cpp]"]
end

subgraph group_scene["Scene and Persistence"]
  node_scene["Feature Scene<br/>[scene.hpp]"]
  node_native_format["Native Projects<br/>[native.cpp]"]
end

subgraph group_kernel["Geometry Kernel"]
  node_sdf["SDF Kernel<br/>[operators.hpp]"]
  node_sketch_profile["Sketch Profiles<br/>[sketch_profile.hpp]"]
  node_sketch_solver["Sketch Constraints<br/>[sketch_solver.hpp]"]
  node_mesh_extract["SDF Meshing<br/>[mesh_extract.cpp]"]
  node_brep["Exact B-Rep<br/>[boolean.cpp]"]
  node_topology["B-Rep Topology<br/>[topology.hpp]"]
  node_bridge["Representation Bridge<br/>[brep_to_sdf.cpp]"]
  node_viewport_engine["Rendering Engine<br/>[renderer.cpp]"]
end

subgraph group_interop["Interchange"]
  node_file_io["Mesh Import Export<br/>[obj.cpp]"]
  node_report["Body Reports<br/>[report.py]"]
end

node_user(("CAD User"))

node_user -->|"models in"| node_desktop
node_desktop -->|"edits features"| node_scene
node_desktop -->|"saves projects"| node_native_format
node_desktop -->|"displays model"| node_viewport
node_desktop -->|"opens workbench"| node_sketch_ui
node_sketch_ui -.->|"edits profiles"| node_canvas
node_scene -->|"dispatches SDF"| node_sdf
node_scene -->|"dispatches B-Rep"| node_brep
node_scene -->|"converts shapes"| node_bridge
node_scene -->|"extracts meshes"| node_mesh_extract
node_sketch_ui -->|"creates profiles"| node_sketch_profile
node_scene -->|"stores sketch constraints"| node_sketch_solver
node_sketch_profile -->|"extrudes to solid"| node_sdf
node_sdf -->|"extracts surface"| node_mesh_extract
node_brep -->|"operates on topology"| node_topology
node_viewport -->|"renders scene"| node_viewport_engine
node_python_api -->|"exposes kernel"| node_bindings
node_cli -.->|"uses package"| node_python_api
node_python_api -->|"creates scenes"| node_scene
node_python_api -->|"imports exports"| node_file_io
node_python_api -->|"saves loads"| node_native_format
node_python_api -->|"reports bodies"| node_report
node_file_io -->|"exports meshes"| node_mesh_extract

click node_desktop "https://github.com/mariow98/cad_zero/blob/main/app/src/CAD_0/ui/main_window.py"
click node_sketch_ui "https://github.com/mariow98/cad_zero/blob/main/app/src/CAD_0/ui/sketch_workbench.py"
click node_canvas "https://github.com/mariow98/cad_zero/blob/main/app/src/CAD_0/ui/sketch_canvas.py"
click node_viewport "https://github.com/mariow98/cad_zero/blob/main/app/src/CAD_0/ui/viewport_widget.py"
click node_python_api "https://github.com/mariow98/cad_zero/blob/main/app/src/CAD_0/__init__.py"
click node_cli "https://github.com/mariow98/cad_zero/blob/main/bindings/python/CAD_0/cli.py"
click node_bindings "https://github.com/mariow98/cad_zero/blob/main/bindings/python/src/module.cpp"
click node_scene "https://github.com/mariow98/cad_zero/blob/main/core/scene/include/CAD_0/scene/scene.hpp"
click node_native_format "https://github.com/mariow98/cad_zero/blob/main/core/io/src/native.cpp"
click node_sdf "https://github.com/mariow98/cad_zero/blob/main/core/sdf/include/CAD_0/sdf/operators.hpp"
click node_sketch_profile "https://github.com/mariow98/cad_zero/blob/main/core/sdf/include/CAD_0/sdf/sketch_profile.hpp"
click node_sketch_solver "https://github.com/mariow98/cad_zero/blob/main/core/sdf/include/CAD_0/sdf/sketch_solver.hpp"
click node_mesh_extract "https://github.com/mariow98/cad_zero/blob/main/core/sdf/src/mesh_extract.cpp"
click node_brep "https://github.com/mariow98/cad_zero/blob/main/core/brep/src/boolean.cpp"
click node_topology "https://github.com/mariow98/cad_zero/blob/main/core/brep/include/CAD_0/brep/topology.hpp"
click node_bridge "https://github.com/mariow98/cad_zero/blob/main/core/bridge/src/brep_to_sdf.cpp"
click node_viewport_engine "https://github.com/mariow98/cad_zero/blob/main/core/viewport/src/renderer.cpp"
click node_file_io "https://github.com/mariow98/cad_zero/blob/main/core/io/src/obj.cpp"
click node_report "https://github.com/mariow98/cad_zero/blob/main/bindings/python/CAD_0/report.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_desktop,node_sketch_ui,node_canvas,node_viewport,node_user toneBlue
class node_python_api,node_cli,node_bindings toneAmber
class node_scene,node_native_format toneMint
class node_sdf,node_sketch_profile,node_sketch_solver,node_mesh_extract,node_brep,node_topology,node_bridge,node_viewport_engine toneRose
class node_file_io,node_report toneIndigo
```

## Components

### Desktop UI

- [Desktop App](https://github.com/mariow98/cad_zero/blob/main/app/src/CAD_0/ui/main_window.py): `app/src/CAD_0/ui/main_window.py`
- [Sketch Workbench](https://github.com/mariow98/cad_zero/blob/main/app/src/CAD_0/ui/sketch_workbench.py): `app/src/CAD_0/ui/sketch_workbench.py`
- [Sketch Canvas](https://github.com/mariow98/cad_zero/blob/main/app/src/CAD_0/ui/sketch_canvas.py): `app/src/CAD_0/ui/sketch_canvas.py`
- [3D Viewport](https://github.com/mariow98/cad_zero/blob/main/app/src/CAD_0/ui/viewport_widget.py): `app/src/CAD_0/ui/viewport_widget.py`

### Python Interfaces

- [Python API](https://github.com/mariow98/cad_zero/blob/main/app/src/CAD_0/__init__.py): `app/src/CAD_0/__init__.py`
- [CLI](https://github.com/mariow98/cad_zero/blob/main/bindings/python/CAD_0/cli.py): `bindings/python/CAD_0/cli.py`
- [Native Bindings](https://github.com/mariow98/cad_zero/blob/main/bindings/python/src/module.cpp): `bindings/python/src/module.cpp`

### Scene and Persistence

- [Feature Scene](https://github.com/mariow98/cad_zero/blob/main/core/scene/include/CAD_0/scene/scene.hpp): `core/scene/include/CAD_0/scene/scene.hpp`
- [Native Projects](https://github.com/mariow98/cad_zero/blob/main/core/io/src/native.cpp): `core/io/src/native.cpp`

### Geometry Kernel

- [SDF Kernel](https://github.com/mariow98/cad_zero/blob/main/core/sdf/include/CAD_0/sdf/operators.hpp): `core/sdf/include/CAD_0/sdf/operators.hpp`
- [Sketch Profiles](https://github.com/mariow98/cad_zero/blob/main/core/sdf/include/CAD_0/sdf/sketch_profile.hpp): `core/sdf/include/CAD_0/sdf/sketch_profile.hpp`
- [Sketch Constraints](https://github.com/mariow98/cad_zero/blob/main/core/sdf/include/CAD_0/sdf/sketch_solver.hpp): `core/sdf/include/CAD_0/sdf/sketch_solver.hpp`
- [SDF Meshing](https://github.com/mariow98/cad_zero/blob/main/core/sdf/src/mesh_extract.cpp): `core/sdf/src/mesh_extract.cpp`
- [Exact B-Rep](https://github.com/mariow98/cad_zero/blob/main/core/brep/src/boolean.cpp): `core/brep/src/boolean.cpp`
- [B-Rep Topology](https://github.com/mariow98/cad_zero/blob/main/core/brep/include/CAD_0/brep/topology.hpp): `core/brep/include/CAD_0/brep/topology.hpp`
- [Representation Bridge](https://github.com/mariow98/cad_zero/blob/main/core/bridge/src/brep_to_sdf.cpp): `core/bridge/src/brep_to_sdf.cpp`
- [Rendering Engine](https://github.com/mariow98/cad_zero/blob/main/core/viewport/src/renderer.cpp): `core/viewport/src/renderer.cpp`

### Interchange

- [Mesh Import Export](https://github.com/mariow98/cad_zero/blob/main/core/io/src/obj.cpp): `core/io/src/obj.cpp`
- [Body Reports](https://github.com/mariow98/cad_zero/blob/main/bindings/python/CAD_0/report.py): `bindings/python/CAD_0/report.py`

### Other components

- **CAD User**

## Connections

- CAD User → Desktop App: models in
- Desktop App → Feature Scene: edits features (evidence: `app/src/CAD_0/ui/main_window.py`)
- Desktop App → Native Projects: saves projects (evidence: `app/src/CAD_0/ui/main_window.py`)
- Desktop App → 3D Viewport: displays model (evidence: `app/src/CAD_0/ui/main_window.py`)
- Desktop App → Sketch Workbench: opens workbench (evidence: `app/src/CAD_0/ui/main_window.py`)
- Sketch Workbench → Sketch Canvas: edits profiles
- Feature Scene → SDF Kernel: dispatches SDF (evidence: `core/scene/include/CAD_0/scene/scene.hpp`)
- Feature Scene → Exact B-Rep: dispatches B-Rep (evidence: `core/scene/include/CAD_0/scene/scene.hpp`)
- Feature Scene → Representation Bridge: converts shapes (evidence: `core/scene/include/CAD_0/scene/scene.hpp`)
- Feature Scene → SDF Meshing: extracts meshes (evidence: `core/scene/include/CAD_0/scene/scene.hpp`)
- Sketch Workbench → Sketch Profiles: creates profiles
- Feature Scene → Sketch Constraints: stores sketch constraints (evidence: `core/scene/include/CAD_0/scene/scene.hpp`)
- Sketch Profiles → SDF Kernel: extrudes to solid
- SDF Kernel → SDF Meshing: extracts surface
- Exact B-Rep → B-Rep Topology: operates on topology (evidence: `core/brep/src/boolean.cpp`)
- 3D Viewport → Rendering Engine: renders scene
- Python API → Native Bindings: exposes kernel
- CLI → Python API: uses package
- Python API → Feature Scene: creates scenes
- Python API → Mesh Import Export: imports exports
- Python API → Native Projects: saves loads
- Python API → Body Reports: reports bodies (evidence: `bindings/python/CAD_0/report.py`)
- Mesh Import Export → SDF Meshing: exports meshes
