- 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的属性集合进行编辑,但它不适用于动态块,因此我认为这项工作可以通过属性定义来完成,但也不起作用,感谢阅读。。。 |