← Back to Skills Marketplace
lgx281227231

CAD2PDF

by LGX281227231 · GitHub ↗ · v1.0.0 · MIT-0
cross-platform ✓ Security Clean
0
Downloads
1
Stars
0
Active Installs
1
Versions
Install in OpenClaw
/install cad2pdf
Description
CAD图纸转矢量PDF - 支持DWG/DXF格式,完整渲染中文标注、尺寸标注、填充图案
README (SKILL.md)

CAD2PDF - CAD图纸转矢量PDF

一句话介绍

CAD图纸发过来,一条命令出矢量PDF,中文标注、尺寸标注、填充图案全保留。

解决什么问题?

  • CAD图纸发微信:对方没CAD软件?→ 转PDF直接看
  • 图纸分享:DWG文件太大?→ 矢量PDF体积小、清晰度高
  • 打印出图:需要高质量PDF?→ 300DPI矢量输出
  • 中文乱码:其他工具中文显示不全?→ 完美支持中文标注

功能清单

  • 📐 DXF转矢量PDF - 完整保留图形、文字、标注
  • 🏗️ DWG转DXF - 通过ODA File Converter自动转换
  • 🈶 中文支持 - Noto Sans CJK字体,不乱码
  • 📏 尺寸标注 - DIMENSION实体完整渲染
  • 🎨 填充图案 - HATCH实体正确显示
  • ✂️ 自动裁剪 - 检测图框,只保留图框内内容
  • 📝 文字合并 - 自动合并重叠文字,避免显示异常
  • 🔄 特殊编码 - %%c→Ø,%%132→Φ 正确转换

依赖安装

系统依赖

# ODA File Converter (DWG转DXF)
wget "https://www.opendesign.com/guestfiles/get?filename=ODAFileConverter_QT6_lnxX64_8.3dll_27.1.deb" -O /tmp/ODAFileConverter.deb
sudo dpkg -i /tmp/ODAFileConverter.deb
sudo apt-get install -y libxkbcommon-x11-0 libxcb-icccm4 libxcb-image0 libxcb-keysyms1 libxcb-render-util0 libxcb-xkb1

# LibreCAD (备用方案)
sudo apt-get install -y librecad

# 中文字体
sudo apt-get install -y fonts-noto-cjk

Python依赖

pip install ezdxf matplotlib --break-system-packages

使用方法

基本用法

# DXF转PDF
python3 scripts/dxf2pdf_cjk.py 图纸.dxf 输出.pdf

# 指定纸张和DPI
python3 scripts/dxf2pdf_cjk.py 图纸.dxf 输出.pdf --paper A3 --dpi 300

# 批量转换
for f in *.dxf; do
    python3 scripts/dxf2pdf_cjk.py "$f" "${f%.dxf}.pdf" -a -p A3
done

命令行参数

  • --paper SIZE - 纸张大小:A0/A1/A2/A3/A4(默认A3)
  • --dpi N - 输出分辨率(默认300)

DWG文件处理

DWG文件需要先转DXF:

# 设置环境变量
export QT_QPA_PLATFORM_PLUGIN_PATH=/usr/bin/ODAFileConverter_27.1.0.0/plugins

# DWG转DXF
xvfb-run -a ODAFileConverter 输入目录 输出目录 ACAD2018 DXF 0 0

# 再转PDF
python3 scripts/dxf2pdf_cjk.py 输出文件.dxf 最终.pdf --paper A3

技术实现

  • 解析引擎:ezdxf(Python DXF解析库)
  • 渲染引擎:matplotlib(矢量图形渲染)
  • 中文字体:Noto Sans CJK
  • DWG转换:ODA File Converter 27.1
  • 备用方案:LibreCAD dxf2pdf

输出规格

  • 格式:PDF 1.4
  • 颜色:黑白(所有实体统一黑色)
  • 裁剪:自动检测图框,图框外内容不显示
  • 文字:自动合并重叠文字,避免显示异常

已知限制

  • DWG文件需要先安装ODA File Converter
  • 复杂的HATCH填充(样条曲线边界)可能显示不全
  • 尺寸标注的箭头符号(INSERT实体)未渲染,仅显示数值
  • 不支持3D实体渲染

相关技能

  • pdf-toolkit-pro - PDF合并、分割、压缩
  • word-docx - Word文档处理
  • excel-xlsx - Excel表格处理
Usage Guidance
Install only if you are comfortable adding the listed Python packages, apt packages, and optional ODA File Converter .deb to your system. For higher assurance, verify the ODA download source, use a virtual environment for Python dependencies, and run the converter on CAD files you trust.
Capability Tags
crypto
Capability Assessment
Purpose & Capability
The artifacts consistently describe converting DWG/DXF CAD drawings to PDF, and the shell/Python scripts implement that local conversion workflow.
Instruction Scope
Runtime instructions are user-directed: provide an input CAD file and optional output settings. No hidden agent instructions, prompt manipulation, credential use, or unrelated data access were found.
Install Mechanism
Setup documentation includes pip installs, apt packages, and an optional downloaded ODA File Converter .deb installed with sudo. This is disclosed and purpose-aligned, but users should treat it as a system-level third-party install.
Credentials
The requested dependencies are proportionate for DWG/DXF rendering and Chinese font support, though the metadata capability tag 'crypto' does not match the CAD-focused artifact content.
Persistence & Privilege
The skill has no background persistence or privilege escalation logic at runtime. If users run the documented sudo commands, installed packages will persist system-wide.
How to Use
  1. Make sure OpenClaw is installed (local or Docker)
  2. Run the install command in chat: /install cad2pdf
  3. After installation, invoke the skill by name or use /cad2pdf
  4. Provide required inputs per the skill's parameter spec and get structured output
Version History
v1.0.0
CAD图纸(DWG/DXF)转矢量PDF,完整渲染中文标注、尺寸标注、填充图案
Metadata
Slug cad2pdf
Version 1.0.0
License MIT-0
All-time Installs 0
Active Installs 0
Total Versions 1
Frequently Asked Questions

What is CAD2PDF?

CAD图纸转矢量PDF - 支持DWG/DXF格式,完整渲染中文标注、尺寸标注、填充图案. It is an AI Agent Skill for Claude Code / OpenClaw, with 0 downloads so far.

How do I install CAD2PDF?

Run "/install cad2pdf" in the OpenClaw or Claude Code chat to install it in one step — no extra setup required.

Is CAD2PDF free?

Yes, CAD2PDF is completely free, licensed under MIT-0. You can download, install and use it at no cost.

Which platforms does CAD2PDF support?

CAD2PDF is cross-platform and runs anywhere OpenClaw / Claude Code is available (cross-platform).

Who created CAD2PDF?

It is built and maintained by LGX281227231 (@lgx281227231); the current version is v1.0.0.

💬 Comments