明经CAD社区

 找回密码
 注册

QQ登录

只需一步,快速开始

搜索
查看: 1812|回复: 2

如何用setxdata直接存储数据

[复制链接]
发表于 2006-8-17 20:02:00 | 显示全部楼层 |阅读模式

 Dim a(0 To 2) As Integer
    Dim b(0 To 2) As Variant
   
    a(0) = 1011: b(0) = 500
    a(1) = 1012: b(1) = 2000
    a(2) = 1013: b(2) = "hjbjkl"

    Set pDict = ThisDrawing.Dictionaries.Add("ww")
    pDict.SetXData a, b

总说我出错,暮非只能再用addxrecord来存储,????

发表于 2006-8-18 01:00:00 | 显示全部楼层

Public Function SetXRecord(ByVal DictName As String, ByVal Keyword As String, ByVal XRecordData)
    Dim pDict As AcadDictionary
    Dim pXRecord As AcadXRecord
    Dim XRecordType() As Integer
    Dim pLen As Integer
   
    Set pDict = ThisDrawing.Dictionaries.Add(DictName)
    Set pXRecord = pDict.AddXRecord(Keyword)
   
    pLen = UBound(XRecordData)
    ReDim XRecordType(pLen) As Integer
    For i = 0 To pLen
        Select Case VarType(XRecordData(i))
            Case vbInteger, vbLong
                XRecordType(i) = 70
            Case vbSingle, vbDouble
                XRecordType(i) = 40
            Case vbString
                XRecordType(i) = 1
        End Select
    Next i
   
    pXRecord.SetXRecordData XRecordType, XRecordData

End Function

 楼主| 发表于 2006-8-18 13:14:00 | 显示全部楼层

原来setxdata只能用cad中固定的组码

3ku

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

本版积分规则

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

GMT+8, 2024-11-27 00:49 , Processed in 0.155428 second(s), 23 queries , Gzip On.

Powered by Discuz! X3.4

Copyright © 2001-2021, Tencent Cloud.

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