Nice idea Mike
You asked for suggestions, so here are two of mine:
** You can iterate through VLA Dictionaries using vlax-for, so the conditions for Tables/Dictionaries and Collections could be merged into one vlax-for loop, with a check for the existence of the name property.
** For Variants, I would be inclined to handle them in the following way:
In the condition, make a call to this sub (originally by Nesterovsky I think, not sure though):
(defun VariantValue ( value )
(cond
( (eq 'variant (type value))
(VariantValue (vlax-variant-value value))
)
( (eq 'safearray (type value))
(mapcar 'VariantValue (vlax-safearray->list value))
)
( value )
)
)
And recursively supply the return to the main function:
(ToList (VariantValue <variant>))
Example:
;; ToList by mkweaver
;;
;; Modified by Lee Mac
(defun ToList ( col / VariantValue rtlist )
(defun VariantValue ( value )
(cond
( (eq 'variant (type value))
(VariantValue (vlax-variant-value value))
)
( (eq 'safearray (type value))
(mapcar 'VariantValue (vlax-safearray->list value))
)
( value )
)
)
(cond
(
(listp col) col
)
(
(eq 'STR (type col)) (vl-string->list col)
)
(
(eq 'PICKSET (type col))
(vl-remove-if 'null
(vl-remove-if-not
(function (lambda ( e ) (= 'ENAME (type e)))) (apply 'append (ssnamex col))
)
)
)
(
(eq 'VARIANT (type col))
(ToList (VariantValue col))
)
(
(and (= 'VLA-OBJECT (type col)) (vlax-property-available-p col 'count))
(vlax-for item col
(setq rtlist (cons item rtlist))
)
(reverse rtlist)
)
(T
(if (= 'VLA-OBJECT (type col))
(strcat "Error | Unhandled collection type:" (vla-get-objectname col))
(strcat "Error | Unhandled col argument:" (vl-prin1-to-string (type col)) ":" (vl-prin1-to-string col))
)
)
)
)
[ Sincere apologies for messing with your code - I'll remove the above if you want ]
Lee