明经CAD社区

 找回密码
 注册

QQ登录

只需一步,快速开始

搜索
查看: 1308|回复: 2

急!请教高手

[复制链接]
发表于 2004-6-12 13:47:00 | 显示全部楼层 |阅读模式
我编的打断线条的代码,为了测试,再求出交点后,在交点位置生成acdbtext,显示交点序号。命令执行后,如果删除生成的文字,AutoCAD就会出现 scran.cpp!eHadMultipltReader的错误,然后死掉。请教高手到底是啥子问题。 代码如下: Acad::ErrorStatus TOMbreakEnt(ads_name entSrc,ads_name entDis,int &intersectNum)
{
AcDbEntity *pEntSrc,*pEntDis;
AcDbObjectId idSrc,idDis;
if (entSrc[0]==entDis[0] && entSrc[1]==entDis[1])
return Acad::eInetUnknownError;
if (acdbGetObjectId(idDis,entDis)!=Acad::eOk)
return Acad::eInetUnknownError;
if (acdbOpenObject(pEntDis,idDis,AcDb::kForRead)!=Acad::eOk)
return Acad::eInetUnknownError;
if (!pEntDis->isKindOf(AcDbCurve::desc()) )
return Acad::eInetUnknownError; if (acdbGetObjectId(idSrc,entSrc)!=Acad::eOk)
return Acad::eInetUnknownError;
if (acdbOpenObject(pEntSrc,idSrc,AcDb::kForRead)!=Acad::eOk)
return Acad::eInetUnknownError; AcGePoint3dArray aIntersect;
AcGePoint3d or(0,0,0);
AcGeVector3d vx(1,0,0),vy(0,1,0);
AcGePlane pl(or,vx,vy);
ads_name entLast;
ads_point p1;
//pEntDis->intersectWith(pEntSrc,AcDb::kOnBothOperands,pl,aIntersect);
pEntSrc->intersectWith(pEntDis,AcDb::kOnBothOperands,pl,aIntersect);
pEntSrc->close();
pEntDis->close();
if (aIntersect.length()>intersectNum)
intersectNum=aIntersect.length();
AcDbText *pText;
char text[100];
if (!aIntersect.isEmpty()){
for (long i=aIntersect.length()-1;i>=0;i--){
p1[X]=(aIntersect)[X];
p1[Y]=(aIntersect)[Y];
p1[Z]=(aIntersect)[Z];
acedCommand(RTSTR,"_break",RTLB, RTENAME, entDis, RTPOINT, p1, RTLE,RTPOINT,p1,RTNONE); //测试用代码,如果把文字的插入点改为一样的,比如AcGePoint3d point1 //pText=new AcDbText(point1,text,AcDbObjectId::kNull,1,0)就不会出错了
sprintf(text,"%d",i);
pText=new AcDbText(aIntersect,text,AcDbObjectId::kNull,1,0);
AddEntity(pText);
pText->close();
}
}
return Acad::eOk;
}
发表于 2004-6-12 19:57:00 | 显示全部楼层
acedCommand(RTSTR,"_break",RTLB, RTENAME, entDis, RTPOINT, p1, RTLE,RTPOINT,p1,RTNONE);


you delete this line.maybe error caused because of this line.


try.


good luck!
 楼主| 发表于 2004-6-15 17:25:00 | 显示全部楼层
我解决乐,是有些entdis已经在上层函数中打开了,结果不能调用break打断它
您需要登录后才可以回帖 登录 | 注册

本版积分规则

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

GMT+8, 2024-11-29 19:08 , Processed in 0.177915 second(s), 24 queries , Gzip On.

Powered by Discuz! X3.4

Copyright © 2001-2021, Tencent Cloud.

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