刚开始用C#开发AutoCAD,向绘制几条Pline,但在使用while、for等循环的过程中,总是导致cad崩溃。 发生问题的代码如下: Polyline[] MidBox = new Polyline[5]; for (int ILoop = 0; ILoop < 5; ILoop++) { MidBox[ILoop].AddVertexAt(0, new Point2d(0, 0), 0, 0, 0); MidBox[ILoop].AddVertexAt(1, new Point2d(1, 1), 0, 0, 0); MidBox[ILoop].AddVertexAt(2, new Point2d(2, 2), 0, 0, 0); MidBox[ILoop].AddVertexAt(3, new Point2d(3, 3), 0, 0, 0); MidBox[ILoop].AddVertexAt(4, new Point2d(4, 4), 0, 0, 0); MidBox[ILoop].AddVertexAt(5, new Point2d(5, 5), 0, 0, 0); ////向块表记录中添加边箱线 //btr.AppendEntity(MidBox[ILoop]); //trans.AddNewlyCreatedDBObject(MidBox[ILoop], true); } 请问是怎么回事? |