# linuxcnc/linuxcnc-gbp architecture

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

- Interactive diagram: https://gitdiagram.com/linuxcnc/linuxcnc-gbp
- Repository: https://github.com/linuxcnc/linuxcnc-gbp

## Overview

LinuxCNC is an open-source CNC control system for mills, lathes, plasma cutters, robots, and other machinery. A principal user workflow is to operate a machine through a user interface, issue or load G-code, and have the control system execute motion. The tree exposes distinct interface, interpreter, task, motion, kinematics, and HAL areas; QTVCP also supplies machine-screen widgets and utilities. Most controller internals were not sampled, so their relationships are not asserted here; dashed links mark the high-level workflow inferred from the product description.

Main entry points: [`share/qtvcp/screens`](https://github.com/linuxcnc/linuxcnc-gbp/tree/debian/unstable/share/qtvcp/screens) (QTVCP screens), [`src/emc/motion/motion.c`](https://github.com/linuxcnc/linuxcnc-gbp/blob/debian/unstable/src/emc/motion/motion.c) (Motion control), [`src/emc/task/emctask.cc`](https://github.com/linuxcnc/linuxcnc-gbp/blob/debian/unstable/src/emc/task/emctask.cc) (Task controller), [`lib/python/qtvcp/core.py`](https://github.com/linuxcnc/linuxcnc-gbp/blob/debian/unstable/lib/python/qtvcp/core.py) (QTVCP core)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_interfaces["Machine interfaces"]
  node_qtvcp_screens["QTVCP screens"]
  node_qtvcp_core["QTVCP core<br/>[core.py]"]
  node_qhal_status["HAL and status<br/>[core.py]"]
end

subgraph group_programming["Program workflow"]
  node_gcode_editor["G-code editor<br/>[gcode_editor.py]"]
  node_file_manager["File manager<br/>[file_manager.py]"]
  node_mdi_line["MDI input<br/>[mdi_line.py]"]
  node_gcode_utilities["G-code utilities"]
  node_ngcgui["NGC GUI<br/>[ngcgui.py]"]
end

subgraph group_control["CNC control"]
  node_interpreter["G-code interpreter<br/>[interpmodule.cc]"]
  node_task["Task controller<br/>[emctask.cc]"]
  node_motion["Motion control<br/>[motion.c]"]
  node_trajectory["Trajectory planner<br/>[tp.c]"]
  node_kinematics["Kinematics<br/>[kinematics.h]"]
end

subgraph group_hardware["Hardware interface"]
  node_hal_python["Python HAL API<br/>[hal.py]"]
  node_io_task["I/O task<br/>[ioControl.cc]"]
end

node_operator(("Machine operator"))
node_machine{{"CNC machinery"}}

node_operator -.->|"operates"| node_qtvcp_screens
node_qtvcp_screens -.->|"uses"| node_qtvcp_core
node_qtvcp_screens -.->|"uses"| node_gcode_editor
node_qtvcp_screens -.->|"uses"| node_file_manager
node_qtvcp_screens -.->|"uses"| node_mdi_line
node_qtvcp_screens -.->|"uses"| node_gcode_utilities
node_qtvcp_screens -.->|"uses"| node_ngcgui
node_qtvcp_core -->|"provides"| node_qhal_status
node_gcode_editor -.->|"loads and highlights"| node_interpreter
node_mdi_line -.->|"submits commands"| node_task
node_interpreter -.->|"provides interpreted commands"| node_task
node_task -.->|"commands motion"| node_motion
node_motion -.->|"plans motion"| node_trajectory
node_motion -.->|"uses transforms"| node_kinematics
node_qhal_status -.->|"interfaces with HAL"| node_hal_python
node_io_task -.->|"controls I/O"| node_machine
node_kinematics -.->|"maps machine motion"| node_machine

click node_qtvcp_screens "https://github.com/linuxcnc/linuxcnc-gbp/tree/debian/unstable/share/qtvcp/screens"
click node_qtvcp_core "https://github.com/linuxcnc/linuxcnc-gbp/blob/debian/unstable/lib/python/qtvcp/core.py"
click node_qhal_status "https://github.com/linuxcnc/linuxcnc-gbp/blob/debian/unstable/lib/python/qtvcp/core.py"
click node_gcode_editor "https://github.com/linuxcnc/linuxcnc-gbp/blob/debian/unstable/lib/python/qtvcp/widgets/gcode_editor.py"
click node_file_manager "https://github.com/linuxcnc/linuxcnc-gbp/blob/debian/unstable/lib/python/qtvcp/widgets/file_manager.py"
click node_mdi_line "https://github.com/linuxcnc/linuxcnc-gbp/blob/debian/unstable/lib/python/qtvcp/widgets/mdi_line.py"
click node_gcode_utilities "https://github.com/linuxcnc/linuxcnc-gbp/tree/debian/unstable/lib/python/qtvcp/lib/gcode_utility"
click node_ngcgui "https://github.com/linuxcnc/linuxcnc-gbp/blob/debian/unstable/lib/python/qtvcp/lib/qt_ngcgui/ngcgui.py"
click node_interpreter "https://github.com/linuxcnc/linuxcnc-gbp/blob/debian/unstable/src/emc/rs274ngc/interpmodule.cc"
click node_task "https://github.com/linuxcnc/linuxcnc-gbp/blob/debian/unstable/src/emc/task/emctask.cc"
click node_motion "https://github.com/linuxcnc/linuxcnc-gbp/blob/debian/unstable/src/emc/motion/motion.c"
click node_trajectory "https://github.com/linuxcnc/linuxcnc-gbp/blob/debian/unstable/src/emc/tp/tp.c"
click node_kinematics "https://github.com/linuxcnc/linuxcnc-gbp/blob/debian/unstable/src/emc/kinematics/kinematics.h"
click node_hal_python "https://github.com/linuxcnc/linuxcnc-gbp/blob/debian/unstable/lib/python/hal.py"
click node_io_task "https://github.com/linuxcnc/linuxcnc-gbp/blob/debian/unstable/src/emc/iotask/ioControl.cc"

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_qtvcp_screens,node_qtvcp_core,node_qhal_status toneBlue
class node_gcode_editor,node_file_manager,node_mdi_line,node_gcode_utilities,node_ngcgui toneAmber
class node_interpreter,node_task,node_motion,node_trajectory,node_kinematics toneMint
class node_hal_python,node_io_task toneRose
class node_operator,node_machine toneIndigo
```

## Components

### Machine interfaces

- [QTVCP screens](https://github.com/linuxcnc/linuxcnc-gbp/tree/debian/unstable/share/qtvcp/screens): `share/qtvcp/screens`
- [QTVCP core](https://github.com/linuxcnc/linuxcnc-gbp/blob/debian/unstable/lib/python/qtvcp/core.py): `lib/python/qtvcp/core.py`
- [HAL and status](https://github.com/linuxcnc/linuxcnc-gbp/blob/debian/unstable/lib/python/qtvcp/core.py): `lib/python/qtvcp/core.py`

### Program workflow

- [G-code editor](https://github.com/linuxcnc/linuxcnc-gbp/blob/debian/unstable/lib/python/qtvcp/widgets/gcode_editor.py): `lib/python/qtvcp/widgets/gcode_editor.py`
- [File manager](https://github.com/linuxcnc/linuxcnc-gbp/blob/debian/unstable/lib/python/qtvcp/widgets/file_manager.py): `lib/python/qtvcp/widgets/file_manager.py`
- [MDI input](https://github.com/linuxcnc/linuxcnc-gbp/blob/debian/unstable/lib/python/qtvcp/widgets/mdi_line.py): `lib/python/qtvcp/widgets/mdi_line.py`
- [G-code utilities](https://github.com/linuxcnc/linuxcnc-gbp/tree/debian/unstable/lib/python/qtvcp/lib/gcode_utility): `lib/python/qtvcp/lib/gcode_utility`
- [NGC GUI](https://github.com/linuxcnc/linuxcnc-gbp/blob/debian/unstable/lib/python/qtvcp/lib/qt_ngcgui/ngcgui.py): `lib/python/qtvcp/lib/qt_ngcgui/ngcgui.py`

### CNC control

- [G-code interpreter](https://github.com/linuxcnc/linuxcnc-gbp/blob/debian/unstable/src/emc/rs274ngc/interpmodule.cc): `src/emc/rs274ngc/interpmodule.cc`
- [Task controller](https://github.com/linuxcnc/linuxcnc-gbp/blob/debian/unstable/src/emc/task/emctask.cc): `src/emc/task/emctask.cc`
- [Motion control](https://github.com/linuxcnc/linuxcnc-gbp/blob/debian/unstable/src/emc/motion/motion.c): `src/emc/motion/motion.c`
- [Trajectory planner](https://github.com/linuxcnc/linuxcnc-gbp/blob/debian/unstable/src/emc/tp/tp.c): `src/emc/tp/tp.c`
- [Kinematics](https://github.com/linuxcnc/linuxcnc-gbp/blob/debian/unstable/src/emc/kinematics/kinematics.h): `src/emc/kinematics/kinematics.h`

### Hardware interface

- [Python HAL API](https://github.com/linuxcnc/linuxcnc-gbp/blob/debian/unstable/lib/python/hal.py): `lib/python/hal.py`
- [I/O task](https://github.com/linuxcnc/linuxcnc-gbp/blob/debian/unstable/src/emc/iotask/ioControl.cc): `src/emc/iotask/ioControl.cc`

### Other components

- **Machine operator**
- **CNC machinery**

## Connections

- Machine operator → QTVCP screens: operates
- QTVCP screens → QTVCP core: uses (evidence: `share/qtvcp/screens/qtdragon/qtdragon_handler.py`)
- QTVCP screens → G-code editor: uses (evidence: `share/qtvcp/screens/qtdragon/qtdragon_handler.py`)
- QTVCP screens → File manager: uses (evidence: `share/qtvcp/screens/qtdragon/qtdragon_handler.py`)
- QTVCP screens → MDI input: uses (evidence: `share/qtvcp/screens/qtdragon/qtdragon_handler.py`)
- QTVCP screens → G-code utilities: uses (evidence: `share/qtvcp/screens/qtdragon/qtdragon_handler.py`)
- QTVCP screens → NGC GUI: uses (evidence: `share/qtvcp/screens/qtdragon/qtdragon_handler.py`)
- QTVCP core → HAL and status: provides (evidence: `lib/python/qtvcp/core.py`)
- G-code editor → G-code interpreter: loads and highlights
- MDI input → Task controller: submits commands
- G-code interpreter → Task controller: provides interpreted commands
- Task controller → Motion control: commands motion
- Motion control → Trajectory planner: plans motion
- Motion control → Kinematics: uses transforms
- HAL and status → Python HAL API: interfaces with HAL (evidence: `lib/python/qtvcp/core.py`)
- I/O task → CNC machinery: controls I/O
- Kinematics → CNC machinery: maps machine motion
