我现在要取图层上的所有块参照的块名,使用选择集没做出来,程序如下 rb.restype =2; char Sbuf[16]; strcpy(Sbuf,"BLOCKREFERENCE"); rb.resval.rstring = Sbuf; rb.rbnext = NULL; ads_name ss; acedSSGet("X",NULL,NULL,&rb,ss); 不知道失败的原因,只好采用遍历的方法,看到前面有帖子有遍历块表里的块名的方法,采用之,发现没办法用取到的块表块名来取块参照的块名,苦思两天了,不知道是为什么,请大家不吝赐教!!谢谢了!! pTable->getAt(saBlockName.GetAt(i),Id); //AcDbEntity *pEnt; AcDbObject *pObj; Acad::ErrorStatus es; es = acdbOpenAcDbObject(pObj,Id,AcDb::kForRead); //es = acdbOpenObject(pEnt,Id,AcDb::kForRead);(使用时出错es ==eNotAnEntity,因此采用acdbOpenAcDbObject) //AcRxObject ent = pEnt->AcRxObject; AcDbBlockReference *pBlkRef=new AcDbBlockReference;//= (AcDbBlockReference*)pObj if(pBlkRef->isKindOf(AcDbBlockReference::desc())) { pBlkRef= AcDbBlockReference::cast(pObj);(!!!!!!!出错地点:pBlkRef的返回值为0) } AcDbObjectId pBlkTblRecId; //pBlkTblRecId = pBlkRef->blockTableRecord(); pBlkTblRecId = pBlkRef->objectId(); |