drawing-converter
v0.1.1Metric ⇄ imperial for technical drawings: dimensions, tolerances, ISO fits, threads, roughness.
These tools were reported by the server itself during our smoke test (tools/list), not copied from the README.
convert_value Convert a single engineering value
Convert one engineering value between metric and imperial with shop-floor precision rules. Kinds: length (mm⇄in), tolerance_deviation (a ± deviation, keeps an extra significant digit), geometric_tolerance (GD&T value), surface_roughness (Ra µm⇄µin), weight (kg⇄lb), thread (designation lookup, e.g. "M8" ⇄ "5/16-18 UNC"). Returns the exact value, the display-rounded value, and how it was derived (exact/rounded/table/nearest) with a confidence score.
| Parameter | Type | Description |
|---|---|---|
from * | string | unit system the value is currently in |
kind * | string | |
designation | string | thread designation, e.g. "M8", "M8x1.25", "1/4-20 UNC" — required for kind=thread |
value | number | numeric value — required for every kind except thread |
convert_text Convert an engineering callout string
Convert a printed drawing callout (or short text with several callouts) between metric and imperial, preserving notation: "Ø30 H7" → "Ø1.1811 H7", "84±0.1" → "3.3071±0.0039", "R13" → "R0.5118", "M8" → "5/16-18 UNC", "1/4-20 UNC" → "M6". Angles (°) are left unchanged. Set category=surface to read bare numbers as Ra roughness instead of lengths. assume_lengths=true additionally converts every remaining number as a length (for tolerance-table rows like "bis 30").
| Parameter | Type | Description |
|---|---|---|
from * | string | unit system the text is currently in |
text * | string | |
assume_lengths | boolean | fallback: convert every number as a length when nothing else matched |
category | string | how to read bare numbers (default dimension = length; surface = Ra roughness) |
lookup_thread Cross-reference metric ⇄ inch threads
Look up the closest standard counterpart of a thread designation (ISO metric coarse ⇄ Unified UNC), with major diameters, pitch/TPI and how close the match is. Omit `designation` to get the whole cross-reference chart (M2–M30).
| Parameter | Type | Description |
|---|---|---|
designation | string | e.g. "M8", "M12x1.75", "5/16-18 UNC", "#8-32 UNC" — omit for the full chart |
extract_drawing_text Extract a drawing PDF’s text layer
Read the printed text tokens of one page of a technical-drawing PDF: each token with its index, text and position (page points, top-left origin, rotation in degrees), plus page geometry and a heuristic guess of the drawing’s unit system. Use the token indices to build `classifications` for convert_drawing_pdf when you want to decide yourself which tokens are convertible values (e.g. mark a bare "3.2" next to a surface symbol as category=surface, or a title-block number as skip).
| Parameter | Type | Description |
|---|---|---|
path * | string | path to the drawing PDF |
page | integer | 1-based page number (default 1) |
convert_drawing_pdf Convert a drawing PDF between metric and imperial
Produce a converted copy of a technical-drawing PDF with every recognised value stamped in place (white cover over the original callout, converted text in matching size/rotation) — dimensions, ± tolerances, fit classes, Ø/R callouts, threads. The input file is never modified. Without `classifications`, a heuristic converts unambiguous callouts plus (by default) bare numbers as lengths; for full control call extract_drawing_text first and pass per-token classifications. Requires a PDF with a text layer — scanned drawings need the web app (https://metric-to-imperial-converter.imnoo.com). C…
| Parameter | Type | Description |
|---|---|---|
input_path * | string | path to the source drawing PDF (read-only) |
bare_numbers | string | heuristic mode only — 'convert' (default) treats bare numbers as lengths (year-like and id-like integers excluded); 'skip' converts only unambiguous callouts |
classifications | array | authoritative per-token classification: when provided, ONLY listed tokens (minus skips) are converted |
output_path | string | where to write the converted PDF (default: next to the input as <name>.<target>.pdf) |
overwrite | boolean | allow replacing an existing output file |
page | integer | 1-based page to convert (default 1); other pages pass through unchanged |
source_system | string | unit system of the source drawing (default auto-detect from its text) |
target_system | string | default: the opposite of the source system |