明经CAD社区

 找回密码
 注册

QQ登录

只需一步,快速开始

搜索
查看: 1733|回复: 1

!stub.cpp@148错误提示?

[复制链接]
发表于 2005-3-30 19:12:00 | 显示全部楼层 |阅读模式
AcDbObjectId blockId;
int retCode = 0;
AcDbBlockTable *pBlockTable = NULL;
AcDbBlockTableRecord* pBlockRecord
= new AcDbBlockTableRecord;

pBlockRecord->setName("样式");
AcGePoint3d basePoint(asPnt3d(pt));
pBlockRecord->setOrigin(basePoint);
acdbHostApplicationServices()->workingDatabase()
->getSymbolTable(pBlockTable, AcDb::kForWrite);
pBlockTable->add(blockId, pBlockRecord);
pBlockTable->close();
AcDbPolyline *pPoly=new AcDbPolyline();
//形成闭合多段线 已经定义pd1,pd2,pd3;
pPolyA->addVertexAt(0,pd1,0,-1,-1);
pPolyA->addVertexAt(1,pd2,0,-1,-1);
pPolyA->addVertexAt(2,pd3,0,-1,-1);
pPolyA->setClosed(Adesk::kTrue);
AcDbObjectId Id;
pBlockRecord->appendAcDbEntity(IdA, pPoly);
pPoly->close();
AcDbObjectIdArray IdArr;
IdArr.append(IdA); AcGeVector3d normal(0,0,1);
AcDbHatch *p_AcDbHatch1=new AcDbHatch();
p_AcDbHatch1->setNormal(normal);
p_AcDbHatch1->setElevation(0.0);
p_AcDbHatch1->setAssociative(true);
p_AcDbHatch1->setPatternScale(5);
p_AcDbHatch1->evaluateHatch(false); if(Acad::eOk!=p_AcDbHatch1->appendLoop(AcDbHatch::kDefault ,IdArr))
{

delete p_AcDbHatch1;
return ;
} //执行下面这条语句时候出现错误提示。AutoCAD运行挺长时间才出现错误提示 //用VC调试,好像是进程已经Exit(0)终止了
if( Acad::eOk!=p_AcDbHatch1->setPattern(AcDbHatch::kPreDefined,"SOLID"))
{

delete p_AcDbHatch1;
return ;
}
if( Acad::eOk!=p_AcDbHatch1->setHatchStyle(AcDbHatch::kNormal))
{

delete p_AcDbHatch1;
return ;
}
if(Acad::eOk!=p_AcDbHatch1->evaluateHatch(false))
{ delete p_AcDbHatch1;
return ;
}

AcDbObjectId HatchId1;
pBlockRecord->appendAcDbEntity(HatchId1,p_AcDbHatch1);
p_AcDbHatch1->close(); 上面是定义块的一部分代码,在当前文档中使用没有问题,但是用executeInApplicationContext(void (*procAddr)(void *)pFunc,void *pData ) const = 0; 函数切换文档,打开另一个文件,时候,在pFunc函数中使用,执行上述代码出现的错误;新文档已经设置了当前文档和活动文档,并且设置了写保护,加入实体没有问题。 请帮忙分析一下,是什么原因引起?
发表于 2005-6-17 15:24:00 | 显示全部楼层
新文档已经设置了当前文档和活动文档,并且设置了写保护,加入实体没有问题。


请问如何实现?可以设置当前活动文档,但是不能立即向该文档加入实体,必须另外重新再发一个命令。可以和你交流,欢迎和我联系?
您需要登录后才可以回帖 登录 | 注册

本版积分规则

小黑屋|手机版|CAD论坛|CAD教程|CAD下载|联系我们|关于明经|明经通道 ( 粤ICP备05003914号 )  
©2000-2023 明经通道 版权所有 本站代码,在未取得本站及作者授权的情况下,不得用于商业用途

GMT+8, 2024-11-26 06:50 , Processed in 0.153632 second(s), 24 queries , Gzip On.

Powered by Discuz! X3.4

Copyright © 2001-2021, Tencent Cloud.

快速回复 返回顶部 返回列表