# linuxcnc/linuxcnc architecture

> Architecture diagram of the GitHub repository linuxcnc/linuxcnc, 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
- Repository: https://github.com/linuxcnc/linuxcnc

## Overview

LinuxCNC controls CNC machinery, with QtVCP screens providing operator-facing controls and a lower-level HAL interface for machine interaction. The README identifies milling, turning, printing, laser, plasma, and robotic use cases; the tree also shows dedicated plasma and G-code utilities. The sampled evidence chiefly establishes screen-to-widget references and core HAL bindings, not the full motion-control call chain. Dashed links mark documented product scope or unverified integration; unsampled subsystems are represented at supported directory paths.

Main entry points: [`share/qtvcp/screens/qtdragon/qtdragon_handler.py`](https://github.com/linuxcnc/linuxcnc/blob/master/share/qtvcp/screens/qtdragon/qtdragon_handler.py) (QtDragon screen), [`share/qtvcp/screens/qtplasmac/qtplasmac_handler.py`](https://github.com/linuxcnc/linuxcnc/blob/master/share/qtvcp/screens/qtplasmac/qtplasmac_handler.py) (Plasma screen), [`src/emc/motion/motion.c`](https://github.com/linuxcnc/linuxcnc/blob/master/src/emc/motion/motion.c) (Motion control), [`lib/python/qtvcp/core.py`](https://github.com/linuxcnc/linuxcnc/blob/master/lib/python/qtvcp/core.py) (Machine status)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_operator["Operator interfaces"]
  node_qtdragon["QtDragon screen"]
  node_filemanager["Program files<br/>[file_manager.py]"]
  node_editor["G-code editor<br/>[gcode_editor.py]"]
  node_mdi["MDI commands<br/>[mdi_line.py]"]
  node_keybindings["Key bindings<br/>[keybindings.py]"]
  node_offsets["Coordinate offsets"]
  node_tooloffsets["Tool offsets<br/>[tool_offsetview.py]"]
  node_basicprobe["Basic probing<br/>[basic_probe.py]"]
  node_stylesheet["Screen styling"]
  node_tooltable["Tool table view<br/>[tool_offsetview.py]"]
end

subgraph group_gcode["Program tools"]
  node_gcodeutility["G-code utilities"]
  node_ngcgui["NGC program tools<br/>[ngcgui.py]"]
end

subgraph group_plasma["Plasma workflow"]
  node_plasmac["Plasma screen"]
  node_plasmacconversational["Plasma shapes<br/>[conversational.py]"]
  node_plasmacinterlocks["Plasma interlocks<br/>[interlock_rules.py]"]
end

subgraph group_runtime["Machine runtime"]
  node_status["Machine status<br/>[core.py]"]
  node_motion["Motion control<br/>[motion.c]"]
  node_task["Task control<br/>[signalhandler.cc]"]
  node_interpreter["G-code interpreter<br/>[interp_convert.cc]"]
  node_kinematics["Machine kinematics<br/>[trivkins.c]"]
end

subgraph group_hardware["Hardware interface"]
  node_hal["HAL interface<br/>[hal.py]"]
  node_machine(("CNC machine"))
end

node_operator(("CNC operator"))

node_operator -.->|"operates"| node_qtdragon
node_qtdragon -->|"uses"| node_filemanager
node_qtdragon -->|"uses"| node_editor
node_qtdragon -->|"uses"| node_mdi
node_qtdragon -->|"uses"| node_keybindings
node_qtdragon -->|"uses"| node_offsets
node_qtdragon -->|"uses"| node_tooloffsets
node_qtdragon -->|"uses"| node_stylesheet
node_qtdragon -->|"uses"| node_ngcgui
node_qtdragon -->|"uses"| node_gcodeutility
node_qtdragon -->|"uses"| node_status
node_qtdragon -.->|"uses"| node_basicprobe
node_plasmac -->|"uses"| node_plasmacconversational
node_plasmac -->|"uses"| node_plasmacinterlocks
node_status -->|"imports"| node_hal
node_hal -.->|"interfaces"| node_machine
node_motion -.->|"controls"| node_machine
node_operator -.->|"uses"| node_plasmac
node_operator -.->|"prepares programs"| node_gcodeutility
node_motion -.->|"uses"| node_kinematics
node_task -.->|"dispatches"| node_interpreter
node_interpreter -.->|"commands"| node_motion

click node_qtdragon "https://github.com/linuxcnc/linuxcnc/blob/master/share/qtvcp/screens/qtdragon/qtdragon_handler.py"
click node_filemanager "https://github.com/linuxcnc/linuxcnc/blob/master/lib/python/qtvcp/widgets/file_manager.py"
click node_editor "https://github.com/linuxcnc/linuxcnc/blob/master/lib/python/qtvcp/widgets/gcode_editor.py"
click node_mdi "https://github.com/linuxcnc/linuxcnc/blob/master/lib/python/qtvcp/widgets/mdi_line.py"
click node_keybindings "https://github.com/linuxcnc/linuxcnc/blob/master/lib/python/qtvcp/lib/keybindings.py"
click node_offsets "https://github.com/linuxcnc/linuxcnc/blob/master/lib/python/qtvcp/widgets/origin_offsetview.py"
click node_tooloffsets "https://github.com/linuxcnc/linuxcnc/blob/master/lib/python/qtvcp/widgets/tool_offsetview.py"
click node_status "https://github.com/linuxcnc/linuxcnc/blob/master/lib/python/qtvcp/core.py"
click node_motion "https://github.com/linuxcnc/linuxcnc/blob/master/src/emc/motion/motion.c"
click node_task "https://github.com/linuxcnc/linuxcnc/blob/master/src/emc/task/signalhandler.cc"
click node_interpreter "https://github.com/linuxcnc/linuxcnc/blob/master/src/emc/rs274ngc/interp_convert.cc"
click node_kinematics "https://github.com/linuxcnc/linuxcnc/blob/master/src/emc/kinematics/trivkins.c"
click node_hal "https://github.com/linuxcnc/linuxcnc/blob/master/lib/python/hal.py"
click node_gcodeutility "https://github.com/linuxcnc/linuxcnc/tree/master/lib/python/qtvcp/lib/gcode_utility"
click node_ngcgui "https://github.com/linuxcnc/linuxcnc/blob/master/lib/python/qtvcp/lib/qt_ngcgui/ngcgui.py"
click node_basicprobe "https://github.com/linuxcnc/linuxcnc/blob/master/lib/python/qtvcp/widgets/basic_probe.py"
click node_plasmac "https://github.com/linuxcnc/linuxcnc/blob/master/share/qtvcp/screens/qtplasmac/qtplasmac_handler.py"
click node_plasmacconversational "https://github.com/linuxcnc/linuxcnc/blob/master/lib/python/qtvcp/lib/qtplasmac/conversational.py"
click node_plasmacinterlocks "https://github.com/linuxcnc/linuxcnc/blob/master/lib/python/qtvcp/lib/qtplasmac/interlock_rules.py"
click node_stylesheet "https://github.com/linuxcnc/linuxcnc/blob/master/lib/python/qtvcp/widgets/stylesheeteditor.py"
click node_tooltable "https://github.com/linuxcnc/linuxcnc/blob/master/lib/python/qtvcp/widgets/tool_offsetview.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_qtdragon,node_filemanager,node_editor,node_mdi,node_keybindings,node_offsets,node_tooloffsets,node_basicprobe,node_stylesheet,node_tooltable toneBlue
class node_gcodeutility,node_ngcgui toneAmber
class node_plasmac,node_plasmacconversational,node_plasmacinterlocks toneMint
class node_status,node_motion,node_task,node_interpreter,node_kinematics toneRose
class node_hal,node_machine,node_operator toneIndigo
```

## Components

### Operator interfaces

- [QtDragon screen](https://github.com/linuxcnc/linuxcnc/blob/master/share/qtvcp/screens/qtdragon/qtdragon_handler.py): `share/qtvcp/screens/qtdragon/qtdragon_handler.py`
- [Program files](https://github.com/linuxcnc/linuxcnc/blob/master/lib/python/qtvcp/widgets/file_manager.py): `lib/python/qtvcp/widgets/file_manager.py`
- [G-code editor](https://github.com/linuxcnc/linuxcnc/blob/master/lib/python/qtvcp/widgets/gcode_editor.py): `lib/python/qtvcp/widgets/gcode_editor.py`
- [MDI commands](https://github.com/linuxcnc/linuxcnc/blob/master/lib/python/qtvcp/widgets/mdi_line.py): `lib/python/qtvcp/widgets/mdi_line.py`
- [Key bindings](https://github.com/linuxcnc/linuxcnc/blob/master/lib/python/qtvcp/lib/keybindings.py): `lib/python/qtvcp/lib/keybindings.py`
- [Coordinate offsets](https://github.com/linuxcnc/linuxcnc/blob/master/lib/python/qtvcp/widgets/origin_offsetview.py): `lib/python/qtvcp/widgets/origin_offsetview.py`
- [Tool offsets](https://github.com/linuxcnc/linuxcnc/blob/master/lib/python/qtvcp/widgets/tool_offsetview.py): `lib/python/qtvcp/widgets/tool_offsetview.py`
- [Basic probing](https://github.com/linuxcnc/linuxcnc/blob/master/lib/python/qtvcp/widgets/basic_probe.py): `lib/python/qtvcp/widgets/basic_probe.py`
- [Screen styling](https://github.com/linuxcnc/linuxcnc/blob/master/lib/python/qtvcp/widgets/stylesheeteditor.py): `lib/python/qtvcp/widgets/stylesheeteditor.py`
- [Tool table view](https://github.com/linuxcnc/linuxcnc/blob/master/lib/python/qtvcp/widgets/tool_offsetview.py): `lib/python/qtvcp/widgets/tool_offsetview.py`

### Program tools

- [G-code utilities](https://github.com/linuxcnc/linuxcnc/tree/master/lib/python/qtvcp/lib/gcode_utility): `lib/python/qtvcp/lib/gcode_utility`
- [NGC program tools](https://github.com/linuxcnc/linuxcnc/blob/master/lib/python/qtvcp/lib/qt_ngcgui/ngcgui.py): `lib/python/qtvcp/lib/qt_ngcgui/ngcgui.py`

### Plasma workflow

- [Plasma screen](https://github.com/linuxcnc/linuxcnc/blob/master/share/qtvcp/screens/qtplasmac/qtplasmac_handler.py): `share/qtvcp/screens/qtplasmac/qtplasmac_handler.py`
- [Plasma shapes](https://github.com/linuxcnc/linuxcnc/blob/master/lib/python/qtvcp/lib/qtplasmac/conversational.py): `lib/python/qtvcp/lib/qtplasmac/conversational.py`
- [Plasma interlocks](https://github.com/linuxcnc/linuxcnc/blob/master/lib/python/qtvcp/lib/qtplasmac/interlock_rules.py): `lib/python/qtvcp/lib/qtplasmac/interlock_rules.py`

### Machine runtime

- [Machine status](https://github.com/linuxcnc/linuxcnc/blob/master/lib/python/qtvcp/core.py): `lib/python/qtvcp/core.py`
- [Motion control](https://github.com/linuxcnc/linuxcnc/blob/master/src/emc/motion/motion.c): `src/emc/motion/motion.c`
- [Task control](https://github.com/linuxcnc/linuxcnc/blob/master/src/emc/task/signalhandler.cc): `src/emc/task/signalhandler.cc`
- [G-code interpreter](https://github.com/linuxcnc/linuxcnc/blob/master/src/emc/rs274ngc/interp_convert.cc): `src/emc/rs274ngc/interp_convert.cc`
- [Machine kinematics](https://github.com/linuxcnc/linuxcnc/blob/master/src/emc/kinematics/trivkins.c): `src/emc/kinematics/trivkins.c`

### Hardware interface

- [HAL interface](https://github.com/linuxcnc/linuxcnc/blob/master/lib/python/hal.py): `lib/python/hal.py`
- **CNC machine**

### Other components

- **CNC operator**

## Connections

- CNC operator → QtDragon screen: operates
- QtDragon screen → Program files: uses (evidence: `share/qtvcp/screens/qtdragon/qtdragon_handler.py`)
- QtDragon screen → G-code editor: uses (evidence: `share/qtvcp/screens/qtdragon/qtdragon_handler.py`)
- QtDragon screen → MDI commands: uses (evidence: `share/qtvcp/screens/qtdragon/qtdragon_handler.py`)
- QtDragon screen → Key bindings: uses (evidence: `share/qtvcp/screens/qtdragon/qtdragon_handler.py`)
- QtDragon screen → Coordinate offsets: uses (evidence: `share/qtvcp/screens/qtdragon/qtdragon_handler.py`)
- QtDragon screen → Tool offsets: uses (evidence: `share/qtvcp/screens/qtdragon/qtdragon_handler.py`)
- QtDragon screen → Screen styling: uses (evidence: `share/qtvcp/screens/qtdragon/qtdragon_handler.py`)
- QtDragon screen → NGC program tools: uses (evidence: `share/qtvcp/screens/qtdragon/qtdragon_handler.py`)
- QtDragon screen → G-code utilities: uses (evidence: `share/qtvcp/screens/qtdragon/qtdragon_handler.py`)
- QtDragon screen → Machine status: uses (evidence: `share/qtvcp/screens/qtdragon/qtdragon_handler.py`)
- QtDragon screen → Basic probing: uses (evidence: `share/qtvcp/screens/qtdragon/qtdragon_handler.py`)
- Plasma screen → Plasma shapes: uses (evidence: `share/qtvcp/screens/qtplasmac/qtplasmac_handler.py`)
- Plasma screen → Plasma interlocks: uses (evidence: `share/qtvcp/screens/qtplasmac/qtplasmac_handler.py`)
- Machine status → HAL interface: imports (evidence: `lib/python/qtvcp/core.py`)
- HAL interface → CNC machine: interfaces (evidence: `lib/python/hal.py`)
- Motion control → CNC machine: controls
- CNC operator → Plasma screen: uses
- CNC operator → G-code utilities: prepares programs
- Motion control → Machine kinematics: uses
- Task control → G-code interpreter: dispatches
- G-code interpreter → Motion control: commands
