!stub.cpp@148错误提示?
AcDbObjectId blockId;<BR> int retCode = 0;<BR> AcDbBlockTable *pBlockTable = NULL;<BR> AcDbBlockTableRecord* pBlockRecord<BR> = new AcDbBlockTableRecord;<BR> <BR> pBlockRecord->setName("样式");<BR> AcGePoint3d basePoint(asPnt3d(pt));<BR> pBlockRecord->setOrigin(basePoint);<BR> acdbHostApplicationServices()->workingDatabase()<BR> ->getSymbolTable(pBlockTable, AcDb::kForWrite);<BR> pBlockTable->add(blockId, pBlockRecord);<BR> pBlockTable->close();<BR> AcDbPolyline *pPoly=new AcDbPolyline();<BR> //形成闭合多段线 已经定义pd1,pd2,pd3;<BR> pPolyA->addVertexAt(0,pd1,0,-1,-1);<BR> pPolyA->addVertexAt(1,pd2,0,-1,-1);<BR> pPolyA->addVertexAt(2,pd3,0,-1,-1);<BR> pPolyA->setClosed(Adesk::kTrue);
<BR> AcDbObjectId Id;<BR> pBlockRecord->appendAcDbEntity(IdA, pPoly);<BR> pPoly->close();<BR> AcDbObjectIdArray IdArr;<BR> IdArr.append(IdA);
AcGeVector3d normal(0,0,1);<BR> AcDbHatch *p_AcDbHatch1=new AcDbHatch();<BR> p_AcDbHatch1->setNormal(normal);<BR> p_AcDbHatch1->setElevation(0.0);<BR> p_AcDbHatch1->setAssociative(true);<BR> p_AcDbHatch1->setPatternScale(5);<BR> p_AcDbHatch1->evaluateHatch(false);
if(Acad::eOk!=p_AcDbHatch1->appendLoop(AcDbHatch::kDefault ,IdArr))<BR> {<BR> <BR> delete p_AcDbHatch1;<BR> return ;<BR> }
//执行下面这条语句时候出现错误提示。AutoCAD运行挺长时间才出现错误提示
//用VC调试,好像是进程已经Exit(0)终止了<BR> if( Acad::eOk!=p_AcDbHatch1->setPattern(AcDbHatch::kPreDefined,"SOLID"))<BR> {<BR> <BR> delete p_AcDbHatch1;<BR> return ;<BR> }<BR> if( Acad::eOk!=p_AcDbHatch1->setHatchStyle(AcDbHatch::kNormal))<BR> {<BR> <BR> delete p_AcDbHatch1;<BR> return ;<BR> }<BR> if(Acad::eOk!=p_AcDbHatch1->evaluateHatch(false))<BR> {
delete p_AcDbHatch1;<BR> return ;<BR> }<BR> <BR> AcDbObjectId HatchId1;<BR> pBlockRecord->appendAcDbEntity(HatchId1,p_AcDbHatch1);<BR> p_AcDbHatch1->close();
上面是定义块的一部分代码,在当前文档中使用没有问题,但是用executeInApplicationContext(void (*procAddr)(void *)pFunc,void *pData ) const = 0;
函数切换文档,打开另一个文件,时候,在pFunc函数中使用,执行上述代码出现的错误;新文档已经设置了当前文档和活动文档,并且设置了写保护,加入实体没有问题。
请帮忙分析一下,是什么原因引起? 新文档已经设置了当前文档和活动文档,并且设置了写保护,加入实体没有问题。
请问如何实现?可以设置当前活动文档,但是不能立即向该文档加入实体,必须另外重新再发一个命令。可以和你交流,欢迎和我联系?
页:
[1]