# utlco/utl-tcnc architecture

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

- Interactive diagram: https://gitdiagram.com/utlco/utl-tcnc
- Repository: https://github.com/utlco/utl-tcnc

## Overview

TCNC is an Inkscape extension and standalone CLI that turns SVG paths into CNC G-code for tangential 3.5-axis machines. The main workflow is SVG selection and geometry conversion, CAM toolpath processing, then machine-code generation; optional preview and brush-specific operations extend that flow. The source excerpts show key CAM and G-code behavior, but not the full extension orchestration, so uncertain connections are omitted.

Main entry points: [`src/tcnc/tcnc.py`](https://github.com/utlco/utl-tcnc/blob/main/src/tcnc/tcnc.py) (TCNC extension), [`src/tcnc/simplecam.py`](https://github.com/utlco/utl-tcnc/blob/main/src/tcnc/simplecam.py) (Simple CAM), [`src/tcnc/gcode.py`](https://github.com/utlco/utl-tcnc/blob/main/src/tcnc/gcode.py) (G-code generator), [`src/tcnc/paintcam.py`](https://github.com/utlco/utl-tcnc/blob/main/src/tcnc/paintcam.py) (Brush CAM)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_entry["Input and orchestration"]
  node_svg_input["SVG selection"]
  node_extension["TCNC extension<br/>[tcnc.py]"]
  node_svg_conversion["SVG conversion<br/>[tcnc.py]"]
end

subgraph group_geometry["Toolpath geometry"]
  node_toolpath_model["Toolpath model<br/>[toolpath.py]"]
  node_fillet["Path fillets<br/>[fillet.py]"]
  node_offset["Path offsets<br/>[offset.py]"]
end

subgraph group_cam["CAM processing"]
  node_simple_cam["Simple CAM<br/>[simplecam.py]"]
  node_paint_cam["Brush CAM<br/>[paintcam.py]"]
end

subgraph group_output["Machine output"]
  node_gcode_generator["G-code generator<br/>[gcode.py]"]
  node_svg_preview["SVG preview<br/>[gcodesvg.py]"]
end

node_operator(("Operator"))
node_machine(("LinuxCNC machine"))

node_operator -->|"selects paths"| node_svg_input
node_svg_input -.->|"provides selection"| node_extension
node_extension -->|"converts paths"| node_svg_conversion
node_extension -->|"configures CAM"| node_paint_cam
node_extension -->|"configures output"| node_gcode_generator
node_extension -->|"configures preview"| node_svg_preview
node_svg_conversion -.->|"creates paths"| node_toolpath_model
node_simple_cam -->|"processes paths"| node_toolpath_model
node_simple_cam -->|"adds fillets"| node_fillet
node_simple_cam -->|"applies offsets"| node_offset
node_paint_cam -->|"extends CAM"| node_simple_cam
node_paint_cam -->|"emits commands"| node_gcode_generator
node_gcode_generator -->|"renders preview"| node_svg_preview
node_gcode_generator -->|"generates G-code for"| node_machine

click node_extension "https://github.com/utlco/utl-tcnc/blob/main/src/tcnc/tcnc.py"
click node_svg_conversion "https://github.com/utlco/utl-tcnc/blob/main/src/tcnc/tcnc.py"
click node_toolpath_model "https://github.com/utlco/utl-tcnc/blob/main/src/tcnc/toolpath.py"
click node_fillet "https://github.com/utlco/utl-tcnc/blob/main/src/tcnc/fillet.py"
click node_offset "https://github.com/utlco/utl-tcnc/blob/main/src/tcnc/offset.py"
click node_simple_cam "https://github.com/utlco/utl-tcnc/blob/main/src/tcnc/simplecam.py"
click node_paint_cam "https://github.com/utlco/utl-tcnc/blob/main/src/tcnc/paintcam.py"
click node_gcode_generator "https://github.com/utlco/utl-tcnc/blob/main/src/tcnc/gcode.py"
click node_svg_preview "https://github.com/utlco/utl-tcnc/blob/main/src/tcnc/gcodesvg.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_svg_input,node_extension,node_svg_conversion toneBlue
class node_toolpath_model,node_fillet,node_offset toneAmber
class node_simple_cam,node_paint_cam toneMint
class node_gcode_generator,node_svg_preview toneRose
class node_operator,node_machine toneIndigo
```

## Components

### Input and orchestration

- **SVG selection**
- [TCNC extension](https://github.com/utlco/utl-tcnc/blob/main/src/tcnc/tcnc.py): `src/tcnc/tcnc.py`
- [SVG conversion](https://github.com/utlco/utl-tcnc/blob/main/src/tcnc/tcnc.py): `src/tcnc/tcnc.py`

### Toolpath geometry

- [Toolpath model](https://github.com/utlco/utl-tcnc/blob/main/src/tcnc/toolpath.py): `src/tcnc/toolpath.py`
- [Path fillets](https://github.com/utlco/utl-tcnc/blob/main/src/tcnc/fillet.py): `src/tcnc/fillet.py`
- [Path offsets](https://github.com/utlco/utl-tcnc/blob/main/src/tcnc/offset.py): `src/tcnc/offset.py`

### CAM processing

- [Simple CAM](https://github.com/utlco/utl-tcnc/blob/main/src/tcnc/simplecam.py): `src/tcnc/simplecam.py`
- [Brush CAM](https://github.com/utlco/utl-tcnc/blob/main/src/tcnc/paintcam.py): `src/tcnc/paintcam.py`

### Machine output

- [G-code generator](https://github.com/utlco/utl-tcnc/blob/main/src/tcnc/gcode.py): `src/tcnc/gcode.py`
- [SVG preview](https://github.com/utlco/utl-tcnc/blob/main/src/tcnc/gcodesvg.py): `src/tcnc/gcodesvg.py`

### Other components

- **Operator**
- **LinuxCNC machine**

## Connections

- Operator → SVG selection: selects paths (evidence: `README.rst`)
- SVG selection → TCNC extension: provides selection
- TCNC extension → SVG conversion: converts paths (evidence: `src/tcnc/tcnc.py`)
- TCNC extension → Brush CAM: configures CAM (evidence: `src/tcnc/tcnc.py`)
- TCNC extension → G-code generator: configures output (evidence: `src/tcnc/tcnc.py`)
- TCNC extension → SVG preview: configures preview (evidence: `src/tcnc/tcnc.py`)
- SVG conversion → Toolpath model: creates paths
- Simple CAM → Toolpath model: processes paths (evidence: `src/tcnc/simplecam.py`)
- Simple CAM → Path fillets: adds fillets (evidence: `src/tcnc/simplecam.py`)
- Simple CAM → Path offsets: applies offsets (evidence: `src/tcnc/simplecam.py`)
- Brush CAM → Simple CAM: extends CAM (evidence: `src/tcnc/paintcam.py`)
- Brush CAM → G-code generator: emits commands (evidence: `src/tcnc/paintcam.py`)
- G-code generator → SVG preview: renders preview (evidence: `src/tcnc/gcodesvg.py`)
- G-code generator → LinuxCNC machine: generates G-code for (evidence: `README.rst`)
