Cad 二次开发 怎么实现 在启动Cad的时候自动加载dll文件(不需要手动输入netload)
点击 启动组=>添加=>点击Test.lsp=>打开。打开Cad,点击工具=>加载应用程序。保存后缀lsp,Test.lsp。
·
using Autodesk.AutoCAD.ApplicationServices;
using Autodesk.AutoCAD.Runtime;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace TestLoad
{
public class Class1
{
[CommandMethod(nameof(Test))]
public void Test()
{
Application.ShowAlertDialog("我来了!!!");
}
}
}
- DLL文件所在的文件夹路径下新建一个记事本,在记事本中写入以下内容:
(command “netload” “E:\Guo\CadDevelopment\TestLoad\bin\Debug\TestLoad.dll”)
-
保存后缀lsp,Test.lsp

-
打开Cad,点击工具=>加载应用程序

-
点击 启动组=>添加=>点击Test.lsp=>打开

-
现在输入 Test 就好了

遇到错误
今天踩坑(2023.7.12) 路径一定要是全英文,不然乱码,还有就是
(command “netload” “E:\Guo\CadDevelopment\TestLoad\bin\Debug\TestLoad.dll”)
这里不要有多余的空格或换行,
多余的空格或换行:AutoCAD 对命令输入的空格和换行符非常敏感,确保命令及其参数之间没有多余的空格或换行符。
魔乐社区(Modelers.cn) 是一个中立、公益的人工智能社区,提供人工智能工具、模型、数据的托管、展示与应用协同服务,为人工智能开发及爱好者搭建开放的学习交流平台。社区通过理事会方式运作,由全产业链共同建设、共同运营、共同享有,推动国产AI生态繁荣发展。
更多推荐

所有评论(0)