XRecords

The VBA forum deals with IntelliCAD 2000 VBA (Visual Basic for Applications) issues.

Moderator: CMS Inc

Post Reply
JPC
Newbie
Posts: 1
Joined: Thu Oct 05, 2006 11:01 pm

XRecords

Post by JPC » Sun Oct 08, 2006 9:52 am

Hi!
I'm developing IntelliCAD 6.2 PE+ and need to store data in a XRecord but i'm having a problem with it - i can create the Dictionary and the XRecord but can't get the values stored (if stored).
The code bellow works perfectly in AutoCAD (without changes) but not in IntelliCAD.


'*******************************************************************
'Sub to create XRecord and add values to it:
'*******************************************************************
Public Sub AdXRecord()
Dim Diccionario As Dictionary
Dim xr As XRecord
Dim dicc As String
Dim xrec As String
Dim n As Long

dicc = "d1"
xrec = "x1"

'Defining data types:
Dim XRTipos(0 To 1) As Integer: Dim XRDados(0 To 1) As Variant

'Creation of dicionary and XRecord:
Set Diccionario = IntelliCAD.ActiveDocument.Dictionaries.Add(dicc)
Set xr = Diccionario.AddXRecord(xrec)

'Verifying the name of XRecord created:
MsgBox xr.Name 'Name displays correctly!

'Defining some values:
XRTipos(0) = 300: XRDados(0) = "val1"
XRTipos(1) = 301: XRDados(1) = "val2"

'Adding the values to the XRecord:
xr.SetXRecordData XRTipos, XRDados

'Verifying values:
MsgBox XRDados(0) 'Message is empty...
MsgBox Vartype(XRDados(0)) 'Message is 0 (Empty)

End Sub

'*******************************************************************
'Sub to get values:
'*******************************************************************
Public Sub ExtXRecord()
Dim Diccionario As Dictionary
Dim xr As XRecord

'Getting the dicionary and the XRecord:
Set Diccionario = IntelliCAD.ActiveDocument.Dictionaries.Item("d1")
Set xr = Diccionario.GetObject("x1")

MsgBox xr.Name 'Name displays correctly!

'Defining data types and retrieving values:
Dim XRTipos As Variant, XRDados As Variant
xr.GetXRecordData XRTipos, XRDados

MsgBox XRDados(0) 'Message is empty...
MsgBox VarType(XRDados(1)) 'Message is 8 (String)

End Sub

Am i missing something? Can anyone point me in the right direction?
Thanks,
JPC
Post Reply