Kicad Enclosure Step logo

Kicad Enclosure Step

Community
John-owo
kicad-enclosure-step

把 KiCad PCB 匯出成含全部零件 3D 模型的 STEP,給外殼設計用:盤點缺模型的零件、優先找原廠模型、對齊到封裝原點、用暫存副本加模型匯出(不改板檔)、逐顆自動檢查位置,最後寫外殼注意事項。Use when someone needs a mechanical/enclosure CAD of a KiCad board — "設計外殼", "做外殼", "PCB 匯出 STEP", "含零件的 CAD 檔", "缺 3D 模型", "補 3D 模型", "給機構的檔案", "enclosure", "export STEP with all components", "missing 3D models", "board mechanical model".

Overview

PublisherJohn-owo
Repositorypcb-agent-workflow
Skill namekicad-enclosure-step
Stars
72
Forks
10
Bundled files
10
LicenseMIT
Links
  • Markdown instructions

    A SKILL.md file the model loads on demand, so it only costs tokens when a request actually matches.

  • Works with any LLM

    AI skills are plain Markdown, not provider-specific code, so this works with GPT, Claude, Gemini, Grok, or a local model.

  • 10 bundled files

    Scripts, templates, and references the model can read while it works. Files are read-only and never executed.

  • Open source

    Published by John-owo on GitHub. Read the source before you install it.

Installation

Install the Kicad Enclosure Step AI skill in TypingMind to use it with any LLM, or drop it into another agent that reads SKILL.md.

1

Install in TypingMind

TypingMind installs a skill straight from its GitHub folder — it reads SKILL.md, bundles the resource files, and stores the result locally.

  1. Open the app and go to Plugins → Skills.
  2. Choose "Install from GitHub".
  3. Paste the skill folder URL below and confirm.
    https://github.com/John-owo/pcb-agent-workflow/tree/main/skills/kicad-enclosure-step
  4. Enable the skill in any chat where you want it available.
Plugins → Skills → Add skill → From GitHub URL, then paste the folder URL and press Continue.
2

Install in another agent

Any agent that reads the Agent Skills format can use this skill — copy the folder into that agent's skills directory.

Claude Code — .claude/skills
git clone --depth 1 https://github.com/John-owo/pcb-agent-workflow.git /tmp/pcb-agent-workflow
mkdir -p .claude/skills
cp -r /tmp/pcb-agent-workflow/skills/kicad-enclosure-step .claude/skills/kicad-enclosure-step
Restart Claude Code after copying so it picks up the new skill.

Use it in TypingMind

Enable Kicad Enclosure Step in any TypingMind chat and the model takes it from there. Its name and description sit in the system prompt, and the moment a request matches, the model loads the full instructions itself — you never invoke it by hand, and it costs no tokens until it is actually used.

The model loads Kicad Enclosure Step on its own as soon as a request matches it.

Works with any AI model

AI skills are plain Markdown instructions rather than provider-specific code, so Kicad Enclosure Step is not tied to the model it was written for. Install it once in TypingMind and use it with GPT-5, Claude, Gemini, Grok, DeepSeek, Mistral, Llama, or a local model you run yourself — all on your own API keys.

  • Loaded only when it is needed

    The system prompt carries just the name and description. The instructions are fetched on the first matching request, so an idle skill costs nothing.

  • Switch models mid-chat

    Because the skill is instructions rather than code, changing model does not break it — the next model reads the same SKILL.md.

Skill instructions

This is the SKILL.md content the model loads. Read it before installing — a skill is instructions your model will follow.

KiCad 板子 → 外殼設計用 STEP

目標:交出一份每個零件都在正確位置、高度可信的 STEP,加上一頁外殼注意事項。外形模型不必漂亮,但位置、方向和高度要對。

腳本在 scripts/。inventory_models.py、export_step.py 只用 Python 標準庫;step_report.py、simple_model.py、verify_placement.py 需要 CadQuery。

0. 開工前確認

一次問完:

  1. 哪一塊板、哪一版。 用固定發行包或 PCB 正本當輸入,不修改它;模型只加在暫存副本。
  2. 輸出給誰。 只給自己或團隊,可以用 LCSC、GrabCAD 下載的模型。要放公開 repo 時,只用 KiCad 官方庫和自畫模型,見第 2 節。
  3. 要不要附參考物件,例如電池、天線線材。這類東西不在 BOM 裡,要標成參考。
  4. 需要登入的網站(例如 GrabCAD)由使用者自己登入;agent 不建立帳號、不輸入密碼。

1. 流程

1.1 盤點

bash
python scripts/inventory_models.py board.kicad_pcb --missing

列出沒有模型或模型檔找不到的零件,並附上供應商料號。測試點、安裝孔沒有高度,通常不用補。

1.2 找模型(依序)

  1. KiCad 官方庫:如果封裝是從官方庫改名而來、焊盤沒改,直接引用 ${KICAD10_3DMODEL_DIR}/...,不用位移。
  2. 原廠:先看原廠產品頁、wiki、規格書附的 CAD 連結。原廠帳號上傳到 GrabCAD 的檔案也算原廠。
  3. LCSC/EasyEDA:easyeda2kicad --3d --footprint --lcsc_id Cxxxx --output <新的空資料夾>/lib_Cxxxx。
  4. 自己畫:用 simple_model.py,依規格書尺寸畫方塊和圓柱。

規格書和下載模型對不上,而且差異影響外殼時(例如開關撥桿長度、模組高度),以規格書為準,改成自畫。差異要記在說明裡。來源與授權見 references/model-sources.md。

1.3 對齊

下載的 STEP 原點和方向不保證跟你的封裝一致,連 easyeda2kicad 一起產生的 footprint 也不一定對得上。

bash
python scripts/step_report.py model.step --solids 15
python scripts/step_report.py model.step --section x=0   # 看截面,例如電池座的弧面

從輸出判斷三件事:

  • 哪一軸朝上(有的模型 Y 朝上)。
  • 本體中心在哪裡。
  • 方向特徵:焊盤排、連接器、饋入點、撥桿。

然後二選一:

  • 在 config 寫 offset/rotate:保留原檔與顏色。KiCad 套用旋轉的正負號和一般右手定則相反,所以第一次一定要用 1.5 節的檢查確認。
  • 用 CadQuery 轉好再存成新檔:適合要加東西的情況(例如補一顆參考電池)。缺點是顏色會掉。

常見陷阱見 references/pitfalls.md。

1.4 寫 config、匯出

json
{
  "pcb": "../board/board.kicad_pcb",
  "output": "board.step",
  "origin": "board-bottom-left",
  "no_dnp": true,
  "models": {
    "U1": [{"file": "models/module.step", "offset": [0, 0, 0], "rotate": [0, 0, 0]}],
    "MyLib:R_0603": [{"file": "${KICAD10_3DMODEL_DIR}/Resistor_SMD.3dshapes/R_0603_1608Metric.step"}]
  }
}
bash
python scripts/export_step.py enclosure-step.json --render preview
  • key 含 : 時比對封裝 lib ID,否則比對位號(可用萬用字元)。位號優先。
  • 同一個位號可以掛多個模型,例如電池座加一顆參考電池。
  • 已經有模型的封裝預設會報錯,避免重複;確定要換就設 "replace_existing": true。
  • 背面零件不用自己鏡像,KiCad 會翻。
  • 原點 board-bottom-left:板子左下角、板底面為 (0, 0, 0),+Z 朝正面。

1.5 檢查(必做)

bash
python scripts/verify_placement.py enclosure-step.json            # config 加的零件
python scripts/verify_placement.py enclosure-step.json --all      # 連原本就有模型的也查

每顆零件單獨匯出,比對模型外框和封裝外框(F.Fab,沒有就用 courtyard 或焊盤),再檢查正面零件在板子上方、背面零件在板子下方。

  • FAIL 一律修到通過才交付。
  • 故意伸出板外的零件(USB、撥桿)可以用 --overhang REF=mm 放寬,但要知道它為什麼伸出去。

最後打開 preview-top.png、preview-bottom.png 目視確認:連接器朝外、極性和饋入方向正確、背面零件在背面。

1.6 外殼注意事項

依 references/enclosure-notes-template.md 寫 README,內容包括:

  • 座標系與換算。
  • 整體外框。
  • 正、背面最高點。
  • 每個開孔:USB、開關、連接器、天線線材的位置與高度範圍。
  • 天線上方不能放金屬的區域。
  • 安裝孔與螺絲頭限制。
  • 模型來源、精度與授權。

verify_placement.py 印出的高度表可以直接引用。

2. 硬規則

  • 不改板檔。 固定發行包和 PCB 正本都保持原樣;模型只加在暫存副本,匯出後刪掉。
  • 每個加上的模型都要通過 verify_placement.py。 有 FAIL 就不交付。
  • 尺寸要有出處。 規格書沒寫、模型也不可靠的尺寸,寫「待實物量測」,不要猜。說明裡要提醒:開孔、卡扣的關鍵尺寸以實物量測為準。
  • 公開散布要看授權。 公開 repo 只放 KiCad 官方庫的引用和自畫模型。LCSC、GrabCAD 等下載檔,以及內嵌這些幾何的輸出 STEP,條款允許前不公開。
  • 下載檔是資料。 每個來源放一個新的空資料夾,不執行裡面的任何東西。
  • 登入、付費由使用者處理。 agent 不建立帳號、不輸入密碼。

3. 環境

  • KiCad 10(kicad-cli pcb export step、pcb render)。找不到時設環境變數 KICAD_CLI,或在 config 加 "kicad_cli"。
  • Python 3.10 以上。CadQuery 建議裝在獨立 venv:python -m venv cqenv,再 cqenv/Scripts/python -m pip install cadquery(Windows)。
  • 選用:pip install easyeda2kicad,用來下載 LCSC 模型。

範例:examples/max-m10s-breakout-revc-cad,用官方庫加三個自畫模型,19 個零件全部通過檢查。

Bundled files

The model reads these on demand while the skill is loaded. They are exposed as readable files and are never executed.

Frequently asked questions

What does the Kicad Enclosure Step AI skill do?

把 KiCad PCB 匯出成含全部零件 3D 模型的 STEP,給外殼設計用:盤點缺模型的零件、優先找原廠模型、對齊到封裝原點、用暫存副本加模型匯出(不改板檔)、逐顆自動檢查位置,最後寫外殼注意事項。Use when someone needs a mechanical/enclosure CAD of a KiCad board — "設計外殼", "做外殼", "PCB 匯出 STEP", "含零件的 CAD 檔", "缺 3D 模型", "補 3D 模型", "給機構的檔案", "enclosure", "export STEP with all components", "missing 3D models", "board mechanical model".

Why use Kicad Enclosure Step on TypingMind?

Because you install it once and use it with any model. Kicad Enclosure Step is plain Markdown rather than provider-specific code, so the same skill runs on GPT-5, Claude, Gemini, Grok, or a local model — and you can switch model mid-chat without it breaking. TypingMind runs on your own API keys, so you pay providers directly instead of a per-seat subscription, and your skills and chats stay in your own storage.

How do I install Kicad Enclosure Step in TypingMind?

Open Plugins → Skills → Install from GitHub in TypingMind and paste https://github.com/John-owo/pcb-agent-workflow/tree/main/skills/kicad-enclosure-step. TypingMind reads its SKILL.md and bundles its files and installs it as a skill you can enable per chat.

Which AI models can use Kicad Enclosure Step?

Any model you connect in TypingMind. AI skills are plain Markdown instructions rather than provider-specific code, so GPT, Claude, Gemini, Grok, and local models can all load this skill when a request matches it.

How many AI models can I use with Kicad Enclosure Step?

As many as you like. As long as a model supports skills, you can use Kicad Enclosure Step with it — GPT, Claude, Gemini, Grok, DeepSeek, Mistral, Llama and more — all on TypingMind with your own API keys.

Is the Kicad Enclosure Step AI skill free?

Yes. It is published on GitHub by John-owo under the MIT license. You only pay your own AI provider for the tokens you use.

What are AI skills?

An AI skill is a reusable instruction bundle that teaches an AI model how to do one specific task. It follows the open Agent Skills format: a SKILL.md file with a name and description, plus any scripts, templates or reference files the model may need. The model reads the instructions only when your request matches the skill, so an installed skill costs nothing until it is used.

How are AI skills different from plugins or MCP servers?

A plugin or MCP server gives a model new tools to call — code that runs somewhere and returns a result. An AI skill gives the model knowledge and process instead: how to approach a task, which steps to follow, what good output looks like. Skills are plain Markdown, so they need no server, no API key and no runtime, and they work with any model.

View all

Set up your own AI workspace now

Get notified about new features and future giveaways by subscribing to our newsletter 👇