本帖最后由 chpmould 于 2010-12-12 08:59 编辑
以下是绘圆程序,请老师帮助修添加一个循环
- public void CreateCircle()
- {
- Document doc = Application.DocumentManager.MdiActiveDocument;
- Editor ed = doc.Editor;
- PromptPointOptions p = new PromptPointOptions("\n请选取圆心点:");
- PromptPointResult result = ed.GetPoint(p);
- if (result.Status != PromptStatus.OK)
- return;
- Point3d centerPoint = result.Value;
- Database db = doc.Database;
- using (doc.LockDocument())
- using (Transaction tr = db.TransactionManager.StartTransaction())
- {
- BlockTable bt = (BlockTable)trans.GetObject(db.BlockTableId, OpenMode.ForRead);
- BlockTableRecord btr = (BlockTableRecord)trans.GetObject(bt[BlockTableRecord.ModelSpace], OpenMode.ForWrite);
- Circle c1 = new Circle(centerPoint, Vector3d.ZAxis, 10);
- btr.AppendEntity(c1);
- tr.AddNewlyCreatedDBObject(c1, true);
- tr.Commit();
- }
- }
|