型材切割拆分器 · Profile SplitterProfile Splitter
切割优化软件(OptiCutting)导出的 XML 里,有些型材长度超过料棒上限(约 6045 mm),必须拆成两段,加工孔位和连接件(connector macro)都要按新长度重新计算——手动改 XML 极其枯燥,改错一个坐标就会切废料。Kawser(不是程序员)用 Claude 做了一个单文件工具:把 XML 拖进去,自动拆分、重算坐标、导出新文件。全程在浏览器本地完成,不上传任何内容。 In the XML exported by the cutting-optimization software (OptiCutting), some profiles exceed the max bar length (~6045 mm) and must be split in two, with machining holes and connector macros recalculated for the new lengths — editing the XML by hand is tedious, and one wrong coordinate scraps material. Kawser (not a programmer) used Claude to build a single-file tool: drop in the XML and it auto-splits, recomputes coordinates, and exports a new file — all locally in the browser, uploading nothing.
1. 背景:超长型材,手动拆分又枯燥又危险Background: Over-Length Profiles, Split by Hand — Tedious and Risky
料棒有长度上限,超过上限的型材必须拆成两段才能加工。难点不在"拆",而在拆完之后所有加工位置都要跟着重算。 Bars have a maximum length, so any profile over it must be split into two pieces before machining. The hard part isn't the split — it's that every machining position has to be recalculated afterward.
拆完要重算每一个坐标Every coordinate must be recomputed after the split
处理孔位、连接件位置都要按两段新长度重新计算,还要考虑从哪一端测量(方向)。手动在 XML 里改,一处算错就切废料。Treatment holes and connector positions must be recomputed for the two new lengths, accounting for which end they're measured from (direction). Editing the XML by hand, one wrong value scraps material.
重复、枯燥、易疲劳出错Repetitive, dull, fatigue-prone
每份切割单里都可能有若干超长件,逐个手动处理既慢又容易看花眼。Every cutting list can contain several over-length pieces; handling each by hand is slow and easy to slip up on.
"这个太小,不值得专门开发""Too small to justify a real dev project"
这件事不够大到立项,却每天都在消耗时间。以前只能继续手动。Not big enough to become a project, yet it quietly ate time every day. The old option was to keep doing it by hand.
2. 怎么用 AI 的How AI Was Used
Kawser 没有写一行代码。他直接把一份真实的 OptiCutting XML 和拆分逻辑交给 Claude,让它生成一个可在浏览器里用的单文件工具,再用真实文件反复测试、修正。 Kawser didn't write a single line of code. He handed Claude a real OptiCutting XML plus the splitting logic, had it generate a single-file browser tool, then tested and refined it against real files.
给真实 XML + 拆分规则Provide a real XML + the splitting rules
把一份真实的切割 XML、料棒上限(约 6045 mm)、目标型材列表、连接件位置怎么算、R/L 方向怎么判断,全部讲清楚给 Claude。He gave Claude a real cutting XML, the max bar length (~6045 mm), the target-profile list, how connector positions are computed, and how R/L direction is determined.
让 Claude 生成单文件工具Have Claude generate a single-file tool
Claude 把文件上传/下载、拆分算法、坐标重算、逐件分析表和处理日志全部写进一个 HTML 文件——无需服务器或联网。Claude wrote the file upload/download, the splitting algorithm, coordinate recalculation, a per-piece analysis table, and a processing log — all into one HTML file, with no server or internet.
用真实文件测试,逐轮修正Test with real files, refine each round
Kawser 用真实切割 XML 验证输出:哪里拆分方向反了、哪个连接件坐标算错、哪种型材要特殊处理,就反馈给 Claude 调整。这样迭代到 v7,还加了可配置的拆分方向和规则。Kawser validated against real cutting XML: where a split went the wrong way, where a connector coordinate was off, which profiles needed special handling — he fed each back to Claude. That reached v7, and added configurable split direction and rules.
直接分发:发个文件就能用Distribute by just sending a file
单个 HTML 文件,同事收到双击即用,不用装环境、不用联网。数据全程留在本机,符合安全要求。A single HTML file — a colleague double-clicks and it just works, with no environment to install and no internet. Data stays on-device, which keeps it inside security rules.
3. 工具长什么样What the Tool Looks Like
把 OptiCutting 导出的 XML 拖进来,工具自动找出超过料棒上限的型材,按目标型材列表拆成两段,根据方向(R/L)和连接件规则重新计算每个加工位置,最后导出一份可直接使用的新 XML。 Drop in the XML exported by OptiCutting; the tool finds profiles over the max bar length, splits them per the target-profile list, recomputes every machining position by direction (R/L) and connector rules, then exports a ready-to-use new XML.
- 按目标型材过滤,只拆需要拆的件Filters by target profile — splits only what needs splitting
- 自动重算处理孔位 & 连接件(connector macro)坐标Auto-recomputes treatment holes & connector-macro coordinates
- R/L 方向识别 + 可配置的拆分方向/规则R/L direction detection + configurable split direction/rules
- 逐件分析表:拆分件 / 正常 / 跳过,一目了然Per-piece analysis table: split / OK / skipped at a glance
- 处理日志,方便核对每一步Processing log to verify every step
- 一键导出新 XML(原名 + "split")One-click export of the new XML (original name + "split")
4. 前后对比Before vs. After
使用 AI 之前Before AI
- 超长型材手动改 XMLOver-length profiles edited by hand in the XML
- 坐标靠人算,易出错、易切废Coordinates computed by hand — error-prone, scrap risk
- 重复枯燥,容易看花眼Repetitive and dull — easy to slip up
- 小工具排不上 IT 开发Small tools never made the IT roadmap
使用 AI 之后After AI
- 拖进 XML,自动拆分Drop in the XML — splitting is automatic
- 坐标由工具重算,方向自动识别The tool recomputes coordinates; direction auto-detected
- 逐件分析表 + 日志,便于复核Per-piece table + log make it easy to verify
- 自己就能把小需求做成工具Small needs become tools without waiting on anyone
5. 最值得学的一点The Takeaway Worth Copying
真正的价值不是这一个工具,而是这套人人可复用的模式:把一件重复、易错的工作讲清楚,给出真实数据样例(而不只是描述),就能让 Claude 帮你做出一个自己的单文件工具,再用真实文件逐轮修正。 The real value isn't this one tool — it's the repeatable pattern anyone can copy: describe a repetitive, error-prone task clearly, give a real data sample (not just a description), and Claude builds you a single-file tool — then refine it against real files.
同一位同事的另一个工具:加州门窗规范速查器 →Another tool by the same colleague: CA Code Pro →
用同样的"单文件 + 纯本地"思路,把散落的加州门窗规范整理成一键可搜。Same single-file, local-only approach — folds scattered California window/door codes into one searchable reference.
6. 分享人Contributor
VWD AI Guide v3.9 | VWD | 2026 | Created by IT depart. | 有问题发邮件到Questions? Email it@valuewds.com