Skip to content
Back to skills

397 Cad Skills

ASecurity

Control local CAD applications on Windows including launching apps, opening files, checking status, closing apps, detecting active or running apps, detecting common executable paths, saving user-provided executable paths, and full ZWCAD COM automation (drawing, layers, dimensions, document management). Use when user needs to control CAD software locally on Windows, especially ZWCAD/中望CAD for highway engineering drawing.

  • 4 stars
  • 0 votes
  • 0 copies
  • 0 views
  • Added November 29, 2026
toolspythonbashapi

Works with

  • api

Security analysis

A92/100
  • mediumInstalls packages at runtime which could introduce malicious dependencies

Pro scans all 5 files and shows the line behind each finding

Scanned November 29, 2026

npx -y skills add winlem2024/workbuddy-skills --skill 397-cad-skills --agent claude-code

Installs into .claude/skills of the current project.

Are you the author of 397 Cad Skills?

Add the live security badge to your README. It updates with every re-scan.

Security grade badge for 397 Cad Skills
[![Security: A — Skills Directory](https://www.skillsdirectory.com/api/skills/winlem2024-397-cad-skills/badge)](https://www.skillsdirectory.com/skills/winlem2024-397-cad-skills)

More formats (shields.io, HTML) on the badges page. Keep it an A: scan every change in CI with Pro.

Download with Pro
SKILL.md
---
name: cad-skills
description: Control local CAD applications on Windows including launching apps, opening files, checking status, closing apps, detecting active or running apps, detecting common executable paths, saving user-provided executable paths, and full ZWCAD COM automation (drawing, layers, dimensions, document management). Use when user needs to control CAD software locally on Windows, especially ZWCAD/中望CAD for highway engineering drawing.
---

# CAD Skills — 本地 CAD 自动化

远程操控本地 Windows 工作站上的 CAD 应用程序。

## 支持软件

| 软件 | app_key | 进程名 | COM 自动化 |
|------|---------|--------|-----------|
| SolidWorks | solidworks | SLDWORKS.exe | — |
| CATIA | catia | CNEXT.exe | — |
| Creo | creo | parametric.exe | — |
| Siemens NX | ug | ugraf.exe | — |
| 中望CAD | zwcad | ZWCAD.exe | 完整 |
| AutoCAD | autocad | acad.exe | 完整 |

## 你的工作方式

本技能运行在 **Windows 本地工作站**上。Agent(运行在远程)通过对话指导用户在 Windows 端执行操作。

### 决策表

| 用户意图 | 操作 |
|----------|------|
| 启动/关闭/检查 CAD | 调用 `skill_runner.py` 的 `launch_app`/`close_app`/`is_app_running` |
| ZWCAD 绘图(圆/线/多段线等) | 调用 `skill_runner.py` 的 `zwcad_com` + 对应 action |
| ZWCAD 图层/标注/文档管理 | 调用 `skill_runner.py` 的 `zwcad_com` + 对应 action |
| LISP 命令执行 | 调用 `skill_runner.py` 的 `exec_cad_command` |
| 用 CAD 打开文件 | 调用 `skill_runner.py` 的 `open_file_in_app` |

## 部署

### 1. 环境要求

- Windows 操作系统
- Python 3.8+,安装 `pywin32`:`pip install pywin32`
- ZWCAD 需以管理员身份运行一次以完成 COM 注册

### 2. 文件结构

```
cad-skills/
├── SKILL.md
├── scripts/
│   ├── skill_runner.py    ← 统一 JSON 入口
│   └── zwcad_com.py       ← ZWCAD COM 自动化核心
└── assets/
    └── config.json        ← 应用配置
```

### 3. 设置 ZWCAD 路径

编辑 `assets/config.json`,在 `zwcad` → `candidate_paths` 中添加或修改您的 ZWCAD 安装路径。

### 4. 执行命令

所有操作通过 `skill_runner.py` 执行,输入 JSON 格式:

```bash
cd cad-skills/scripts
python skill_runner.py '{"skill":"<操作名>","args":{...}}'
```

## 进程管理

| skill | args | 说明 |
|-------|------|------|
| `launch_app` | `{"app":"zwcad"}` | 启动应用 |
| `close_app` | `{"app":"zwcad","force":false}` | 关闭 |
| `is_app_running` | `{"app":"zwcad"}` | 检查运行状态 |
| `get_running_apps` | `{}` | 列出所有运行中的 CAD |
| `set_app_path` | `{"app":"zwcad","path":"C:\\..."}` | 保存可执行文件路径 |
| `open_file_in_app` | `{"app":"zwcad","file_path":"D:\\a.dwg"}` | 打开文件 |

## ZWCAD COM 绘图

`skill: "zwcad_com"`,参数中 `action` 指定操作,`params` 指定参数。

### 基础绘图

| action | params | 说明 |
|--------|--------|------|
| `draw_circle` | cx, cy, radius | 画圆 |
| `draw_line` | x1, y1, x2, y2 | 直线 |
| `draw_arc` | cx, cy, radius, start_angle, end_angle | 圆弧(度) |
| `draw_polyline` | points: [[x,y],...], [closed] | 多段线 |
| `draw_rectangle` | x1, y1, x2, y2 | 矩形 |
| `draw_text` | text, x, y, [height], [rotation] | 单行文字 |
| `draw_mtext` | text, x, y, [width], [height] | 多行文字 |

### 公路工程专用

| action | params | 说明 |
|--------|--------|------|
| `draw_centerline` | points: [[x,y],...] | 道路中线(点划线) |
| `draw_alignment` | points, left_offset, right_offset | 道路边线 |
| `draw_slope_line` | x1,y1,x2,y2,[tick_spacing],[tick_length],[num_ticks] | 边坡示意线 |
| `draw_grid` | x0, y0, cols, rows, [spacing] | 矩形网格 |

### 标注

| action | params |
|--------|--------|
| `add_dim_linear` | x1, y1, x2, y2, text_x, text_y |
| `add_dim_aligned` | x1, y1, x2, y2, text_x, text_y |
| `add_dim_radius` | cx, cy, [angle_x], [angle_y], [leader_len] |

### 图层与文档

| action | params |
|--------|--------|
| `add_layer` | name, [color], [linetype] |
| `set_current_layer` | name |
| `list_layers` | — |
| `new_doc` | — |
| `open_doc` | filepath |
| `save` | — |
| `save_as` | filepath |

### 视图与查询

| action | params |
|--------|--------|
| `zoom_extents` | — |
| `zoom_window` | x1, y1, x2, y2 |
| `regen` | — |
| `entity_count` | — |
| `doc_info` | — |
| `get_var` / `set_var` | name, [value] |

## COM 深入使用

如需使用 ZWCAD COM 对象模型的高级功能(实体操作、块插入、选择集、线型/颜色设置等),直接引用 `zwcad_com.py` 中的 `ZwcadCom` 类:

```python
from zwcad_com import ZwcadCom

com = ZwcadCom()
com.connect()

# 画圆
circle = com.add_circle(0, 0, 50)

# 移动实体
com.move(circle, 10, 20)

# 创建图层
com.add_layer("DIMENSION", color=3)

# 全选
ss = com.select_all()
```

完整 API 参考见 `zwcad_com.py` 源码注释。

## 故障排查

| 问题 | 解决方案 |
|------|----------|
| `缺少 pywin32` | `pip install pywin32` |
| `无法连接 ZWCAD` | 管理员身份运行 ZWCAD 一次 |
| `找不到可执行文件` | `set_app_path` 指定路径 |
| COM 不可用 | 回退到 `exec_cad_command`(SCR 脚本方案) |

## 版本

- 2026-05:新增 `zwcad_com.py` COM 完整自动化,支持公路工程专业绘图方法

Files in this skill

  • SKILL.md5.3 KB
  • _skillhub_meta.json827 B
  • assets/config.json1.6 KB
  • scripts/skill_runner.py24.3 KB
  • scripts/zwcad_com.py28.9 KB

Attribution

Is this your skill, or is something wrong with this listing? Request removal or report an issue. Author removals are honored within 72 hours.

View all in tools →

Comments

Loading comments…

Newsletter

Get the weekly list of safe new skills, and the ones we pulled.