;;ºÏ²¢ÎÄ×Ö£¨ÖÇÄÜ£©
(defun c:join_text (/	  *error*     a	    box	  data	en    enlst
		    entxt h	lst   ltpt  nda	  obj	pt    ss
		    txt
		   )
  (setq *error* strcat)
  (setq ss (ssget '((0 . "*text"))))
  (setq enlst (fsxm-ss->enlist ss))
  (setq h (/ (fsxm-getendxf (car enlst) 40) 2))
  (setq	lst (mapcar '(lambda (a / box ltpt obj)
		       (setq obj (vlax-ename->vla-object a))
		       (setq box (fsxm-obj-box obj))
		       (setq ltpt (list (caar box) (cadadr box)))
		       (list ltpt a)
		     )
		    enlst
	    )
  )
  ;;sort X
  (setq lst (vl-sort lst '(lambda (a b) (< (caar a) (caar b)))))
  ;;sort Y
  (setq lst (vl-sort lst '(lambda (a b) (> (- (cadar a) (cadar b)) h))))
  (setq a (car lst))
  (setq pt (car a))
  (setq data (entget (cadr a)))
  (setq	nda
	 (vl-remove-if
	   '(lambda (a)
	      (member (car a) '(-1 0 330 5 100 10 1 41 51 71 72 11 73))
	    )
	   data
	 )
  )
  (setq txt (fsxm-getdxf 1 data))
  (foreach b (cdr lst)
    (setq en (cadr b))
    (setq entxt (fsxm-getendxf en 1))
    (if	(> (- (cadar a) (cadar b)) h)
      (setq txt (strcat txt "\\P" entxt))
      (setq txt (strcat txt entxt))
    )
    (setq a b)
  )
  (entmake
    (vl-list* '(0 . "MTEXT")
	      '(100 . "AcDbEntity")
	      '(100 . "AcDbMText")
	      '(41 . 0)
	      '(71 . 1)
	      '(72 . 5)
	      (cons 1 txt)
	      (cons 10 pt)
	      nda
    )
  )
  (foreach a enlst (entdel a))
  (princ)
)