我也是刚学,简单画线和画圆- public void LineCir()
- {
- Database db = HostApplicationServices.WorkingDatabase;
- using (Transaction ta = db.TransactionManager.StartTransaction())
- {
- BlockTable bt = (BlockTable)ta.GetObject(db.BlockTableId, OpenMode.ForRead);
- BlockTableRecord btr = (BlockTableRecord)ta.GetObject(bt[BlockTableRecord.ModelSpace], OpenMode.ForWrite);
- Line Lent = new Line(new Point3d(0, 0, 0), new Point3d(20, 10, 0));
- Circle Cent = new Circle(new Point3d(0, 0, 0), Vector3d.ZAxis, 5);
- btr.AppendEntity(Lent);
- btr.AppendEntity(Cent);
- ta.AddNewlyCreatedDBObject(Lent, true);
- ta.AddNewlyCreatedDBObject(Cent, true);
- ta.Commit();
- }
- }
|