1.visual studio创建.NET Framework

2.新建一个项目

 3.添加引用

可以看到其中包含Autodesk.AutoCAD.Colors、Autodesk.AutoCAD.Geometry、Autodesk.AutoCAD.Runtime等等

 

4、添加一个命令方法
using Autodesk.AutoCAD.ApplicationServices; using
Autodesk.AutoCAD.EditorInput; using Autodesk.AutoCAD.Runtime; using System;
using System.Collections.Generic; using System.Linq; using System.Text; using
System.Threading.Tasks; namespace Hello_CAD { public class Class1 {
[CommandMethod("hello")] public void Hello() { //声明命令行对象 Editor editor =
Application.DocumentManager.MdiActiveDocument.Editor; //输出文字
editor.WriteMessage("Hello_CAD!"); } } }
DocumentManager包含所有document对象

5、直接复制过来

 6、到CAD里输入NETLOAD

然后就可以输入hello

 成功!

技术
下载桌面版
GitHub
百度网盘(提取码:draw)
Gitee
云服务器优惠
阿里云优惠券
腾讯云优惠券
华为云优惠券
站点信息
问题反馈
邮箱:ixiaoyang8@qq.com
QQ群:766591547
关注微信