![]() |
【转帖】[arx]求助 块的制作出现问题
[arx]求助 块的制作出现问题
[arx]求助 块的制作出现问题 以下是我的程序:程序实现(1)makeablock制作一个块 块包含的实体自己选定(2)printall 显示刚才制作的块的一些特性 问题:为什么特性不能显示? void ccfch1makeablock() { // todo: implement the command acdbblocktablerecord *precord=new acdbblocktablerecord(); char blockname[10]; acedgetstring(null,"\n输入块的名字",blockname); precord->setname(blockname);//"asdk-no-att" acdbblocktable *ptable; acdbobjectid recordid; acdbhostapplicationservices()->workingdatabase()->getblocktable(ptable,acdb::kforwrite); ptable->add(recordid,precord); ptable->close(); ads_name entname,entn; long len; acdbobjectid pentid,pid; acdbentity *pent; acedssget(null,null,null,null,entname); acedsslength(entname,&len); for(int i=0;i<len;i++) { acedssname(entname,i,entn); acdbgetobjectid(pentid,entn); acdbopenacdbentity(pent,pentid,acdb::kforread); precord->appendacdbentity(pid,pent); pent->close(); } precord->close(); acedssfree(entname); acutprintf("\n块操作完成"); } //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// void ccfch1printall() { // todo: implement the command int rc; char blkname[50]; rc = acedgetstring(adesk::ktrue, "enter block name <cr for current space>: ", blkname); if (rc != rtnorm) return; acutprintf("\n the 1"); if (blkname[0] == '\0') { if (acdbhostapplicationservices()->workingdatabase()->tilemode() == adesk::kfalse) { struct resbuf rb; acedgetvar("cvport", &rb); if (rb.resval.rint == 1) { strcpy(blkname, acdb_paper_space); } else { strcpy(blkname, acdb_model_space); } } else { strcpy(blkname, acdb_model_space); } } acutprintf("\n the 2"); acdbblocktable *pblocktable; acdbhostapplicationservices()->workingdatabase() ->getsymboltable(pblocktable, acdb::kforread); acdbblocktablerecord *pblocktablerecord; pblocktable->getat(blkname, pblocktablerecord, acdb::kforread); pblocktable->close(); acdbblocktablerecorditerator *pblockiterator; pblocktablerecord->newiterator(pblockiterator); acutprintf("\n the 3"); for (pblockiterator->start(); !pblockiterator->done(); pblockiterator->step()) { acdbentity *pentity; pblockiterator->getentity(pentity, acdb::kforread); acutprintf("\n the 4"); acdbhandle objhandle; pentity->getacdbhandle(objhandle); char handlestr[20]; objhandle.getintoasciibuffer(handlestr); const char *pcname = pentity->isa()->name(); acutprintf("\n the 5"); acutprintf("object id %lx, handle %s, class %s.\n", pentity->objectid(), handlestr, pcname); pentity->close(); } delete pblockiterator; pblocktablerecord->close(); acutprintf("\n"); } 是不是应该把const char *pcname = pentity->isa()->name();的const去掉? 不是 因为 for (pblockiterator->start(); !pblockiterator->done(); pblockiterator->step())这个循环进不去,块浏览器根本没有发现实体 |
| 所有的时间均为北京时间。 现在的时间是 02:44 AM. |