明经CAD社区

 找回密码
 注册

QQ登录

只需一步,快速开始

搜索
查看: 1471|回复: 5

[ARX]这段代码为什么老出错?

[复制链接]
发表于 2006-1-24 22:57:00 | 显示全部楼层 |阅读模式
本帖最后由 作者 于 2006-1-25 0:29:23 编辑

 ads_name entname;
 ads_point ptt;
 AcDbObjectId entId;
 AcDb2dPolyline*  pent;
 acedEntSel("\n选择多段线",entname,ptt);
 acdbOpenObject(pent,entId,AcDb::kForRead);//在这里出错
 AcDbObjectIterator* pvertexiter=pent->vertexIterator();//
 pent->close();
 AcDb2dVertex *pvertex;
 AcGePoint3d location;
 AcDbObjectId vertexId;

 for(int i=0;!pvertexiter->done();i++,pvertexiter->step())
 {
  vertexId=pvertexiter->objectId();
  acdbOpenObject(pvertex,vertexId,AcDb::kForRead);
  location=pvertex->position();
  pvertex->close();
  acutPrintf("\n 坐标 x=%0.3f,y=%0.3f,z=%0.3f",location[X],location[Y],location[Z]);
 }
 delete  pvertexiter;
 该怎么调试?

发表于 2006-2-5 14:52:00 | 显示全部楼层

Acad::ErrorStatus dbStatus = acdbOpenObject(pent,entId,AcDb::kForRead);

在Debug模式下,根据dbStatus的值判断出可能的错误。

发表于 2006-2-6 22:51:00 | 显示全部楼层

试试

Acad::ErrorStatus es = acdbOpenAcDbEntity((AcDbEntity *&)pent,entId,AcDb::kForRead);

发表于 2006-2-13 20:16:00 | 显示全部楼层

这是那个书上的例子吧,我也遇到了这个问题,也正烦着呢

 

发表于 2006-2-15 11:56:00 | 显示全部楼层

好像没给entId赋值啊

 

发表于 2006-2-15 20:28:00 | 显示全部楼层

AcDb2dPolyline*  pent;
改成

AcDbPolyline* pent;

您需要登录后才可以回帖 登录 | 注册

本版积分规则

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

GMT+8, 2025-2-23 18:39 , Processed in 0.167734 second(s), 24 queries , Gzip On.

Powered by Discuz! X3.4

Copyright © 2001-2021, Tencent Cloud.

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