본문 바로가기
autocad

문자 연결하기

by kmlab 2024. 12. 18.

https://www.cadtutor.net/forum/topic/74514-text-concatenate-lisp-editing/

 

Text concatenate LISP editing

Hello, I use a LIPS found here (https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/text-concatenate/m-p/5819272/highlight/true#M335121) to merge / concatenate texts from a plan, then l copy paste this in Excel to make tables with data (coordin

www.cadtutor.net

(defun c:conc (/ a ans b c d e f g h j)
   (graphscr)
   (command ".redraw") (command)
(initget "Yes No")
(if (= "Yes" (getkword "\nRetain Append Text? [Y/N] <N>: "))
(setq j 0); Yes
(setq j 1); No
)
   (prompt "\nSelect Text to Remain->")
   (setq a (entsel))
   (while (setq b (entsel "\nSelect Text to Append -> "))
     (setq c (entget (car a))
           d (entget (car b))
           e (cdr (assoc 1 c))    ;get 1st text string
           f (cdr (assoc 1 d))    ;get 2nd text string
           g (strcat e "," f)
   h (subst (cons 1 g) (assoc 1 c) c)
     )
     (entmod h)                    ;update 1st string
     
(if (eq j 1)
     (entdel (car b))
  )
     (princ)
   )
)

반응형