我用的是C#, Database db = new Database(true,true); Transaction trans = db.TransactionManager.StartTransaction(); BlockTable bt = (BlockTable)trans.GetObject(db.BlockTableId, OpenMode.ForWrite);
BlockTableRecord btr = (BlockTableRecord)trans.GetObject(bt[BlockTableRecord.ModelSpace ],OpenMode.ForWrite ); Line line = new Line(Point3d.Origin,new Point3d(0,0,0)); btr.AppendEntity(line); trans.AddNewlyCreatedDBObject(line,true); db.SaveAs("ttt.dwg",DwgVersion.Current); 大体是这样子的 |