Share
 
 

To create a variant containing an array of values (AutoLISP/ActiveX)

Safearrays are used in combination with ActiveX objects to represent points and matrixes.

Note: ActiveX support in AutoLISP is limited to Windows only.
  1. At the AutoCAD Command prompt, allocate the space for an array using vlax-make-safearray and save the results to a variable with setq.
  2. At the prompt, assign the values to the array using vlax-safearray-fill.
  3. At the prompt, create a variant using vlax-make-variant and assign it the array.

Example

  • At the AutoCAD Command prompt, enter the following
    (setq 4dubs (vlax-make-safearray vlax-vbDouble '(0 . 3)))
    (vlax-safearray-fill 4dubs '(3.0 6.0 7.2 1.0))
    (setq var4dubs (vlax-make-variant 4dubs))

Was this information helpful?