← 返回
未分类

cad-skills

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.
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.
小九月
未分类 community v1.0.0 1 版本 100000 Key: 无需
★ 1
Stars
📥 301
下载
💾 0
安装
1
版本
#latest

概述

CAD Skills — 本地 CAD 自动化

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

支持软件

软件app_key进程名COM 自动化
----------------------------------
SolidWorkssolidworksSLDWORKS.exe
CATIAcatiaCNEXT.exe
Creocreoparametric.exe
Siemens NXugugraf.exe
中望CADzwcadZWCAD.exe完整
AutoCADautocadacad.exe完整

你的工作方式

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

决策表

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

部署

1. 环境要求

  • Windows 操作系统
  • Python 3.8+,安装 pywin32pip 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,在 zwcadcandidate_paths 中添加或修改您的 ZWCAD 安装路径。

4. 执行命令

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

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

进程管理

skillargs说明
-------------------
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 指定参数。

基础绘图

actionparams说明
----------------------
draw_circlecx, cy, radius画圆
draw_linex1, y1, x2, y2直线
draw_arccx, cy, radius, start_angle, end_angle圆弧(度)
draw_polylinepoints: [[x,y],...], [closed]多段线
draw_rectanglex1, y1, x2, y2矩形
draw_texttext, x, y, [height], [rotation]单行文字
draw_mtexttext, x, y, [width], [height]多行文字

公路工程专用

actionparams说明
----------------------
draw_centerlinepoints: [[x,y],...]道路中线(点划线)
draw_alignmentpoints, left_offset, right_offset道路边线
draw_slope_linex1,y1,x2,y2,[tick_spacing],[tick_length],[num_ticks]边坡示意线
draw_gridx0, y0, cols, rows, [spacing]矩形网格

标注

actionparams
----------------
add_dim_linearx1, y1, x2, y2, text_x, text_y
add_dim_alignedx1, y1, x2, y2, text_x, text_y
add_dim_radiuscx, cy, [angle_x], [angle_y], [leader_len]

图层与文档

actionparams
----------------
add_layername, [color], [linetype]
set_current_layername
list_layers
new_doc
open_docfilepath
save
save_asfilepath

视图与查询

actionparams
----------------
zoom_extents
zoom_windowx1, y1, x2, y2
regen
entity_count
doc_info
get_var / set_varname, [value]

COM 深入使用

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

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 源码注释。

故障排查

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

版本

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

版本历史

共 1 个版本

  • v1.0.0 Initial release 当前
    2026-05-10 14:24 安全 安全

安全检测

腾讯云安全 (Keen)

安全,无风险
查看报告

腾讯云安全 (Sanbu)

安全,无风险
查看报告

🔗 相关推荐

dev-programming

Mcporter

steipete
使用 mcporter CLI 直接列出、配置、认证及调用 MCP 服务器/工具(支持 HTTP 或 stdio),涵盖临时服务器、配置编辑及 CLI/类型生成功能。
★ 195 📥 67,802
dev-programming

YouTube

byungkyu
使用托管OAuth集成YouTube Data API,支持搜索视频、管理播放列表、获取频道数据及评论互动,适用于用户需要时使用此技能。
★ 142 📥 41,742
dev-programming

CodeConductor.ai

larsonreever
AI驱动平台,提供快速全栈开发、智能体、工作流自动化及低代码AI集成的可扩展产品创建。
★ 72 📥 182,162