vlax-safearray->list


(vlax-safearray->list saVar)

This function returns the data contained in saVar SafeArray as a Lisp list.

Arguments

saVar  (SafeArray) the SafeArray to query for its value

Return

list; for multi-dimensional SafeArray, it returns a list of sub-lists

Example

(setq sa (vlax-make-safearray vlax-vbDouble '(0 . 1) '(0 . 2)))  #<safearray...>
(vlax-safearray-fill sa '((1.0 2.0 3.0) (10.0 11.0 12.0)))  #<safearray...>
(vlax-safearray->list sa)  ((1.0 2.0 3.0) (10.0 11.0 12.0))

Remarks

(vlax-safearray->list) triggers an error for an empty SafeArray; though an empty SafeArray is absolutely valid, BricsCAD Lisp must match AutoLIISP's strange and buggy behaviour here ...

3 workarounds :

1. use (vl-catch-all-apply) to catch potential errors :
(setq res (vl-catch-all-apply 'vlax-safearray->list (list sa)))

(if (vl-catch-all-error-p res) (setq res NIL))

2. use (vle-safearray->list) instead - this functions returns NIL for an empty SafeArray (as expected); emulation for AutoCAD is provided via "vle-extensions.lsp" file

3. use the new BricsCAD-specific function : (_vlax-safearray-mode T/NIL)
T allows empty SafeArray with (vlax-safearray->list), returning NIL
NIL ensures AutoLISP compatible behaviour, triggering an error with an empty SafeArray



©  Bricsys NV. All rights reserved.