# harmless0819-dev/mech-drawing-reader architecture

> Architecture diagram of the GitHub repository harmless0819-dev/mech-drawing-reader, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-09-30). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/harmless0819-dev/mech-drawing-reader
- Repository: https://github.com/harmless0819-dev/mech-drawing-reader

## Overview

mech-drawing-reader is a DSH skill package for reading Chinese/ISO mechanical drawings and producing evidence-anchored annotations plus structured JSON. Its documented workflow begins with channel routing, then extracts or interprets drawing information, records uncertainty and evidence, and validates the output. It also provides domain references, image/CAD utilities, CAD-overlay comparison, and annotation templates. The README documents the broad workflow; sampled source confirms specific DXF extraction, dimension parsing, scale calibration, and audit/validation links. Unsampled workflow details are represented only where documented.

Main entry points: [`SKILL.md`](https://github.com/harmless0819-dev/mech-drawing-reader/blob/main/SKILL.md) (Skill Workflow), [`workflows/routing.md`](https://github.com/harmless0819-dev/mech-drawing-reader/blob/main/workflows/routing.md) (Channel Routing), [`workflows/cad-output.md`](https://github.com/harmless0819-dev/mech-drawing-reader/blob/main/workflows/cad-output.md) (CAD Output Flow), [`scripts/audit.py`](https://github.com/harmless0819-dev/mech-drawing-reader/blob/main/scripts/audit.py) (Output Audit)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_workflow["Reading Workflow"]
  node_skill["Skill Workflow<br/>[SKILL.md]"]
  node_routing["Channel Routing<br/>[routing.md]"]
  node_cadoutput["CAD Output Flow<br/>[cad-output.md]"]
end

subgraph group_knowledge["Domain Knowledge"]
  node_references["Drawing References"]
end

subgraph group_tools["Drawing Tools"]
  node_probe["Format Probe<br/>[probe.py]"]
  node_pdf["PDF Extractor<br/>[pdf_extract.py]"]
  node_ocr["OCR<br/>[ocr.py]"]
  node_tiles["Image Tiling<br/>[tile.py]"]
  node_measurement["Pixel Measurement<br/>[measure.py]"]
  node_dxf["DXF Dimensions<br/>[dxf_dims.py]"]
  node_dimparse["Dimension Parser<br/>[dimparse.py]"]
  node_acad["AutoCAD Driver<br/>[acad_com.py]"]
  node_scale["CAD Calibration<br/>[cadscale.py]"]
  node_compare["CAD Comparison<br/>[cad_compare.py]"]
  node_diff["CAD Difference<br/>[cad_diff.py]"]
end

subgraph group_contracts["Output Assurance"]
  node_annotation["Annotation Template<br/>[annotation-doc.md]"]
  node_schema["Annotation Schema"]
  node_audit["Output Audit<br/>[audit.py]"]
  node_validator["Schema Validator<br/>[simplest_schema.py]"]
  node_scoring["Backtest Scoring<br/>[score.py]"]
end

node_reader(("Drawing Reader"))

node_reader -->|"uses"| node_skill
node_skill -->|"routes by channel"| node_routing
node_skill -->|"consults"| node_references
node_routing -->|"identifies format"| node_probe
node_routing -->|"extracts PDF"| node_pdf
node_routing -->|"reads images"| node_ocr
node_routing -->|"tiles images"| node_tiles
node_routing -->|"measures pixels"| node_measurement
node_routing -->|"extracts dimensions"| node_dxf
node_routing -->|"parses dimensions"| node_dimparse
node_skill -->|"produces document"| node_annotation
node_skill -->|"produces JSON"| node_schema
node_skill -->|"audits output"| node_audit
node_skill -->|"supports CAD output"| node_cadoutput
node_cadoutput -->|"drives AutoCAD"| node_acad
node_cadoutput -->|"compares overlay"| node_compare
node_cadoutput -->|"finds differences"| node_diff
node_compare -->|"calibrates scale"| node_scale
node_diff -->|"calibrates scale"| node_scale
node_audit -->|"validates schema"| node_validator
node_audit -->|"checks against"| node_schema
node_skill -->|"backtests results"| node_scoring

click node_skill "https://github.com/harmless0819-dev/mech-drawing-reader/blob/main/SKILL.md"
click node_routing "https://github.com/harmless0819-dev/mech-drawing-reader/blob/main/workflows/routing.md"
click node_cadoutput "https://github.com/harmless0819-dev/mech-drawing-reader/blob/main/workflows/cad-output.md"
click node_references "https://github.com/harmless0819-dev/mech-drawing-reader/tree/main/references"
click node_probe "https://github.com/harmless0819-dev/mech-drawing-reader/blob/main/scripts/probe.py"
click node_pdf "https://github.com/harmless0819-dev/mech-drawing-reader/blob/main/scripts/pdf_extract.py"
click node_ocr "https://github.com/harmless0819-dev/mech-drawing-reader/blob/main/scripts/ocr.py"
click node_tiles "https://github.com/harmless0819-dev/mech-drawing-reader/blob/main/scripts/tile.py"
click node_measurement "https://github.com/harmless0819-dev/mech-drawing-reader/blob/main/scripts/measure.py"
click node_dxf "https://github.com/harmless0819-dev/mech-drawing-reader/blob/main/scripts/dxf_dims.py"
click node_dimparse "https://github.com/harmless0819-dev/mech-drawing-reader/blob/main/scripts/dimparse.py"
click node_acad "https://github.com/harmless0819-dev/mech-drawing-reader/blob/main/scripts/acad_com.py"
click node_scale "https://github.com/harmless0819-dev/mech-drawing-reader/blob/main/scripts/cadscale.py"
click node_compare "https://github.com/harmless0819-dev/mech-drawing-reader/blob/main/scripts/cad_compare.py"
click node_diff "https://github.com/harmless0819-dev/mech-drawing-reader/blob/main/scripts/cad_diff.py"
click node_annotation "https://github.com/harmless0819-dev/mech-drawing-reader/blob/main/templates/annotation-doc.md"
click node_schema "https://github.com/harmless0819-dev/mech-drawing-reader/blob/main/templates/annotation-schema.json"
click node_audit "https://github.com/harmless0819-dev/mech-drawing-reader/blob/main/scripts/audit.py"
click node_validator "https://github.com/harmless0819-dev/mech-drawing-reader/blob/main/scripts/simplest_schema.py"
click node_scoring "https://github.com/harmless0819-dev/mech-drawing-reader/blob/main/scripts/score.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_skill,node_routing,node_cadoutput toneBlue
class node_references toneAmber
class node_probe,node_pdf,node_ocr,node_tiles,node_measurement,node_dxf,node_dimparse,node_acad,node_scale,node_compare,node_diff toneMint
class node_annotation,node_schema,node_audit,node_validator,node_scoring toneRose
class node_reader toneIndigo
```

## Components

### Reading Workflow

- [Skill Workflow](https://github.com/harmless0819-dev/mech-drawing-reader/blob/main/SKILL.md): `SKILL.md`
- [Channel Routing](https://github.com/harmless0819-dev/mech-drawing-reader/blob/main/workflows/routing.md): `workflows/routing.md`
- [CAD Output Flow](https://github.com/harmless0819-dev/mech-drawing-reader/blob/main/workflows/cad-output.md): `workflows/cad-output.md`

### Domain Knowledge

- [Drawing References](https://github.com/harmless0819-dev/mech-drawing-reader/tree/main/references): `references`

### Drawing Tools

- [Format Probe](https://github.com/harmless0819-dev/mech-drawing-reader/blob/main/scripts/probe.py): `scripts/probe.py`
- [PDF Extractor](https://github.com/harmless0819-dev/mech-drawing-reader/blob/main/scripts/pdf_extract.py): `scripts/pdf_extract.py`
- [OCR](https://github.com/harmless0819-dev/mech-drawing-reader/blob/main/scripts/ocr.py): `scripts/ocr.py`
- [Image Tiling](https://github.com/harmless0819-dev/mech-drawing-reader/blob/main/scripts/tile.py): `scripts/tile.py`
- [Pixel Measurement](https://github.com/harmless0819-dev/mech-drawing-reader/blob/main/scripts/measure.py): `scripts/measure.py`
- [DXF Dimensions](https://github.com/harmless0819-dev/mech-drawing-reader/blob/main/scripts/dxf_dims.py): `scripts/dxf_dims.py`
- [Dimension Parser](https://github.com/harmless0819-dev/mech-drawing-reader/blob/main/scripts/dimparse.py): `scripts/dimparse.py`
- [AutoCAD Driver](https://github.com/harmless0819-dev/mech-drawing-reader/blob/main/scripts/acad_com.py): `scripts/acad_com.py`
- [CAD Calibration](https://github.com/harmless0819-dev/mech-drawing-reader/blob/main/scripts/cadscale.py): `scripts/cadscale.py`
- [CAD Comparison](https://github.com/harmless0819-dev/mech-drawing-reader/blob/main/scripts/cad_compare.py): `scripts/cad_compare.py`
- [CAD Difference](https://github.com/harmless0819-dev/mech-drawing-reader/blob/main/scripts/cad_diff.py): `scripts/cad_diff.py`

### Output Assurance

- [Annotation Template](https://github.com/harmless0819-dev/mech-drawing-reader/blob/main/templates/annotation-doc.md): `templates/annotation-doc.md`
- [Annotation Schema](https://github.com/harmless0819-dev/mech-drawing-reader/blob/main/templates/annotation-schema.json): `templates/annotation-schema.json`
- [Output Audit](https://github.com/harmless0819-dev/mech-drawing-reader/blob/main/scripts/audit.py): `scripts/audit.py`
- [Schema Validator](https://github.com/harmless0819-dev/mech-drawing-reader/blob/main/scripts/simplest_schema.py): `scripts/simplest_schema.py`
- [Backtest Scoring](https://github.com/harmless0819-dev/mech-drawing-reader/blob/main/scripts/score.py): `scripts/score.py`

### Other components

- **Drawing Reader**

## Connections

- Drawing Reader → Skill Workflow: uses (evidence: `README.md`)
- Skill Workflow → Channel Routing: routes by channel (evidence: `README.md`)
- Skill Workflow → Drawing References: consults (evidence: `README.md`)
- Channel Routing → Format Probe: identifies format (evidence: `README.md`)
- Channel Routing → PDF Extractor: extracts PDF (evidence: `README.md`)
- Channel Routing → OCR: reads images (evidence: `README.md`)
- Channel Routing → Image Tiling: tiles images (evidence: `README.md`)
- Channel Routing → Pixel Measurement: measures pixels (evidence: `README.md`)
- Channel Routing → DXF Dimensions: extracts dimensions (evidence: `README.md`)
- Channel Routing → Dimension Parser: parses dimensions (evidence: `README.md`)
- Skill Workflow → Annotation Template: produces document (evidence: `README.md`)
- Skill Workflow → Annotation Schema: produces JSON (evidence: `README.md`)
- Skill Workflow → Output Audit: audits output (evidence: `README.md`)
- Skill Workflow → CAD Output Flow: supports CAD output (evidence: `README.md`)
- CAD Output Flow → AutoCAD Driver: drives AutoCAD (evidence: `README.md`)
- CAD Output Flow → CAD Comparison: compares overlay (evidence: `README.md`)
- CAD Output Flow → CAD Difference: finds differences (evidence: `README.md`)
- CAD Comparison → CAD Calibration: calibrates scale (evidence: `scripts/cad_compare.py`)
- CAD Difference → CAD Calibration: calibrates scale (evidence: `scripts/cad_diff.py`)
- Output Audit → Schema Validator: validates schema (evidence: `scripts/audit.py`)
- Output Audit → Annotation Schema: checks against (evidence: `README.md`)
- Skill Workflow → Backtest Scoring: backtests results (evidence: `README.md`)
