[求助]打开文档时不是模型空间的问题
<p>有些文件打开的时候是在布局的状态中</p><p> </p>
<p>请教一下。怎么在打开它时把它设置为模型空间的状态呢。</p>
<p> </p>
<p>用什么类的什么函数呢?</p> http://forums.autodesk.com/t5/NET/Changing-Current-Layout/m-p/2651396#M18401
public static void Test11()
{
Document doc = Application.DocumentManager.MdiActiveDocument;
Database db = doc.Database;
Editor ed = doc.Editor;
using (doc.LockDocument())
{
using (Transaction tr = db.TransactionManager.StartTransaction())
{
var bt = db.BlockTableId.GetObject(OpenMode.ForRead) as BlockTable;
var btr = bt.GetObject(OpenMode.ForRead) as BlockTableRecord;
Layout lo = btr.LayoutId.GetObject(OpenMode.ForRead) as Layout;
LayoutManager.Current.CurrentLayout = lo.LayoutName;
tr.Commit();
}
}
}
非常感谢版主,问题解决了。
页:
[1]