(defun c:mh (/ n ) (princ "\n最大的编号为:\n") (foreach n ("JL-" "WL-" "FL-" "NL-" "XL-" "ZL-") (mh_1 n)) ;此处可以 (princ))(defun mh_1 (wz_lx / ents ent txt c0 lx lx1 bh maxbh flag) (setq maxbh 1) (setq lx1 (strcat wz_lx "*"))
(princ "\n最大的编号为:\n")
(foreach n ("JL-" "WL-" "FL-" "NL-" "XL-" "ZL-") (mh_1 n)) ;此处可以
(princ)
)
(defun mh_1 (wz_lx / ents ent txt c0 lx lx1 bh maxbh flag)
(setq maxbh 1)
(setq lx1 (strcat wz_lx "*"))
(setq ents (ssget "x" (list (cons 0 "text") (cons 1 lx1))))
(if (/= ents nil)
(progn
(setq c0 0)
(repeat (sslength ents)
(setq ent (ssname ents c0))
(setq bh (sws_getval ent 1))
(setq bh (atoi (substr bh 4)))
(if (> bh maxbh) (setq maxbh bh))
(setq c0 (1+ c0))
)
(princ (strcat "* " wz_lx))(princ maxbh)(princ " ")
(setq c0 (1+ c0))
)
)
)
(defun sws_GetVal (wz_ent wz_id / wz_elst wz_val)
(setq wz_elst (entget wz_ent))
(setq wz_Val (cdr (assoc wz_id wz_elst)))
(princ)
wz_Val
)