以下是我的程序:程序实现(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"); } |