Drawmath

io.github.CloudCorpRecords由 GitHub 账号 CloudCorpRecords 发布v0.1.0更新于 Nov 7, 2026

Metric-imperial conversion for technical drawings: dimensions, tolerances, threads, roughness.

已验证STDIO仅桌面开发者工具数据与分析

概览

AI 生成的概览

在本地把技术图纸上的公制与英制数值(尺寸、公差、螺纹、粗糙度、重量)互相换算,无需联网。

可以做什么
  • 换算单个工程数值的公制与英制,可指定类型与方向,返回精确值、显示值、推导方式与置信度
  • 换算整段标注字符串,保留符号、配合等级与倍数,角度保持不变
  • 查询 ISO 公制螺纹最接近的 UNC 对应规格,或不带参数返回完整 M2–M30 对照表
适用场景
适合阅读或标注公制与英制混用的机械图纸,希望按车间惯例取整并统一处理配合等级与螺纹对照时使用。本版本不含 PDF 图纸提取功能,需要该功能时并不适用。
运行要求
以本地进程运行,可通过 npx(需 Node.js)或已发布的 Docker 镜像启动;无需账号、API 密钥或环境变量,运行时不需要网络。
安装前请注意
螺纹匹配只是最接近的标准规格,并非可互换件,每个螺纹结果都会明确提示,选用五金件前需自行核实。参数结构为标注的重建版本,原版的 PDF 文本提取与图纸转换工具在本版本中缺失。

安装

在 SourceWeft 中

  1. 打开 控制台中的 Drawmath,将其添加到工作区。
  2. 为需要使用其工具的对话启用该服务。

Desktop only,通过 STDIO。 STDIO 服务会启动本地进程,因此需要 SourceWeft 桌面宿主。

其他 MCP 客户端

参照 仓库 中的启动说明。

README

drawmath

Metric and imperial values on a technical drawing, converted with the factors and rounding a shop actually uses — locally, with no network call and nothing to configure.

Give drawmath one value, one printed callout, or one thread designation and it answers in the other system: lengths and GD&T values, ± tolerances, diameters with their fit class, surface roughness, weights and threads. Each answer carries the exact converted value alongside the rounded display value, says how it was derived (exact, rounded, table or nearest), and gives a confidence score.

Precision

  • Factors are the international definitions: 25.4 mm per inch and 0.45359237 kg per pound.
  • Display values follow shop-floor convention: a 0.01 mm step becomes a 4-decimal inch value.
  • Worked examples: 84±0.1 mm becomes 3.3071±0.0039 in, Ø30 H7 becomes Ø1.1811 H7, Ø40 H7 becomes Ø1.5748 H7, and Ra 1.6 µm becomes Ra 63 µin.
  • Threads are matched against a metric/UNC chart covering M2–M30, snapped by major diameter when there is no exact counterpart: M8 becomes 5/16-18 UNC, M6 becomes 1/4-20 UNC, and 1/4-20 UNC becomes M6. A matched thread is a nearest standard, never an interchangeable one — every thread result says so explicitly.

Tools

This is a labelled subset of the original five-tool surface. Three tools are built:

  • convert_value — one value: value (for example "84±0.1 mm", "Ø30 H7", "Ra 1.6", "2.5 kg" or "M8"), with an optional kind (length, tolerance, gdt, roughness, weight, thread or auto) and an optional direction (metric_to_imperial, imperial_to_metric or auto). The result JSON gives exact and display values, the derivation method and a confidence score.
  • convert_text — a whole callout string: text, with an optional direction. Notation is preserved — symbols, fit classes and multipliers stay where they were — and angles are left untouched.
  • lookup_thread — a thread cross-reference: give a designation such as "M8" or "1/4-20 UNC" for its chart row and nearest counterpart in the other system, or omit it for the full M2–M30 chart.

Two original tools are omitted from this subset: extract_drawing_text and convert_drawing_pdf. They depend on a PDF text-extraction and stamping engine that cannot be reproduced from the published specification, and this build carries no PDF library. The original's convert-drawing prompt is likewise out of scope, as prompts sit outside this program's tool parity scope.

Argument shapes are labelled reconstructions: the published material pins behaviour and worked examples, not parameter tables, so each tool takes the primary string its behaviour implies plus the optional direction or kind that behaviour calls for.

CLI

bash
npx @reneturcios/drawmath convert_value '{"value":"84±0.1 mm"}'npx @reneturcios/drawmath convert_text '{"text":"Ø30 H7"}'npx @reneturcios/drawmath lookup_thread '{"designation":"M8"}'npx @reneturcios/drawmath lookup_thread '{}'npx @reneturcios/drawmath --version

Exit codes: 0 on success, 1 on a runtime error, 2 on a usage error.

MCP server

bash
npx -y @reneturcios/drawmath mcp

MCP client config:

json
{  "mcpServers": {    "drawmath": {      "command": "npx",      "args": ["-y", "@reneturcios/drawmath", "mcp"]    }  }}

Docker

bash
docker run -i ghcr.io/cloudcorprecords/drawmathdocker run --rm ghcr.io/cloudcorprecords/drawmath convert_text '{"text":"M8"}'

Development

bash
npm installnpm run build   # tsc -> dist/npm test        # tsx --test test/*.test.ts (fixture arithmetic only, no network)npm run dev     # run the CLI from source

License

MIT — Copyright (c) 2026 Rene Turcios

来源:README.md,提交 c0ff798

工具

3

convert_value

Convert one engineering value between metric and imperial: length, tolerance, GD&T, surface roughness, weight, or thread designation. Returns exact and display values, derivation method and confidence.

输入参数kindvalue必填direction

convert_text

Convert a printed callout string between metric and imperial, preserving notation. Angles stay untouched.

输入参数text必填direction

lookup_thread

Cross-reference an ISO metric thread with its nearest Unified (UNC) counterpart, or return the full M2-M30 chart when no designation is given.

输入参数designation

版本历史

1
  1. v0.1.0最新Nov 4, 2026

评分

已满足适用检查项的 90%

该评分衡量此收录条目的完整程度,依据注册中心条目、端点与公开来源计算得出。它不是对服务器本身的评价,也不表示服务器安全或当前可用:可连通性是带日期的检查结果,评分也不包含安装量或用户评价。

  • 近 30 天内可连通25 分
  • 已声明认证方式10 分

    请在注册中心条目中声明凭据请求头,或保持端点能够响应探测,以便判定其认证方式。

  • 已列出工具必需15 分
  • 描述必需15 分
  • 图标10 分
  • 文档15 分
  • 许可证10 分