Function getattributes(ByVal ThisDrawing As AcadDocument, ByVal dwgname As String, ByVal acadapp As AcadApplication) Dim insertionPnt(0 To 2) As Double Dim blockRefObj As AcadBlockReference insertionPnt(0) = 0.0# : insertionPnt(1) = 0.0# : insertionPnt(2) = 0.0# 'insertionPnt(0) = 2.0# : insertionPnt(1) = 2.0# : insertionPnt(2) = 0 blockRefObj = ThisDrawing.ModelSpace.InsertBlock(insertionPnt, dwgname, 1.0#, 1.0#, 1.0#, 0) '插入图形文件或当前图形中已定义的命名块。 ' Get the attributes for the block reference Dim varAttributes As Object varAttributes = blockRefObj.GetAttributes ' Move the attribute tags and values into a string to be displayed in a Msgbox Dim strAttributes As String Dim I As Integer For I = LBound(varAttributes) To UBound(varAttributes) strAttributes = strAttributes & " Tag: " & varAttributes(I).TagString & _ " Value: " & varAttributes(I).textString & " " ' MsgBox(varAttributes(I).textString) ' MsgBox(varAttributes(I).TagString()) Next MsgBox("The attributes for blockReference " & blockRefObj.Name & " are: " & strAttributes, , "GetAttributes Example") '文件的名字blockRefObj.Name End Function varAttributes(I).TagString 不知道为什么 取不到任何字符串! |