3.2、ObjectARX开发基础例子程序

来源:互联网 发布:西方中心论 知乎 编辑:程序博客网 时间:2024/05/16 08:30

下面实现了应用程序加载和卸载时用到的函数。其中初始化的过程中向AutoCAD中注册了两个新命令:CREATEITERATE。他同时初始化了一个自定义类AsdkMyClass并且通过调用acrxBuildClassHierarchy()函数将他添加到运行时类的结构当中。(关于AsdkMyClass 的描述,一个自定义类的例子参考第12.6节

// The initialization function called from the acrxEntryPoint()// function during the kInitAppMsg case is used to add commands// to the command stack and to add classes to the ACRX class// hierarchy.//voidinitApp(){    acedRegCmds->addCommand("ASDK_DICTIONARY_COMMANDS",//组名        "ASDK_CREATE", "CREATE", ACRX_CMD_MODAL,//命令名,命令名,命令类型        createDictionary);//命令对应的函数    acedRegCmds->addCommand("ASDK_DICTIONARY_COMMANDS",        "ASDK_ITERATE", "ITERATE", ACRX_CMD_MODAL,        iterateDictionary);    AsdkMyClass::rxInit();//自定义类的初始化    acrxBuildClassHierarchy();//新加类添加到运行时类结构中}// The cleanup function called from the acrxEntryPoint() // function during the kUnloadAppMsg case removes this application's// command set from the command stack and removes this application's// custom classes from the ACRX runtime class hierarchy.//voidunloadApp(){    acedRegCmds->removeGroup("ASDK_DICTIONARY_COMMANDS");//移除命令组    // Remove the AsdkMyClass class from the ACRX runtime    // class hierarchy. If this is done while the database is    // still active, it should cause all objects of class    // AsdkMyClass to be turned into proxies.    //    deleteAcRxClass(AsdkMyClass::desc());//自定义类移除}


0 0
原创粉丝点击