# lucasskrewer/dnc_micro_toolkit architecture

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

- Interactive diagram: https://gitdiagram.com/lucasskrewer/dnc_micro_toolkit
- Repository: https://github.com/lucasskrewer/dnc_micro_toolkit

## Overview

DNC Micro Toolkit moves G-code between PCs and CNC machines over serial, Fanuc FOCAS, or a reverse-engineered WiFi DNC box. Operators can send from the shop-floor panel, receive programs automatically where supported, or use a WebDAV share for direct file access. Separate tools probe Fanuc identity, read telemetry, and validate box behavior against real hardware. Edges follow the README and shown imports/calls; unsampled implementation details are not expanded.

Main entry points: [`focas.py`](https://github.com/lucasskrewer/dnc_micro_toolkit/blob/main/focas.py) (FOCAS library), [`transport.py`](https://github.com/lucasskrewer/dnc_micro_toolkit/blob/main/transport.py) (Transport interface), [`dnc_tftp.py`](https://github.com/lucasskrewer/dnc_micro_toolkit/blob/main/dnc_tftp.py) (DNC-box protocol), [`dnc_web.py`](https://github.com/lucasskrewer/dnc_micro_toolkit/blob/main/dnc_web.py) (Shop-floor panel)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_operations["Shop-floor access"]
  node_web_panel["Shop-floor panel<br/>[dnc_web.py]"]
  node_webdav["WebDAV share<br/>[dnc_webdav.py]"]
end

subgraph group_routing["Transport routing"]
  node_transport["Transport interface<br/>[transport.py]"]
  node_config["Runtime configuration<br/>[config.py]"]
  node_transfer_log[("Transfer history<br/>[transfer_log.py]")]
end

subgraph group_machine_io["Machine connections"]
  node_serial_transport["Serial transport<br/>[transport.py]"]
  node_serial_adapter["Serial adapter<br/>[serial_adapter.py]"]
  node_dnc_transport["DNC-box transport<br/>[transport.py]"]
  node_dnc_protocol["DNC-box protocol<br/>[dnc_tftp.py]"]
  node_focas_transport["FOCAS transport<br/>[transport.py]"]
  node_focas_transfer["FOCAS transfers<br/>[focas_transfer.py]"]
  node_focas_api["FOCAS library<br/>[focas.py]"]
end

subgraph group_insight["Inspection and records"]
  node_probe["FOCAS probe<br/>[focas_probe.py]"]
  node_telemetry["Machine telemetry<br/>[focas_telemetry.py]"]
  node_hardware_check["Hardware acceptance<br/>[hardware_check.py]"]
end

node_operator(("Operator"))
node_serial_cnc(("Serial CNC"))
node_dnc_box(("WiFi DNC box"))
node_fanuc_cnc(("Fanuc CNC"))

node_operator -->|"uses"| node_web_panel
node_web_panel -->|"drives"| node_transport
node_web_panel -->|"records transfers"| node_transfer_log
node_operator -->|"maps share"| node_webdav
node_webdav -->|"reads and writes"| node_dnc_protocol
node_transport -->|"selects"| node_serial_transport
node_transport -->|"selects"| node_dnc_transport
node_transport -->|"selects"| node_focas_transport
node_serial_transport -->|"delegates to"| node_serial_adapter
node_serial_adapter -.->|"transfers programs"| node_serial_cnc
node_dnc_transport -->|"delegates to"| node_dnc_protocol
node_dnc_protocol -->|"speaks protocol"| node_dnc_box
node_focas_transport -->|"delegates to"| node_focas_transfer
node_focas_transport -->|"connects through"| node_focas_api
node_focas_transfer -->|"uses"| node_focas_api
node_focas_api -->|"connects to"| node_fanuc_cnc
node_probe -->|"probes through"| node_focas_api
node_telemetry -->|"reads through"| node_focas_api
node_hardware_check -->|"validates"| node_dnc_protocol
node_hardware_check -->|"checks firmware"| node_dnc_box

click node_web_panel "https://github.com/lucasskrewer/dnc_micro_toolkit/blob/main/dnc_web.py"
click node_webdav "https://github.com/lucasskrewer/dnc_micro_toolkit/blob/main/dnc_webdav.py"
click node_transport "https://github.com/lucasskrewer/dnc_micro_toolkit/blob/main/transport.py"
click node_config "https://github.com/lucasskrewer/dnc_micro_toolkit/blob/main/config.py"
click node_transfer_log "https://github.com/lucasskrewer/dnc_micro_toolkit/blob/main/transfer_log.py"
click node_serial_transport "https://github.com/lucasskrewer/dnc_micro_toolkit/blob/main/transport.py"
click node_serial_adapter "https://github.com/lucasskrewer/dnc_micro_toolkit/blob/main/serial_adapter.py"
click node_dnc_transport "https://github.com/lucasskrewer/dnc_micro_toolkit/blob/main/transport.py"
click node_dnc_protocol "https://github.com/lucasskrewer/dnc_micro_toolkit/blob/main/dnc_tftp.py"
click node_focas_transport "https://github.com/lucasskrewer/dnc_micro_toolkit/blob/main/transport.py"
click node_focas_transfer "https://github.com/lucasskrewer/dnc_micro_toolkit/blob/main/focas_transfer.py"
click node_focas_api "https://github.com/lucasskrewer/dnc_micro_toolkit/blob/main/focas.py"
click node_probe "https://github.com/lucasskrewer/dnc_micro_toolkit/blob/main/focas_probe.py"
click node_telemetry "https://github.com/lucasskrewer/dnc_micro_toolkit/blob/main/focas_telemetry.py"
click node_hardware_check "https://github.com/lucasskrewer/dnc_micro_toolkit/blob/main/hardware_check.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_web_panel,node_webdav toneBlue
class node_transport,node_config,node_transfer_log toneAmber
class node_serial_transport,node_serial_adapter,node_dnc_transport,node_dnc_protocol,node_focas_transport,node_focas_transfer,node_focas_api toneMint
class node_probe,node_telemetry,node_hardware_check toneRose
class node_operator,node_serial_cnc,node_dnc_box,node_fanuc_cnc toneIndigo
```

## Components

### Shop-floor access

- [Shop-floor panel](https://github.com/lucasskrewer/dnc_micro_toolkit/blob/main/dnc_web.py): `dnc_web.py`
- [WebDAV share](https://github.com/lucasskrewer/dnc_micro_toolkit/blob/main/dnc_webdav.py): `dnc_webdav.py`

### Transport routing

- [Transport interface](https://github.com/lucasskrewer/dnc_micro_toolkit/blob/main/transport.py): `transport.py`
- [Runtime configuration](https://github.com/lucasskrewer/dnc_micro_toolkit/blob/main/config.py): `config.py`
- [Transfer history](https://github.com/lucasskrewer/dnc_micro_toolkit/blob/main/transfer_log.py): `transfer_log.py`

### Machine connections

- [Serial transport](https://github.com/lucasskrewer/dnc_micro_toolkit/blob/main/transport.py): `transport.py`
- [Serial adapter](https://github.com/lucasskrewer/dnc_micro_toolkit/blob/main/serial_adapter.py): `serial_adapter.py`
- [DNC-box transport](https://github.com/lucasskrewer/dnc_micro_toolkit/blob/main/transport.py): `transport.py`
- [DNC-box protocol](https://github.com/lucasskrewer/dnc_micro_toolkit/blob/main/dnc_tftp.py): `dnc_tftp.py`
- [FOCAS transport](https://github.com/lucasskrewer/dnc_micro_toolkit/blob/main/transport.py): `transport.py`
- [FOCAS transfers](https://github.com/lucasskrewer/dnc_micro_toolkit/blob/main/focas_transfer.py): `focas_transfer.py`
- [FOCAS library](https://github.com/lucasskrewer/dnc_micro_toolkit/blob/main/focas.py): `focas.py`

### Inspection and records

- [FOCAS probe](https://github.com/lucasskrewer/dnc_micro_toolkit/blob/main/focas_probe.py): `focas_probe.py`
- [Machine telemetry](https://github.com/lucasskrewer/dnc_micro_toolkit/blob/main/focas_telemetry.py): `focas_telemetry.py`
- [Hardware acceptance](https://github.com/lucasskrewer/dnc_micro_toolkit/blob/main/hardware_check.py): `hardware_check.py`

### Other components

- **Operator**
- **Serial CNC**
- **WiFi DNC box**
- **Fanuc CNC**

## Connections

- Operator → Shop-floor panel: uses (evidence: `README.md`)
- Shop-floor panel → Transport interface: drives (evidence: `dnc_web.py`)
- Shop-floor panel → Transfer history: records transfers (evidence: `dnc_web.py`)
- Operator → WebDAV share: maps share (evidence: `README.md`)
- WebDAV share → DNC-box protocol: reads and writes (evidence: `dnc_webdav.py`)
- Transport interface → Serial transport: selects (evidence: `transport.py`)
- Transport interface → DNC-box transport: selects (evidence: `transport.py`)
- Transport interface → FOCAS transport: selects (evidence: `transport.py`)
- Serial transport → Serial adapter: delegates to (evidence: `transport.py`)
- Serial adapter → Serial CNC: transfers programs
- DNC-box transport → DNC-box protocol: delegates to (evidence: `transport.py`)
- DNC-box protocol → WiFi DNC box: speaks protocol (evidence: `dnc_tftp.py`)
- FOCAS transport → FOCAS transfers: delegates to (evidence: `transport.py`)
- FOCAS transport → FOCAS library: connects through (evidence: `transport.py`)
- FOCAS transfers → FOCAS library: uses (evidence: `focas_transfer.py`)
- FOCAS library → Fanuc CNC: connects to (evidence: `focas.py`)
- FOCAS probe → FOCAS library: probes through (evidence: `focas_probe.py`)
- Machine telemetry → FOCAS library: reads through (evidence: `focas_telemetry.py`)
- Hardware acceptance → DNC-box protocol: validates (evidence: `hardware_check.py`)
- Hardware acceptance → WiFi DNC box: checks firmware (evidence: `README.md`)
