感谢指点,画出来了。
谢谢!
-
- [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();
-
- }
- }
|