如何获得刚插入的 块 或者 实体 的ObjectId?
<p> using (Transaction t = doc.TransactionManager.StartTransaction())<br/> {<br/> ObjectId idBTR = doc.Database.Insert(blockname, db, false);<br/> BlockTable bt = (BlockTable)t.GetObject(doc.Database.BlockTableId, OpenMode.ForRead);<br/> BlockTableRecord btr = (BlockTableRecord)t.GetObject(bt, OpenMode.ForWrite);<br/> using (BlockReference bref = new BlockReference(pt, idBTR))<br/> {<br/> btr.AppendEntity(bref); <br/> t.AddNewlyCreatedDBObject(bref, true);<br/> asdf = bref.BlockId;//return btr.ObjectId.ToString(); </p><p> }<br/> t.Commit();<br/> t.Dispose();<br/> return asdf;<br/> }</p><p>我尝试在 插入的时候 把 BlockReference bref 的ID 保存 并返回</p><p>但经过调试发现 获得的这个ObjectId 不是 实际插入的 ObjectId</p><p>好象有函数 可以直接获得刚插入的 块 或者 实体 的ObjectId</p><p>请教下高手, 谢谢!</p>
页:
[1]