//定义InitClass类为程序的入口点,让AutoCAD只会执行OptimizeClass中的命令
[assembly: ExtensionApplication(typeof(InitAndOpt.InitClass))]
[assembly: CommandClass(typeof(InitAndOpt.OptimizeClass))]
。。。。。。。
public class InitClass:IExtensionApplication
{
public void Initialize()
{
Editor ed = Application.DocumentManager.MdiActiveDocument.Editor;
ed.WriteMessage("程序开始初始化!");