mrl989 发表于 2022-7-6 21:54:17

VB。net/edit插入动态

我会用VB。net编辑正常插入块引用的属性文本字符串,但它不适用于动态块,请帮助。
致以最诚挚的问候。

mrl989 发表于 2022-7-6 23:24:14

Public Sub UpdateAtt(ByVal tr As Transaction, ByVal objID As ObjectId)      
         Dim br As BlockReference = DirectCast(tr.GetObject(objID, OpenMode.ForWrite), BlockReference)
         Dim btr As BlockTableRecord = DirectCast(tr.GetObject(br.DynamicBlockTableRecord, OpenMode.ForWrite), BlockTableRecord)
   
         For Each attID As ObjectId In btr
               Dim ent As DBObject = tr.GetObject(attID, OpenMode.ForWrite)
               If TypeOf ent Is AttributeDefinition Then
                   Dim AttDef As AttributeDefinition = ent
                   If AttDef.Tag = "SH" Then AttDef.TextString = "111"                  
               End If
         Next

End Sub
如果br不是动态块,br的属性可以通过br的属性集合进行编辑,但它不适用于动态块,因此我认为这项工作可以通过属性定义来完成,但也不起作用,感谢阅读。。。
页: [1]
查看完整版本: VB。net/edit插入动态