如何用setxdata直接存储数据
<P> Dim a(0 To 2) As Integer<BR> Dim b(0 To 2) As Variant<BR> <BR> a(0) = 1011: b(0) = 500<BR> a(1) = 1012: b(1) = 2000<BR> a(2) = 1013: b(2) = "hjbjkl"</P><P> Set pDict = ThisDrawing.Dictionaries.Add("ww")<BR> pDict.SetXData a, b</P>
<P>总说我出错,暮非只能再用addxrecord来存储,????</P> <P>Public Function SetXRecord(ByVal DictName As String, ByVal Keyword As String, ByVal XRecordData)<BR> Dim pDict As AcadDictionary<BR> Dim pXRecord As AcadXRecord<BR> Dim XRecordType() As Integer<BR> Dim pLen As Integer<BR> <BR> Set pDict = ThisDrawing.Dictionaries.Add(DictName)<BR> Set pXRecord = pDict.AddXRecord(Keyword)<BR> <BR> pLen = UBound(XRecordData)<BR> ReDim XRecordType(pLen) As Integer<BR> For i = 0 To pLen<BR> Select Case VarType(XRecordData(i))<BR> Case vbInteger, vbLong<BR> XRecordType(i) = 70<BR> Case vbSingle, vbDouble<BR> XRecordType(i) = 40<BR> Case vbString<BR> XRecordType(i) = 1<BR> End Select<BR> Next i<BR> <BR> pXRecord.SetXRecordData XRecordType, XRecordData</P>
<P>End Function</P> <P>原来setxdata只能用cad中固定的组码</P>
<P>3ku</P>
页:
[1]