本帖最后由 作者 于 2006-5-27 11:31:25 编辑
这是我编的一个选取实体来生成block的一段程序,但是当调试运行到:err=acdbGetObjectId(idsel,sget);
跳出上面的Find Symble的 对话框,"Please enter the path for acdbhdr.pdb"不知道什么意思。。。
并且编译以后,在cad中运行并不能生成图块,但是凭我的水平怎么也找不出问题了。
希望哪位大虾能帮帮我,先谢了。
#include "StdAfx.h" #include "StdArx.h" #include "resource.h" #include "dbsymtb.h " #include "acedads.h" #include "dbmain.h"
// This is command 'SETLAYER' void Asdkpblock()
{
bool const openErasedEntity = false; bool const openErasedRec = false; ads_name sget; ads_point pt; AcDbObjectId idsel; AcDbEntity *entsel; Acad::ErrorStatus err; int rc=1;
AcDbBlockTableRecord *pSelRec=new AcDbBlockTableRecord; pSelRec->setName("firstblock"); pSelRec->setOrigin(AcGePoint3d(0,0,0)); while(rc) { rc=acedEntSel("\nplease select an entity:",sget,pt); switch(rc) { case RTNORM: err=acdbGetObjectId(idsel,sget); if(err!=Acad::eOk) { acutPrintf("\n Invalid ads_name."); return; } acutPrintf("\n ObjectId is %s",idsel); acdbOpenAcDbEntity(entsel,idsel,AcDb::kForRead,openErasedEntity); entsel->highlight(); pSelRec->appendAcDbEntity(entsel); entsel->close(); acedSSFree(sget); break; case RTERROR: acutPrintf("\n Invalid selection."); return; break; case RTCAN: acutPrintf("\n Selection over."); rc=0; break; } //End of switch. }
AcDbDatabase *pcurdb=NULL; AcDbBlockTable *pbTable; pcurdb=acdbHostApplicationServices()->workingDatabase(); pcurdb->getBlockTable(pbTable,AcDb::kForWrite); pbTable->add(pSelRec); pbTable->close(); pSelRec->close(); } |