tiger0101 发表于 2006-8-17 20:02:00

如何用setxdata直接存储数据

<P>&nbsp;Dim a(0 To 2) As Integer<BR>&nbsp;&nbsp;&nbsp; Dim b(0 To 2) As Variant<BR>&nbsp;&nbsp;&nbsp; <BR>&nbsp;&nbsp;&nbsp; a(0) = 1011: b(0) = 500<BR>&nbsp;&nbsp;&nbsp; a(1) = 1012: b(1) = 2000<BR>&nbsp;&nbsp;&nbsp; a(2) = 1013: b(2) = "hjbjkl"</P>
<P>&nbsp;&nbsp;&nbsp; Set pDict = ThisDrawing.Dictionaries.Add("ww")<BR>&nbsp;&nbsp;&nbsp; pDict.SetXData a, b</P>
<P>总说我出错,暮非只能再用addxrecord来存储,????</P>

雪山飞狐_lzh 发表于 2006-8-18 01:00:00

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

tiger0101 发表于 2006-8-18 13:14:00

<P>原来setxdata只能用cad中固定的组码</P>
<P>3ku</P>
页: [1]
查看完整版本: 如何用setxdata直接存储数据