查看单个帖子
旧 2009-04-20, 04:12 PM   #1
yang686526
高级会员
 
注册日期: 06-11
帖子: 14579
精华: 1
现金: 224494 标准币
资产: 234494 标准币
yang686526 向着好的方向发展
默认 【转帖】[求助]在一个循环中再次打开图形出错

[求助]在一个循环中再次打开图形出错
www.dimcax.com
[求助]在一个循环中再次打开图形出错
想做个排除同心圆的函数,但调试不行,红色处出错,不知该如何写,大家帮帮忙吧,谢谢. public static objectidcollection del_concentric_circle(objectid[] ids) { database db = hostapplicationservices.workingdatabase; objectidcollection objids = new objectidcollection(); point3dcollection points = new point3dcollection(); if(ids == null) return objids = null; using(transaction trans = db.transactionmanager.startopenclosetransaction()) { for(int i = 0; i < ids.length; i++) { circle ent = (circle)trans.getobject(ids, openmode.forwrite); if(i == 0) { points.add(ent.center); objids.add(ids); } else { point3d point = ent.center; int n = points.indexof(point); if(n != -1) { objectid cirid = objids[n]; circle cent = (circle)trans.getobject(cirid, openmode.forread);//到这里就出错了,如何才能再次得到图形 if(cent.diameter < ent.diameter)objids[n] = ids; } else { objids.add(ids); points.add(point); } } } trans.commit(); } return objids; }
得到木头的帮助,已解决问题,把开始次的写打开改为读打开就ok了.
yang686526离线中   回复时引用此帖
GDT自动化论坛(仅游客可见)