Imports Autodesk.AutoCAD.ApplicationServicesImports Autodesk.AutoCAD.EditorInputImports Autodesk.AutoCAD.RuntimePublic Class WellcomCADImplements IExtensionApplicationPublic Sub Initialize() Implements IExtensionApplication.InitializeMsgBox("net程序已经初始化!")End SubPublic Sub Terminate() Implements IExtensionApplication.TerminateDebug.WriteLine("net程序即将销毁")End Sub<CommandMethod("Hello")>Public Sub Hello()Dim ed As Editor = Application.DocumentManager.MdiActiveDocument.Editored.WriteMessage("欢迎进入cad世界!")End SubEnd Class
这样就可以在启动net程序时做一些初始化和收尾工作,比如初始环境检测、程雪结束释放资源,相关内容写入日志等