Skip to content

Latest commit

 

History

6 Commits

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Place Location Beacons / 定位信标布点

Skill preview

中文说明 · English

一个面向 大模型(实测GPT5.5、GLM5.2效果可用,其他大模型请自测)的本地离线 Skill,用于根据 DWG/DXF 图纸以及可选的风险四色图,为室内、装置区、设备区和空旷区规划 UWB 或蓝牙定位信标,并生成分层、可审计的 DWG/DXF 交付文件。

An offline-first Codex skill for planning UWB or Bluetooth positioning beacons from DWG/DXF drawings and optional risk-color references. It produces layered, auditable DWG/DXF deliverables for rooms, industrial units, equipment areas, and open spaces.

图纸属于敏感工程资料。本 Skill 要求所有 DWG、DXF、PDF、图片、预览和中间数据只在本机处理,禁止上传到在线转换器、外部 API、云端 Notebook 或远程服务。

Engineering drawings may be confidential. This skill requires all DWG, DXF, PDF, images, previews, and intermediate data to remain on the local machine. Do not upload project artifacts to online converters, external APIs, hosted notebooks, or remote services.

中文说明

主要能力

  • 支持整个项目只部署 UWB 或只部署蓝牙。
  • 支持互不重叠的分区混合部署,例如蓝色低风险区使用蓝牙,红色、橙色和黄色区域使用 UWB。
  • 同一房间或连续区域只能选择一种信标,禁止 UWB 与蓝牙重叠部署。
  • 按用户确认的最大间距生成完全包边的正交网格。
  • 每个信标连接 2–4 个相邻信标。
  • 禁止斜向连线、X 形交叉和拥挤的自动修补小三角形。
  • 排除卫生间和用户指定的不部署区域。
  • 在独立 CAD 图层中写入信标、连线和中文统计信息。
  • 输出预览图、JSON 统计、DWG/DXF 以及审计结果。

开始计算前必须确认

Skill 不会把 30 米或 7 米静默当作项目参数。首次处理项目时需要用户明确确认:

  1. 整个项目采用单一信标,还是按区域混合部署。
  2. 每种启用信标的最大间距。UWB 30 米、蓝牙 7 米仅作为常见建议值。
  3. 每种颜色、房间或闭合多边形分别归属于 UWB、蓝牙还是排除区。
  4. CAD 图纸单位与米的换算关系;无法可靠识别时必须询问用户。
  5. 卫生间、道路、办公区、仓库、罐区或其他不部署区域。

间距只允许小于等于用户确认值。普通内部网格应尽量接近最大间距,只在边缘闭合、狭窄区域、拐角或避障时缩短。

只有 DWG/DXF、没有风险四色图

需要先询问以下区域分别如何部署:

  • 房间:UWB、蓝牙或不部署。
  • 设备区:UWB、蓝牙或不部署。
  • 空旷区:UWB、蓝牙或不部署。
  • 卫生间及其他排除区。

推荐用户先在 CAD 中手工绘制闭合多段线。未标注工业图纸的全自动本地识别通常约需 2 小时,并且仍需人工复核房间、墙体、设备边界和空旷区域。

推荐标注图层:

图层 用途
LOC_ZONE_UWB UWB 部署区域的闭合多段线
LOC_ZONE_BL 蓝牙部署区域的闭合多段线
LOC_ZONE_EXCLUDE 卫生间及其他不部署区域
LOC_ZONE_NOTE 房间、设备区、空旷区及特殊要求说明

输出图层

图层 内容
LOC_UWB_BEACON UWB 圆圈及居中文字 UWB
LOC_UWB_LINK UWB 网格连线
LOC_BL_BEACON 蓝牙圆圈及居中文字 BL
LOC_BL_LINK 蓝牙网格连线
LOC_BEACON_STATS 单一部署项目的中文统计框
LOC_UWB_STATS 混合项目的 UWB 中文统计框
LOC_BL_STATS 混合项目的蓝牙中文统计框

安装

将仓库克隆到 Codex 的 Skills 目录:

git clone https://github.com/Darling5/place-location-beacons.git "$env:USERPROFILE\.codex\skills\place-location-beacons"

安装本地 Python 依赖:

python -m pip install -r requirements.txt

运行本地能力检查:

python scripts/preflight_local.py

如果本机没有可用的 AutoCAD、ODA 转换工具或其他 DWG 读取器,请在有 CAD 的本机把图纸导出为 ASCII DXF,再继续处理。禁止使用在线 DWG 转换网站。

使用示例

在 Codex 中可以这样描述任务:

使用 $place-location-beacons 在本地处理这份 DWG。
蓝色低风险区使用蓝牙,最大间距 7 米;红、橙、黄区域使用 UWB,最大间距 30 米。
卫生间不部署。先生成预览和统计,确认后再写入 DWG。

只有 DWG 时:

使用 $place-location-beacons 处理这份 DWG。目前没有风险四色图,请先询问我房间、设备区和空旷区的部署方式,并给出手工圈区图层要求。

典型流程

  1. 确认部署类型、区域归属、间距、排除区和 CAD 比例。
  2. 全程在本机读取并检查 DWG/DXF 与参考 PDF。
  3. 生成完整包边的正交网格、连线和数量统计。
  4. 检查最大间距、2–4 连接数、排除区、交叉和覆盖完整率。
  5. 向用户提供预览并等待确认。
  6. 在新的 DWG/DXF 副本中分层写入结果,不覆盖源图。
  7. 重新打开交付文件并审计信标、文字、连线和统计数量。

最终结果属于工程布置草案,现场安装前仍需复核墙体、设备遮挡、安装条件和无线视距。

实战经验

一份燃煤电厂总平面图的 UWB+蓝牙混合部署复盘:信标不穿墙与房间 4 锚点规则、总平面图房间识别管线(闭合多边形初筛 + 放大渲染目视确认)、排除色符号安全区膨胀、R2018 DXF 导出、ezdxf 直写交付等踩坑记录,见 references/field-notes-coal-plant-2026-09.md

English

Features

  • Supports UWB-only or Bluetooth-only projects.
  • Supports mixed projects with disjoint zone ownership, such as Bluetooth in blue low-risk zones and UWB in red, orange, and yellow zones.
  • Never places UWB and Bluetooth in the same room or continuous zone.
  • Builds a fully enclosed orthogonal grid using user-confirmed maximum spacing.
  • Gives every retained beacon 2–4 neighboring links.
  • Rejects diagonal links, X-shaped crossings, and crowded triangle repair clusters.
  • Excludes toilets and every user-defined no-deployment area.
  • Writes beacon symbols, links, and Simplified-Chinese statistics to dedicated CAD layers.
  • Produces previews, JSON summaries, DWG/DXF deliverables, and audit results.

Required confirmation before calculation

The skill does not silently assume 30 m or 7 m. At the start of each project, confirm:

  1. Whether the project uses one beacon technology or a disjoint mixed-zone assignment.
  2. The maximum spacing for every active technology. UWB 30 m and Bluetooth 7 m are suggestions only.
  3. The UWB, Bluetooth, or exclusion owner of every selected color, room, or closed polygon.
  4. The CAD-unit-to-metre relationship. Ask the user whenever scale cannot be established reliably.
  5. Toilets, roads, offices, warehouses, tanks, and any other excluded areas.

Spacing may be shorter than the confirmed maximum, but never longer. Interior intervals should remain close to the maximum and should be shortened only for perimeter closure, narrow areas, corners, or obstacle avoidance.

DWG/DXF without a risk-color reference

Ask the user how to classify:

  • Rooms: UWB, Bluetooth, or excluded.
  • Equipment areas: UWB, Bluetooth, or excluded.
  • Open areas: UWB, Bluetooth, or excluded.
  • Toilets and other no-deployment zones.

Recommend user-drawn closed polylines. Fully automatic local interpretation of an unmarked industrial drawing commonly takes about two hours and still requires manual review of rooms, walls, equipment boundaries, and open areas.

Recommended annotation layers:

Layer Purpose
LOC_ZONE_UWB Closed deployment polygons for UWB
LOC_ZONE_BL Closed deployment polygons for Bluetooth
LOC_ZONE_EXCLUDE Toilets and other excluded areas
LOC_ZONE_NOTE Room, equipment, open-area, and special-requirement notes

Output layers

Layer Content
LOC_UWB_BEACON UWB circles with centered UWB text
LOC_UWB_LINK UWB grid links
LOC_BL_BEACON Bluetooth circles with centered BL text
LOC_BL_LINK Bluetooth grid links
LOC_BEACON_STATS Simplified-Chinese summary for single-type projects
LOC_UWB_STATS UWB summary for mixed projects
LOC_BL_STATS Bluetooth summary for mixed projects

Installation

Clone the repository into the Codex Skills directory:

git clone https://github.com/Darling5/place-location-beacons.git "$env:USERPROFILE\.codex\skills\place-location-beacons"

Install local Python dependencies and run the offline preflight:

python -m pip install -r requirements.txt
python scripts/preflight_local.py

If no local AutoCAD, ODA converter, or other DWG reader is available, export the drawing to ASCII DXF on a CAD-equipped local machine. Never use an online DWG converter.

Example prompt

Use $place-location-beacons to process this DWG locally.
Use Bluetooth in blue low-risk zones with a 7 m maximum spacing, and UWB in red, orange, and yellow zones with a 30 m maximum spacing.
Exclude toilets. Generate a preview and quantity summary before writing the DWG.

Typical workflow

  1. Confirm beacon technologies, zone ownership, spacing, exclusions, and CAD scale.
  2. Inspect DWG/DXF and optional PDF references locally.
  3. Generate a fully enclosed orthogonal grid, links, and quantity statistics.
  4. Validate maximum spacing, 2–4 node degree, exclusions, crossings, and complete coverage.
  5. Present a preview and wait for user approval.
  6. Write layered results to a new DWG/DXF copy without overwriting the source.
  7. Reopen and audit beacon, label, link, and statistics counts.

The output is an engineering layout draft. Verify mounting feasibility, equipment obstruction, walls, and radio line of sight before field installation.

Field notes

A post-mortem of a coal-fired power plant general-layout deployment: no-wall-penetration and four-anchors-per-room rules, room detection on general layout drawings (closed-polygon prefilter plus zoomed-render visual confirmation), exclusion-color symbol-safety dilation, R2018 DXF export, and writing deliverables directly with ezdxf. See references/field-notes-coal-plant-2026-09.md.

Troubleshooting / 故障排查

If the runtime raises an UnknownError with a message like Type validation failed and the payload contains a billing.summary object, treat it as an upstream agent/runtime schema mismatch rather than a problem in the local beacon-planning scripts.

This repository only processes DWG/DXF/PDF/image files locally and does not call any billing endpoint. When this happens:

  1. Retry the request in a fresh agent turn.
  2. Use a supported chat/completions-capable model and ensure the agent runtime is current.
  3. If the error persists, switch to a different model or restart the agent session.
  4. Keep all project artifacts local; do not upload DWG/DXF/PDF to online converters or remote notebooks.

Repository structure / 仓库结构

place-location-beacons/
├── SKILL.md
├── agents/openai.yaml
├── references/
│   ├── deployment-rules.md
│   ├── field-notes-coal-plant-2026-09.md
│   ├── intake-and-local-processing.md
│   └── manual-zone-annotation.md
├── scripts/
│   ├── audit_beacons.lsp
│   ├── export_dwg_texts.lsp
│   ├── merge_beacon_plans.py
│   ├── place_beacons.lsp
│   ├── plan_reference_mask.py
│   ├── preflight_local.py
│   ├── register_pdf_to_dwg.py
│   └── validate_project_config.py
└── requirements.txt

For agent execution rules, see SKILL.md. / 机器执行规则请参阅 SKILL.md

About

Offline DWG/DXF UWB and Bluetooth beacon placement skill for Codex

Resources

Stars

2 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages