3.2、ObjectARX开发基础例子程序

下面实现了应用程序加载和卸载时用到的函数。其中初始化的过程中向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.
//
void
initApp()
{
    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.
//
void
unloadApp()
{
    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());//自定义类移除
}


评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值