Skip to content

Add cad-drawing plugin: 3D engineering files to 1:1 printable A4 drawings with hole-pitch and visibility analysis - #96

Open
Xiong-cmyk-collab wants to merge 3 commits into
MiniMax-AI:mainfrom
Xiong-cmyk-collab:add-cad-drawing
Open

Xiong-cmyk-collab wants to merge 3 commits into
MiniMax-AI:mainfrom
Xiong-cmyk-collab:add-cad-drawing

Conversation

@Xiong-cmyk-collab

@Xiong-cmyk-collab Xiong-cmyk-collab commented Dec 3, 2026 •

Copy link
Copy Markdown

What changes

Adds one new community Plugin: cad-drawing — turns a 3D engineering file (.stl / .3mf / .step / .stp / .iges) into a 1:1 printable A4 drawing with top / front / left orthographic views, overall dimensions, hole positions and pitches, and a per-hole verdict on whether the hole is visible in those three views.

It ships:

Capability Path
Portable Agent Plugins 1.0 manifest plugin.json, mcp.json
MiniMax Code 0.4.0+ manifest .claude-plugin/plugin.json
MiniMax manifest (display name, icon, category, example queries) .minimax-plugin/plugin.json, servers.mcp.json
Skill (byte-identical in both layouts) skills/SKILL.md, skills/cad-drawing/SKILL.md, skills/cad-drawing/references/workflow-sop.md
stdio MCP server mcp/server.js — tools convert_to_drawing, inspect_holes
Geometry engine (self-contained) scripts/cad2pdf/ — pure JavaScript, no native binaries

The three view pages are true 1:1 (drawing millimetres equal model millimetres), so the PDF can be printed on A4 and measured with calipers. Parts larger than the printable area are tiled at 1:1 with alignment marks plus a scaled overview page.

User value

A mechanical part arrives as an STL or STEP export. Before cutting a prototype or measuring a sample, someone needs the overall size, the screw-hole positions, the hole pitch, and — the part people usually forget — which holes cannot be seen in the usual three views. A blind hole opening on the bottom face is invisible in a top view; missing it means drilling in the wrong place.

This Plugin answers all of it in one pass and writes the answer to a printable PDF plus a machine-readable hole table.

Example prompt

把这个 STL 转成 1:1 打印图,标出螺丝孔距

Expected result

Three files next to the input file:

  • <name>_打印图.pdf — overview page, then one 1:1 page per view (top / front / left, plus bottom / rear / right when a hole needs them), then a hole table with the visibility verdict
  • <name>_孔位明细.csv — one row per hole: id, type, diameter, depth, X/Y/Z, owning view, verdict (UTF-8 with BOM, opens in Excel)
  • <name>_特征.json — bounding box, orientation transform, every hole, bosses, hole-pitch groups

On a 200 × 60 × 21 mm board the result is a 6-page PDF: 34 holes detected, 20 visible in the top view, 14 opening on the bottom face and therefore moved to an extra bottom-view page with an explicit "look from the bottom" verdict.

The visibility verdict is computed, not guessed: each cylindrical surface is fitted (axis, radius), the mouth direction is derived from the surface normals, and the mouth is tested for lateral exposure so a hole inside a cavity is not reported as visible. Hole pitch is grouped by owning view, axis direction, height layer and diameter, so holes of different sizes are never measured as one pattern.

Plugin submission checklist

  • Plugin lives at plugins/Xiong-cmyk-collab/cad-drawing.
  • plugin.json name matches the Plugin directory.
  • README.md includes a real example prompt and expected result.
  • LICENSE and plugin.json declare an open-source license (Apache-2.0).
  • Required executables, accounts, paid services, and supported platforms are disclosed.
  • Network destinations and data handled by the plugin are disclosed.
  • No credentials, private endpoints, hidden telemetry, installers, symlinks, or native binaries are included.
  • Every scaffold TODO has been replaced.
  • npm run validate passes for this Plugin, and this Plugin's own tests pass (see Evidence for the pre-existing failures in another Plugin's suite).

Evidence

Repository validation — passes

$ npm run validate
...
OK   plugin Xiong-cmyk-collab/cad-drawing
Validated 32 hosted Plugins and all examples.

The validator checks the hosted directory, the manifest, every Skill, MCP transports, required
docs, scaffold placeholders and path safety.

Test suite

$ npm test
ℹ tests 1153
ℹ pass 1126
ℹ fail 22

All 22 failures are in other Plugins' own suites and are pre-existing on main. Cloning
MiniMax-AI/MiniMax-Code-Plugins fresh into an empty directory and running the same suite gives:

ℹ tests 1148
ℹ pass 1121
ℹ fail 22

Same 22 failures, in the same files — the difference is exactly the 5 tests this Plugin adds, and
they all pass:

Failing file Count Cause
plugins/weekbin/mcode-trajectory-studio/test/containment.test.mjs 9 that Plugin's own suite
tests/plugins/octopus-meme-maker/smoke.test.mjs 5 that Plugin's own suite
plugins/weekbin/mcode-trajectory-studio/test/containment-attacks.test.mjs 3 that Plugin's own suite
plugins/Fectivnfy112357/searxng-search/test/searxng-search.test.mjs 1 that Plugin's own suite
plugins/weekbin/mcode-trajectory-studio/test/release-gates.test.mjs 1 that Plugin's own suite
tests/plugins/mcode-trajectory-studio/smoke.test.mjs 1 that Plugin's own suite
test/github-explore.test.mjs 1 repository-level test
test/hosted-plugins.test.mjs 1 Windows cannot create symlinks without elevation (EPERM); fails identically on a clean checkout

The 5 tests added by this Plugin all pass:

$ node --test plugins/Xiong-cmyk-collab/cad-drawing/scripts/cad2pdf/test/engine.test.cjs
✔ 二进制 STL 可被解析,面数与包围盒正确
✔ 自动摆正后厚度轴落在 Z、原点归零
✔ 识别出唯一的通孔,直径与中心正确,且俯视图可见
✔ 孔距分组把同一阵列识别为均匀矩形
✔ STEP 之外:ASCII STL 同样可解析
ℹ pass 5
ℹ fail 0

They build a synthetic plate with one through hole, then assert the parsed triangle count and
bounding box, the automatic orientation (thinnest axis onto Z, origin at the bounding-box corner),
the detected hole (diameter, centre, through/blind type, owning view, visibility) and the pitch
grouping.

Package contents

plugins/Xiong-cmyk-collab/cad-drawing/
├── .claude-plugin/plugin.json
├── .minimax-plugin/plugin.json
├── LICENSE
├── README.md
├── README.zh-CN.md
├── icon.png
├── icon-dark.png
├── mcp.json
├── mcp/server.js
├── plugin.json
├── scripts/cad2pdf/package.json
├── scripts/cad2pdf/src/{cli,features,lib,mesh,mf3mf,orient,pdfout,step,stl,views}.js
├── scripts/cad2pdf/test/engine.test.cjs
├── scripts/cad2pdf/tools/pdf2png.py
├── servers.mcp.json
├── skills/SKILL.md
├── skills/cad-drawing/SKILL.md
└── skills/cad-drawing/references/workflow-sop.md

Manual test — MCP round trip against a real part

$ node mcp/server.js   # stdio JSON-RPC
initialize            -> protocolVersion 2024-11-05, serverInfo cad-drawing
tools/list            -> convert_to_drawing, inspect_holes
inspect_holes(AI测试板.STL)
  -> 零件外形:200.00 × 60.00 × 21.00 mm 定向:厚度轴 Z→Z,长轴 Y→X
  -> 孔位 34 个(可见 20 / 需翻面 14 / 内部不可见 0)
convert_to_drawing(AI测试板.STL)
  -> AI测试板_打印图.pdf (6 pages) + _孔位明细.csv (34 rows) + _特征.json

Manual test — the judgement actually separates what the three views cannot show

On that same part, 14 of the 34 holes open on the bottom face. They are reported as 需底视图, are excluded from the top view, and get their own bottom-view page in the PDF. A STEP part with an enclosed nut bore reports 内部封闭腔·需剖视 for 16 holes and 0 visible holes, which is the correct answer for an internal threaded bore.

Manual test — 3MF path

The engine reads 3MF packages directly (ZIP → 3D/3dmodel.model → objects), merges the build-item
and component transforms, and converts the package unit to millimetres. A Bambu Studio project of an
A8-mini bottom plate (2 188 vertices, 4 396 triangles) gives:

$ node mcp/server.js   # stdio JSON-RPC
inspect_holes(A8mini 底_B_B.3mf)
  -> 零件外形:89.90 × 41.10 × 5.08 mm 定向:厚度轴 Z→Z,长轴 X→X
  -> 孔位 16 个(可见 16 / 需翻面 0 / 内部不可见 0)
  -> H1..H6   沉孔/台阶孔   Φ5.00 深 2.00
  -> H11..H16 通孔·带Φ5.00沉孔  Φ2.60 深 3.00
  -> H7..H10  通孔  Φ30.19 深 5.00
  -> 孔距阵列:Ø2.60 组 25.30 × 14.95 mm;Ø5.00 组 25.30 × 14.95 mm;Ø30.19 组 67.18 × 31.95 mm

The Ø2.60 through holes and the Ø5.00 counterbores above them are reported as one stepped hole
(通孔·带Φ5.00沉孔) rather than two unrelated holes, because the coaxial check compares the radial
offset rather than the 3D centre distance.

Manual test — STEP path

occt-import-js (OpenCascade compiled to WebAssembly) triangulates the STEP file, so no native CAD installation is needed. A pure-surface or wireframe STEP file is reported as an error instead of producing an empty PDF.

Manual test — no local paths or personal data in the package

The package was scanned for credentials, private endpoints, absolute local paths, e-mail addresses and private IPv4 ranges: the only match was the literal sk_u inside the word ask_user (a false positive of the sk token pattern). No Windows user-home path and no project-specific absolute path remains; the engine is located through CAD2PDF_TOOL_DIR or the bundled scripts/cad2pdf copy.

Compatibility note

The package ships three manifests on purpose. Installers that read only the portable plugin.json get the Skill and the MCP server, but not displayName, icon, darkIcon, category or exampleQueries — those live only in the MiniMax manifest. This is stated in README.md and in the Plugin submission checklist above.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant