Author Topic: Improvements on getblockenames?  (Read 999 times)

0 Members and 1 Guest are viewing this topic.

gp7

  • Mosquito
  • Posts: 1
Improvements on getblockenames?
« on: November 16, 2020, 06:09:22 AM »
Hi All,

My first post to this board but I've been following it for a while. I've been looking for an improvement on a function that was previously posted here called "getblockenames." There were two versions. One in Vanilla Lisp and the other that sorted the list of blocks but contained some Visual Lisp.

I've reprinted it below:

(defun _getblockenames ( / d l n r )
    (while (setq d (tblnext "BLOCK" (null d)))
        (if (wcmatch (setq n (cdr (assoc 2 d))) "~`**")
            (setq r (cons (tblobjname "BLOCK" n) r)
                  l (cons n l)
            )
        )
    )
    (mapcar '(lambda ( n ) (nth n r)) (vl-sort-i l '<))
)

Is there an easy way of writing the last line in Vanilla Lisp? My system isn't configured for Visual Lisp...
The problem appears to be associated with the function vl-sort-i.


Tharwat

  • Swamp Rat
  • Posts: 710
  • Hypersensitive
Re: Improvements on getblockenames?
« Reply #1 on: November 16, 2020, 07:01:56 AM »
Hi,
Try to add the following function to load the vl library functions and the previous posted codes should work after all.
Code - Auto/Visual Lisp: [Select]

Otherwise you can replace the last of line of codes (mapcar '(lambda (x) ..... with the following function to sort the strings.

Code - Auto/Visual Lisp: [Select]
  1. (acad_strlsort l)
  2.