求助:调试的问题。
这是我编的一个选取实体来生成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();
}
我的这个可以点选以生成块,
void test()
{
ads_name en;
ads_point pt;
int rt=1;
Acad::ErrorStatus es;
AcDbBlockTable *pBlockTable;
acdbHostApplicationServices()->workingDatabase()->getSymbolTable(pBlockTable,AcDb::kForWrite);
AcDbBlockTableRecord *pBlk=new AcDbBlockTableRecord;
es=pBlk->setName("TestBlk");
es=pBlk->setOrigin(AcGePoint3d(0,0,0));
// -------------------
while (rt)
{
rt=acedEntSel("\nSpecify a object:",en,pt);
switch(rt)
{
case RTERROR:
acutPrintf("\n Invalid selection.");
break;
case RTCAN:
acutPrintf("\n Selection over.");
rt=0;
break;
case RTNORM:
AcDbObjectId eId;
acdbGetObjectId(eId,en);
AcDbEntity *pEnt=NULL,*pClone=NULL;
es=acdbOpenAcDbEntity(pEnt,eId,AcDb::kForRead);
pClone=AcDbEntity::cast(pEnt->clone());
es=pBlk->appendAcDbEntity(eId,pClone);
pBlockTable->add(eId,pBlk);
pEnt->close();
pClone->close();
break;
}
}
// ------------------------
pBlk->close();
pBlockTable->close();
}
呵呵,谢谢,想明白是什么问题了。
还有一个问题是:当在调试模式下面,运行到acdbGetObjectId()时,会跳出一个Find Symble对话框,提示:"Please enter the path for acdbhdr.pdb"不知道什么意思。。。
不知各位碰到过没有。我选择的 结束 ,没有理它,但是并不影响程序的运行。如果不在调试模式下,就不会出现这个问题。
我用的是vc++6.0和acad2002。
我也不知道,我也是半桶水,应该还没有半桶昵,
我用的也是 VC6+CAD2002的了
有机会一起来学习啊
好啊好啊。。。。
其实觉得学objectarx也不难,有帮助文档就可以啦。现在开始有整体的感觉了。
页:
[1]