明经CAD社区

 找回密码
 注册

QQ登录

只需一步,快速开始

搜索
查看: 1185|回复: 2

为何取不到字符串

[复制链接]
发表于 2008-5-13 18:24:00 | 显示全部楼层 |阅读模式

 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   不知道为什么  取不到任何字符串!

发表于 2008-5-13 23:32:00 | 显示全部楼层
函数应该有返回值
 楼主| 发表于 2008-5-14 07:36:00 | 显示全部楼层

不是 MsgBox("The attributes for blockReference " & blockRefObj.Name & " are: " & strAttributes, , "GetAttributes Example")
无法显示出来

您需要登录后才可以回帖 登录 | 注册

本版积分规则

小黑屋|手机版|CAD论坛|CAD教程|CAD下载|联系我们|关于明经|明经通道 ( 粤ICP备05003914号 )  
©2000-2023 明经通道 版权所有 本站代码,在未取得本站及作者授权的情况下,不得用于商业用途

GMT+8, 2024-11-26 09:48 , Processed in 0.158913 second(s), 24 queries , Gzip On.

Powered by Discuz! X3.4

Copyright © 2001-2021, Tencent Cloud.

快速回复 返回顶部 返回列表