开发环境
- 中望CAD版本:2021
VS版本:2015
1.创建类库项目
.NET Framework4.7
2.添加类库
ZwDatabaseMgd.dll ZwManaged.dll
这两个DLL位于中望CAD安装目录下,复制本地属性改为False
3.导入命名空间
using ZwSoft.ZwCAD.Runtime;
using ZwSoft.ZwCAD.ApplicationServices;
using ZwSoft.ZwCAD.DatabaseServices;
using ZwSoft.ZwCAD.EditorInput;
4.定义命令
[CommandMethod("test")]
public void test()
{
DocumentCollection docs = Application.DocumentManager;
Document doc = docs.MdiActiveDocument;
Editor ed = doc.Editor;
Database db = doc.Database;
ed.WriteMessage("test");
}