Message 1 of 3
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
Hi all,
I have a lisp routine that retrieves a list of all the layers in the active drawing using the following code, stolen entirely from Afralisp (https://www.afralisp.net/visual-lisp/tutorials/visual-lisp-and-layers.php😞
(setq acadobject (vlax-get-Acad-Object))
(setq activedocument (vla-get-activedocument acadobject))
(setq LayerTable (vla-get-layers activedocument))
(vlax-for each LayerTable
(setq LayerList (cons (vla-get-Name each) LayerList))
);end vlax-for
The trouble is that the resulting list in a seeming random order. The list is going to be used to populate a DCL popup_list, so I'd like the list to be in alphabetical order.
I tried the following, but as you see, I get an error:
_$ (vl-sort LayerList (function (lambda (s1 s2) (< (vl-symbol-name s1) (vl-symbol-name s2)))))
; error: bad argument type: symbolp "GE-TEXT-LABL"
I feel like there has to be an easy way to do this... or is it more complicated than I realize?? Any help would be greatly appreciated!
Solved! Go to Solution.