编程很好玩!
编程很好玩!

导航

 

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

using Autodesk.AutoCAD.Runtime;
using Autodesk.AutoCAD.ApplicationServices;
using Autodesk.AutoCAD.EditorInput;

[assembly: ExtensionApplication(typeof(AutoLoadApplication.Initiallization))] //扩展
[assembly: CommandClass(typeof(AutoLoadApplication.Autoload))]
namespace AutoLoadApplication
{
    public class Initiallization : Autodesk.AutoCAD.Runtime.IExtensionApplication //当调用类库时,自动加载执行
    {
        public void Initialize()
        {
            Editor ed = Application.DocumentManager.MdiActiveDocument.Editor;
            ed.WriteMessage("自动加载,进行初始化!");
        }
        public void Terminate()
        {
            Console.WriteLine("清理!");
        }
    }

    public class Autoload
    {
        [CommandMethod("Test")]
        public void Test()
        {
            Editor ed = Application.DocumentManager.MdiActiveDocument.Editor;
            ed.WriteMessage("这是一个Test命令!");
        }
    }
}

posted on 2009-11-24 14:24  lzp  阅读(389)  评论(0编辑  收藏  举报