Jason Piercey
Usenet Archive
- Joined
- Jun 30, 2003
- Messages
- 868
- Reaction score
- 0
Seems that the following works fine for strings, but not for anything else.
; creates an array
; [arrayType] - symbol, type of array. (vlax-vbinteger, vlax-vbstring, etc...) ; [dataTypes] - list, list of data ; return: safearray or nil ; example: (createArray vlax-vbinteger '(1 2 3)) (defun createArray (arrayType dataTypes / res) (if (setq res (vlax-safearray-fill (vlax-make-safearray arrayType (cons 0 (1- (length dataTypes))) ) dataTypes ) ) res )
)
; retrieves data from an xrecord object
; [xrecord] - vla-object, xrecord object
; return: list of dotted pairs or nil
; example:
; (setq dict (addDictionary *doc* "test"))
; (setq rec (addXrecord dict "test-xrecord"))
; (putXrecordData rec '(1 2 3) '("a" "b" "c"))
(defun getXrecordData (xrecord / types values)
(if
(vl-catch-all-error-p
(vl-catch-all-apply
(function
(lambda (vla-getxrecorddata xrecord 'types 'values))
)
)
)
nil
(mapcar
'cons
(vlax-safearray->list types)
(mapcar 'vlax-variant-value (vlax-safearray->list values)) ) )
)
(setq dict (vla-add (vla-get-dictionaries *doc*) "test")) #<VLA-OBJECT IAcadDictionary 02eb4b74>
(setq rec (vla-addxrecord dict "myrecord"))
#<VLA-OBJECT IAcadXRecord 02eb5f94>
(vla-setxrecorddata
rec
(createArray vlax-vbinteger '(1))
(createArray vlax-vbvariant '("a"))
)
nil
(getXrecordData rec)
((1 . "a"))
(setq rec1 (vla-addxrecord dict "myrecord1"))
#<VLA-OBJECT IAcadXRecord 02eb43b4>
(vla-setxrecorddata
rec1
(createArray vlax-vbinteger '(38))
(createArray vlax-vbvariant '(1.0))
)
; error: Automation Error. Description was not provided.
Anyone care to give me an education?
Thanks in advance
; creates an array
; [arrayType] - symbol, type of array. (vlax-vbinteger, vlax-vbstring, etc...) ; [dataTypes] - list, list of data ; return: safearray or nil ; example: (createArray vlax-vbinteger '(1 2 3)) (defun createArray (arrayType dataTypes / res) (if (setq res (vlax-safearray-fill (vlax-make-safearray arrayType (cons 0 (1- (length dataTypes))) ) dataTypes ) ) res )
)
; retrieves data from an xrecord object
; [xrecord] - vla-object, xrecord object
; return: list of dotted pairs or nil
; example:
; (setq dict (addDictionary *doc* "test"))
; (setq rec (addXrecord dict "test-xrecord"))
; (putXrecordData rec '(1 2 3) '("a" "b" "c"))
(defun getXrecordData (xrecord / types values)
(if
(vl-catch-all-error-p
(vl-catch-all-apply
(function
(lambda (vla-getxrecorddata xrecord 'types 'values))
)
)
)
nil
(mapcar
'cons
(vlax-safearray->list types)
(mapcar 'vlax-variant-value (vlax-safearray->list values)) ) )
)
(setq dict (vla-add (vla-get-dictionaries *doc*) "test")) #<VLA-OBJECT IAcadDictionary 02eb4b74>
(setq rec (vla-addxrecord dict "myrecord"))
#<VLA-OBJECT IAcadXRecord 02eb5f94>
(vla-setxrecorddata
rec
(createArray vlax-vbinteger '(1))
(createArray vlax-vbvariant '("a"))
)
nil
(getXrecordData rec)
((1 . "a"))
(setq rec1 (vla-addxrecord dict "myrecord1"))
#<VLA-OBJECT IAcadXRecord 02eb43b4>
(vla-setxrecorddata
rec1
(createArray vlax-vbinteger '(38))
(createArray vlax-vbvariant '(1.0))
)
; error: Automation Error. Description was not provided.
Anyone care to give me an education?
Thanks in advance