如何在已有的块上添加块定义
<p>如题,我写的代码如下,好像没出错,但是重新打开之后没有发现块有定义</p><p><font face="Verdana"> Dim db As Database = New Database(False, True)<br/> db.ReadDwgFile(Path, System.IO.FileShare.ReadWrite, True, "")<br/> Using trans As Transaction = db.TransactionManager.StartTransaction()<br/> Dim bt As BlockTable = trans.GetObject(db.BlockTableId, OpenMode.ForWrite)<br/> If Not bt.Has(curUnitName) Then<br/> Return<br/> End If<br/> Dim btr As BlockTableRecord = trans.GetObject(bt(curUnitName), OpenMode.ForWrite)<br/> Dim attdef As New AttributeDefinition<br/> attdef.Tag = “SP"<br/> attdef.TextString = "SPText"</font></p>
<p><font face="Verdana"> btr.AppendEntity(attdef)<br/> trans.Commit()<br/> End Using<br/> db.Dispose()</font></p> 没有保存到文件:) nice
页:
[1]