Ok a couple of suggestions
1st
(( is not needed
(setq SubscriberBlock (entsel))
2nd
);End Function
) ; this is end of defun missing )
Ok so trying a bit more walking slowly not running.
; https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/lisp-for-combining-multiple-block-attributes-into-a-main-block/td-p/11637019
; an attempt by AlanH Dec 2022
(defun c:wow (/)
; Sort functions By pbejse forums/autodesk
(defun _n (str / s)
(setq s (vl-string-right-trim "0123456789" str))
(list s (atoi (substr str (1+ (strlen s)))))
)
(Defun ThisSortFunc (l)
(Vl-sort l '(lambda (n m)
(setq n (_n (Car n)) m (_n (Car m)))
(cond
((< (Car n) (car m)))
((eq (Car n) (car m)) (< (Cadr n) (cadr m)))
)
)
)
)
(defun c:wow (/)
(princ "\n Pick 1 block object for block name ")
(setq ss (ssget "_+.:E:S" '((0 . "INSERT"))))
(if (= ss nil)
(alert "You may not have picked a block please try again")
(progn
(setq blk (vlax-ename->vla-object (ssname ss 0)))
(setq bname (vla-get-name blk))
(if (wcmatch bname "*U#*")
(setq bname (vla-get-effectivename blk))
)
(princ "\nSelect the blocks ")
(setq ss (ssget '((0 . "INSERT"))))
(if (= ss nil)
(alert "No blocks picked will exit")
(progn
(setq lst '())
(repeat (setq x (sslength ss))
(setq lst2 '())
(setq blk (vlax-ename->vla-object (ssname ss (setq x (- x 1)))))
(setq blkname (vla-get-name blk))
(if (wcmatch blkname "*U#*")
(setq blkname (vla-get-effectivename blk))
)
(if (= blkname bname)
(progn
(setq atts (vlax-invoke blk 'Getattributes))
(if (= atts nil)
(princ "No Atts")
(progn
(foreach att atts
(setq lst2 (cons (vla-get-textstring att) lst2))
)
(setq lst (cons lst2 lst))
)
)
)
)
)
(setq lst (ThisSortFunc lst))
)
)
)
)
(princ)
)
(c:wow)
So if you look at lst type !lst you can see we are getting somewhere.
(("368" "") ("369" "") ("370" "") ("371" "") ("372" "") ("403" ""))
Next task is to look for OD data and add to the list.