本帖最后由 vectra 于 2016-10-18 10:54 编辑
 - (defun c:hb (/ delim dxf ename height lst n ss str)
- (if (and
- (setq ss (ssget '((0 . "*TEXT"))))
- ;; (setq p (getpoint "指定合并后文字位置:"))
- )
- (progn
- (setvar "cmdecho" 0)
- (command "undo" "be")
- (setq delim ""
- height (cdr (assoc 40 (entget (ssname ss 0))))
- )
- (repeat (setq n (sslength ss))
- (setq ename (ssname ss (setq n (1- n)))
- dxf (entget ename)
- lst (cons (list (cdr (assoc 10 dxf))
- (cdr (assoc 1 dxf))
- (cdr (assoc 62 dxf))
- )
- lst
- )
- )
- (entdel ename)
- )
- (setq
- lst
- (vl-sort lst
- (function
- (lambda (e1 e2)
- (< (car (car e1)) (car (car e2)))
- )
- )
- )
- )
- (setq str "{")
- (foreach e lst
- (if (null (nth 2 e))
- (setq str (strcat str (cadr e) delim))
- (setq str (strcat str "\\C" (itoa (nth 2 e)) ";" (cadr e) delim))
- )
- )
- (setq str (strcat str "}"))
- (entmake (list '(0 . "MTEXT")
- '(100 . "AcDbEntity")
- '(100 . "AcDbMText")
- (cons 71 7)
- (cons 40 height)
- (cons 10 (caar lst))
- (cons 1 str)
- )
- )
- (command "undo" "e")
- )
- (princ)
- )
- )
|