Adds an element to an array
Supported Platforms: Windows only
(vlax-safearray-put-element var index ... value)
Type: Safearray
A variable containing a safearray.
Type: Integer
A set of index values pointing to the element you are assigning a value to. For a single-dimension array, specify one index value; for a two-dimension array, specify two index values, and so on.
Type: Integer, Real, String, VLA-object, Safearray, Variant, T, or nil
The value to assign the safearray element.
Type: Integer, Real, String, VLA-object, Safearray, Variant, T, or nil
The value assigned to the element.
Create a single-dimension array consisting of doubles:
(setq point (vlax-make-safearray vlax-vbDouble '(0 . 2))) #<safearray...>
Use vlax-safearray-put-element to populate the array:
(vlax-safearray-put-element point 0 100) 100 (vlax-safearray-put-element point 1 100) 100 (vlax-safearray-put-element point 2 0) 0
Create a two-dimension array consisting of strings:
(setq matrix (vlax-make-safearray vlax-vbString '(1 . 2) '(1 . 2) )) #<safearray...>
Use vlax-safearray-put-element to populate the array:
(vlax-safearray-put-element matrix 1 1 "a") "a" (vlax-safearray-put-element matrix 1 2 "b") "b" (vlax-safearray-put-element matrix 2 1 "c") "c" (vlax-safearray-put-element matrix 2 2 "d") "d"
Note that you can also populate arrays using the vlax-safearray-fill function. The following function call accomplishes the same task as three vlax-safearray-put-element calls:
(vlax-safearray-fill matrix '(("a" "b") ("c" "d"))) #<safearray...>