help with dictionaries...

Devin

Usenet Archive
Joined
Sep 27, 2001
Messages
342
Reaction score
0
I just want to store values in a dictionary and then retrieve them later. Is there a simple way to do it? I'm kinda lost with the object classes.
Any help would be great.

Thanks,

Devin
 
Active X please. I think maybe I need to use xrecords but I'm new to using active x and xrecords. Any help would be greatly appreciated.

Devin
 
Maybe this will help get you started.

(setq *acad* (vlax-get-acad-object))
(setq *doc* (vla-get-activedocument *acad*))

; add a dictionary
(setq dict (vla-add (vla-get-dictionaries *doc*) "MyNewDictionary"))

; add an xrecord
(setq xrec (vla-addxrecord dict "MyNewXrecord"))

; add data to the xrecord
(vla-setxrecorddata
xrec
(vlax-safearray-fill
(vlax-make-safearray
vlax-vbinteger
(cons 0 (1- (length '(1 2 3))))
)
'(1 2 3)
)

(vlax-safearray-fill
(vlax-make-safearray
vlax-vbvariant
(cons 0 (1- (length '("a" "b" "c"))))
)
'("a" "b" "c")
)
)

; get data from the xrecord
(vla-getxrecorddata xrec 'types 'values)
(if (and types values)
(mapcar
'cons
(vlax-safearray->list types)
(mapcar 'vlax-variant-value (vlax-safearray->list values)) )
)
 
Jason,

I think I understand, and please correct me if I'm wrong. The first array in the (vla-setXdata type data) is the dxf codes and the second array is the values assigned to those dxf codes?
 
Yes. Depending on the type of values, you need to
use specific dxf codes. In the developer help file
search for "Group Codes - ranges of"
 
Thanks Jason! As always you're a big help.

Devin
 

Latest threads

Back
Top