;组成字符串数组,换行符分割并复制至剪切板
(defun c:scc()
    (setq str "")
    (setq i 1)
    (while (= i 1)
        (setq str (strc str))
        (setq str (strcat str "\n"))
        (setq i (getint "请输入命令:0 结束、1 继续\n"))
    )
    (ZML-CLIP-SETSTRING str)
)

;连接选中字符串
(defun strc(str)
    (setq s
        (ssget (list (cons 0  "text"))) ;text为单行文本,mtext为多行文本
    )
    (if (= s nil)
        (setq str str)
        (progn
            (setq sl
                (sslength s)
            )
            (setq st 0)
            (while (< st sl)
                (setq e(ssname s st))
                (setq st(1+ st))
                (setq txt
                    (cdr (assoc 1 (entget e)))
                )
                (setq str (strcat str txt))    
            )
        )
    )
)

;;;功能:向系统剪贴板写入文字       
;;;使用前调用vl-load-com                                  *
(defun ZML-CLIP-SETSTRING (STR / HTML RESULT)
    (and (= (type STR) 'STR)
        (setq HTML (vlax-create-object "htmlfile"))
        (setq RESULT (vlax-invoke
            (vlax-get (vlax-get HTML 'PARENTWINDOW)
                'CLIPBOARDDATA
            )
            'SETDATA
            "Text"
            STR
            )
        )
        (vlax-release-object HTML)
    )
)