![]() |
【转帖】自定义实体类相关--创建外部文件块的若干问题(欢迎讨论)
自定义实体类相关--创建外部文件块的若干问题(欢迎讨论)
自定义实体类相关--创建外部文件块的若干问题(欢迎讨论) 自定义实体类创建步骤:创建步骤和特性窗口中属性添加,显示和修改的问题(解决) 1. 新建project,项目文件名称 entitytest,选择arx程序; 2. 新建project,项目文件名称 centity选择add to current workspace和objectdbx(custom object definition); 3. 用class wizard添加自定义类cascocentity,包括函数和变量的定义[附件中只在worlddraw(acgiworlddraw* mode)中有修改]; 4. 在上级entitytest目录的 entitytest.cpp 文件中添加initapplication()中的dbx加载信息[acrxloadmodule("cascocentity.dbx", 0);],和unloadapplication()中的dbx卸载信息[acrxunloadmodule("cascocentity.dbx");]。 5. 在上级entitytest目录的stdarx.h中添加新定义类的#include "..\entitytest\centity\cascocentity.h" 文件说明。 6. 在entitytest项目的setting菜单中选link页面,输入对象的centity/debug/cascocentity.lib。 7. 至此,在原有的entitytest中就可以使用新定义的cascocentity类了。 定义了命令 // this is command 'test' void cascotest() { // todo: implement the command acdbblocktable *pblktbl; acdbhostapplicationservices()->workingdatabase()->getblocktable( pblktbl,acdb::kforread); acdbblocktablerecord *ptblrcd; pblktbl->getat(acdb_model_space,ptblrcd,acdb::kforwrite); pblktbl->close(); acutprintf("cascocentity *pmyent = new cascocentity();\n"); cascocentity *pmyent = new cascocentity(); ptblrcd->appendacdbentity(pmyent); pmyent->close(); ptblrcd->close(); } 整个项目文件: 现象: 执行到此处:acutprintf("cascocentity *pmyent = new cascocentity();\n"); 报出如下图片错误: 此主题相关图片如下: 问题: 1. 现在出现错误,请问实体派生问题出在哪儿?是我上边的步骤有错误,还是缺少必要的细节?很可能我的arx工程做的不对,哪位帮忙重新做一个arx来测试我的dbx工程是否正确。谢谢! 2. 一直没有能够看到自定义实体派生类,可以在特性窗口中添加,显示,修改数据的例子。只发现了帮助文档sample\simpledynprops中的例子,可以对acad自带的实体添加,显示,修改数据的例子。不知道那为大侠知道这方面的内容,帮我解决实体派生类的相关问题,不胜感激。 答案:在dbx工程里面多了cascocentity::setattributes(acgidrawabletraits* ptraits)属性值,导致程序跑飞了。广州qq朋友(杰)告诉的,只重载必须的函数。同时,第二个问题也得到解决。 |
所有的时间均为北京时间。 现在的时间是 03:23 PM. |