![]() |
【转帖】[求助]各位高手帮帮忙:(扩展字典问题)
[求助]各位高手帮帮忙:(扩展字典问题)
[求助]各位高手帮帮忙:(扩展字典问题) 我想为各个层添加扩展字典,来记录层上的一些信息,下面是我的函数(我把层名作为字典的名字) createdictionary() { acdbobjectid pcurlayerid; pcurlayerid=acdbhostapplicationservices()->workingdatabase()->clayer(); acdblayertablerecord* ptrec; acdbopenobject(ptrec,pcurlayerid,acdb::kforwrite); ptrec->createextensiondictionary(); acdbobjectid dictobjid,xrecobjid; acdbxrecord *pxrec = new acdbxrecord; acdbdictionary* pdict; dictobjid=ptrec->extensiondictionary(); ptrec->close(); acdbopenobject(pdict,dictobjid,acdb::kforwrite); pdict->setat(pclname,pxrec,xrecobjid); pdict->close(); resbuf* head; head=acutbuildlist(acdb::kdxftext,name,acdb::kdxfreal,area,acdb::kdxfreal, rlength,acdb::kdxfreal,rwidth,acdb::kdxfint16,num,rtnone); pxrec->setfromrbchain(*head); pxrec->close(); acutrelrb(head); }//其中name、area、length、width、num分别为cstring double double double int型 为了验证扩展字典的正确性,我编写了下面的函数进行验证 readdictionary(cstring name) { acdblayertable *player; acdblayertablerecord *prec; acdbobjectid dictobjid; acdbdictionary *pdict; acdbxrecord *pxrec; acdbhostapplicationservices()->workingdatabase() ->getsymboltable(player,acdb::kforread); player->getat(name,prec,acdb::kforread); player->close(); dictobjid=prec->extensiondictionary(); prec->close(); acdbopenobject(pdict,dictobjid,acdb::kforread); pdict->getat(name,(acdbobject*&)pxrec,acdb::kforread); pdict->close(); struct resbuf* prblist; pxrec->rbchain(&prblist); pxrec->close(); prblist->rbnext;//从第二个数据开始输出 acedprintf("area=%f\n",prblist->resval.rreal); prblist->rbnext; acedprintf("length=%f\n",prblist->resval.rreal); prblist->rbnext; acedprintf("width=%f\n",prblist->resval.rreal); prblist->rbnext; acedprintf("num=%f\n",prblist->resval.rint); acutrelrb(prblist); } 编译运行都没有问题,可就是得不到我输入的结果,请问各位高手,我的程序哪里有问题;还是不可以为层添加扩展词典 问题解决了,这是一个愚蠢而低级的错误出错的地方我已经做了标注,下面是改进后的代码,希望大家不要犯和我类似的错误 resbuf *prblist; resbuf *ptemp; pxrec->rbchain(&prblist); ptemp=prblist; pxrec->close(); ptemp=ptemp->rbnext; acedprintf("area=%f\n",prblist->resval.rreal); ptemp=ptemp->rbnext; acedprintf("length=%f\n",prblist->resval.rreal); ptemp=ptemp->rbnext; acedprintf("width=%f\n",prblist->resval.rreal); ptemp=ptemp->rbnext; acedprintf("num=%f\n",prblist->resval.rint); acutrelrb(prblist); 哈哈,我又回来了。互相学习,共同提高qq:250623330我的群:1083110 |
| 所有的时间均为北京时间。 现在的时间是 07:35 AM. |