几何尺寸与公差论坛------致力于产品几何量公差标准GD&T (GDT:ASME)|New GPS(ISO)研究/CAD设计/CAM加工/CMM测量

几何尺寸与公差论坛------致力于产品几何量公差标准GD&T (GDT:ASME)|New GPS(ISO)研究/CAD设计/CAM加工/CMM测量 (http://www.dimcax.com/hust/index.php)
-   ObjectARX(VB.NET/C#) (http://www.dimcax.com/hust/forumdisplay.php?f=176)
-   -   【转帖】[求助]在一个循环中再次打开图形出错 (http://www.dimcax.com/hust/showthread.php?t=9153)

yang686526 2009-04-20 04:12 PM

【转帖】[求助]在一个循环中再次打开图形出错
 
[求助]在一个循环中再次打开图形出错
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了.


所有的时间均为北京时间。 现在的时间是 01:15 AM.