- 积分
- 2615
- 明经币
- 个
- 注册时间
- 2010-7-27
- 在线时间
- 小时
- 威望
-
- 金钱
- 个
- 贡献
-
- 激情
-
|
楼主 |
发表于 2011-1-17 20:26:25
|
显示全部楼层
感谢指点,画出来了。
谢谢!- [CommandMethod("arrow")]
- public void DrawArrow()
- {
- Point2d startPoint = new Point2d(10,0);
- Point2d middlePoint = new Point2d(50,0);
- Point2d endPoint = new Point2d(60,0);
- Polyline pLeader = new Polyline();
- pLeader.AddVertexAt(0, startPoint, 0, 0, 0);
- pLeader.AddVertexAt(1, middlePoint, 0, 1, 0);
- pLeader.AddVertexAt(2, endPoint, 0, 1, 0);
- Database db = HostApplicationServices.WorkingDatabase;
- using (Transaction trans = db.TransactionManager.StartTransaction()) {
- BlockTable bt = (trans.GetObject(db.BlockTableId, OpenMode.ForWrite)) as BlockTable;
- BlockTableRecord btr = (trans.GetObject(bt[BlockTableRecord.ModelSpace], OpenMode.ForWrite)) as BlockTableRecord;
- ObjectId objectId = btr.AppendEntity(pLeader);
- trans.AddNewlyCreatedDBObject(pLeader, true);
- trans.Commit();
- trans.Dispose();
-
- }
- }
|
|