[求助]绘图后无法保存
我的绘图代码如下://把对象加到CAD中
private static void AddDBObjectToCAD(DBObjectCollection dbObjs)
{
//获得当前文档和数据库 Get the current document and database
Document acDoc = Application.DocumentManager.MdiActiveDocument;
acDoc.LockDocument();
Database acCurDb = acDoc.Database;
// 启动一个事务Start a transaction
using (Transaction acTrans = acCurDb.TransactionManager.StartTransaction())
{
// 以只读方式打开块表 Open the Block table for read
BlockTable acBlkTbl;
acBlkTbl = acTrans.GetObject(acCurDb.BlockTableId,
OpenMode.ForRead) as BlockTable;
// 以写方式打开模型空间块表记录 Open the Block table record Model space for write
BlockTableRecord acBlkTblRec;
acBlkTblRec = acTrans.GetObject(acBlkTbl,
OpenMode.ForWrite) as BlockTableRecord;
foreach (DBObject dbObj in dbObjs)
{
acBlkTblRec.AppendEntity(dbObj as Entity);
acTrans.AddNewlyCreatedDBObject(dbObj as Entity, true);
}
acTrans.Commit();
acTrans.Dispose();
}
acDoc.Editor.Regen();
}
保存的时候出现:"文档Drawing1.dwg正在执行命令。按回车键取消或重试(R)"
请高手帮忙解决。 using(acDoc.LockDocument())
{
using (Transaction acTrans = acCurDb.TransactionManager.StartTransaction())
{
......
}
}
页:
[1]