什么是 Excellon 钻孔文件?— PCB 钻孔格式全解析

告诉板厂在哪里打孔的那个文件
随便打开一份 PCB 发板 zip,你会看到铜层的 Gerber,还有一两个后缀是 .drl、.txt、.nc 或者 .drd 的文件。那些就是 Excellon 钻孔文件。它们和 Gerber 住一起,但说的是完全不同的语言——不是 2D 形状,而是给一只旋转钻头的机器坐标。如果 Gerber 负责告诉光绘机往哪蚀刻铜,Excellon 就负责告诉 CNC 钻孔机往哪打孔。这个格式已经用了 50 年,这篇讲清楚它里面装了什么,以及为什么搞错了就是一块废板。
Excellon 文件里面是什么
Excellon 和 Gerber 一样是纯 ASCII——但语法来自完全不同的年代。头部声明单位(INCH 或 METRIC)、零压缩方式(前导或后导),然后给出一张钻头表:T1C0.3 表示 1 号钻头直径 0.3 mm,T2C0.8 表示 2 号钻头 0.8 mm,以此类推。正文部分用 T1 切到一把钻头,X12500Y8750 在那个坐标打一孔,接着换下一把钻头或者 M30(程序结束)。整个文件就三样东西:单位声明、钻头表、一长串(钻头号, X, Y)的打孔记录。比 Gerber 的光圈盖章简单得多,因为一只钻头本来就只有一件事可做。
Excellon 做对的地方
- 纯文本、可编辑 — 任何文本编辑器都能打开,任何 CNC 都能读。没有专有二进制,也没有要授权的厂商扩展。
- 钻头直径写得很死 — 每个打孔都绑到一个钻头编号,钻头表给出准确直径。不用猜,也不靠上下文推。
- 单位在头部声明 — INCH 或 METRIC 指令告诉解析器怎么读坐标。搞错这个就是缩放出错的头号原因。
- 零压缩处理 — 老的 Excellon 为了省穿孔带字符会省略前导或后导零。现在的导出一般保留完整精度,但老文件还是要小心解析。
- 金属化孔和非金属化孔分开 — 大多数 EDA 工具导出两个文件(例如 -PTH.drl 和 -NPTH.drl),免得板厂把本该裸金属的安装孔也给镀上了。
- 槽孔走路径指令 — 铣出来的槽(矩形切口、长安装孔)和打孔放一起,用 G00/G01 路径指令。同一个文件,两种工作模式。
发板前怎么验 Excellon
- Open pcbviewer.app — 把整个 Gerber 压缩包拖进来,查看器会自动识别里面的钻孔文件。
- 确认打孔正好落在铜焊盘上 — 每个 PTH 打孔都应该对准焊盘或过孔中心。偏了回来就是穿过走线的废孔。
- 检查金属化/非金属化分类 — 螺丝安装孔应该是 NPTH,元件引脚孔和过孔是 PTH。查看器会用不同颜色区分。
- 对照钻头表 — 原理图里每个钻孔直径都应该在钻头表里有对应项。缺了尺寸板厂就会用相近的顶上,BGA 脚就塞不进去。
- 把 zip 发给板厂 — 两个 .drl 文件(PTH 和 NPTH)跟 Gerber 一起打包。NPTH 文件后缀要是特别一点,附个 README 说明。
拖一份带 Excellon 钻孔的 Gerber 压缩包进来 — 抢在板厂前面确认每个孔都落在焊盘上。
免费试用 MakerSuite 3D为什么 Excellon 出错特别贵
Gerber 层画错了,光绘预览里一眼就能看出来,总有人会发现。Excellon 错了要到板厂的钻孔机开始跑你 3 块一片的量产订单的时候才暴露。单位搞错?每个孔偏 25 倍。零压缩搞错?每个孔都在错的区间。钻头漏了?板厂随便拿个相近尺寸顶上,BGA 封装根本坐不下去。点 Submit 之前花 10 秒跑一下 Excellon 查看器,救下的板比任何其他单项检查加起来都多。
什么时候会用到 Excellon
- 所有 PCB 订单 — JLCPCB、PCBWay、OSH Park 都要求 Gerber 和 Excellon 一起上传
- 多钻孔工艺 — HDI 板的激光微过孔走一个 Excellon,机械钻孔走另一个
- 拼板 — 分板连接片和鼠咬孔的钻孔放在第三个 Excellon 文件里
- CNC 铣床打样 — LPKF 或 Bantam 铣床能直接读 Excellon 在家做样
- 板厂来料检查 — QA 量产前把你的 Excellon 过一遍 CAM,数打孔数、核对钻头尺寸
浏览器直接解析 Excellon
钻孔文件里装着板上每个元件的引脚图案——是硬件配置里的专有信息。NDA 项目或者发布前的设计,传到云端查看器就有风险。MakerSuite 3D 用 JavaScript 在浏览器里直接解析 Excellon——不走服务器、不上传、不留缓存。和板厂内部用的是同一套解析逻辑,只是挪到客户端跑。
常见问题
Why is Excellon a separate file from Gerber?
Gerber describes 2D shapes that get stamped onto copper layers — pads, traces, silkscreen. Drilling is a different operation: a spinning bit plunging through the board at a specific coordinate with a specific diameter. That's not a 2D shape, it's a machine instruction. Excellon was designed in the 1970s for CNC drill presses and evolved alongside Gerber as the companion format. Every fab machine treats them separately, so keeping them separate files matches the physical workflow.
What's the difference between plated (PTH) and non-plated (NPTH) drills?
PTH (plated through-hole) drills are for electrical connections — via holes, component pin holes. The fab plates the hole walls with copper so signals can cross layers. NPTH (non-plated through-hole) drills are mechanical — mounting screws, alignment pins, logo cutouts. They have no copper plating inside. Most EDA tools export them as two separate Excellon files (e.g., .DRL and .NPTH) so the fab doesn't accidentally plate a mounting hole.
Can I open an Excellon file in a text editor?
Yes — it's plain ASCII. You'll see a header with tool definitions (T1C0.3 means tool 1 is 0.3 mm diameter), then a sequence of tool changes and X/Y coordinates (X12500Y8750 drills a hit at those coordinates). The coordinate format depends on the header directives (INCH vs METRIC, leading-zero vs trailing-zero suppression). This is why Excellon parsers have to read the header carefully — the same number string means different things under different directives.
What units does Excellon use?
Either inches or millimeters, declared in the header via INCH or METRIC directives. Inches are historical (1970s US machinery); millimeters are more common in modern exports. Units have leading-zero or trailing-zero suppression, declared separately. Getting the units or zero-suppression wrong is the #2 cause of bad boards (after layer flip) — a drill hit meant for 12.500 mm can land at 1.2500 mm if the parser guesses wrong.
Does MakerSuite 3D support Excellon drills?
Yes — drop your Gerber zip and the viewer automatically detects any .drl, .txt, .nc, or .drd files inside and renders drill hits as 3D holes through the board. Plated and non-plated are distinguished by file name conventions (DRL vs NPTH). Same browser-only parsing as Gerber — no upload, no server round-trip.
相关文章
把 Gerber 压缩包拖进来 — 钻孔自动 3D 渲染
打开 Gerber 查看器