本帖最后由 x_s_s_1 于 2022-12-29 09:08 编辑
贴个自己常用的,没有老黄的直接,仅针对DCL,没考虑控制。
- ;;;=============================================
- ;;; 通用函数 文本转为LIST复制到剪贴板
- ;;;参数: file------文件
- ;;; name------表名
- ;;;返回值:nil
- (defun xty-sys-copyclipdcl (file name / rf str html t1)
- (setq rf (open file "r"))
- (setq str (strcat "(setq " name "'(\n"))
- (while (setq t1 (read-line rf))
- (setq
- str (strcat str "\"" (xty-str-substall "\\\"" "\"" t1) "\"\n")
- )
- )
- (setq str (strcat str ")\n)"))
- (setq HTML (vlax-create-object "htmlfile"))
- (vlax-invoke
- (vlax-get (vlax-get HTML 'PARENTWINDOW) 'CLIPBOARDDATA)
- 'SETDATA
- "Text"
- str
- )
- (vlax-release-object HTML)
- (close rf)
- )
- ;;;=============================================
- ;;; 通用函数 写字符串表到文件
- ;;;参数:filename----文件名
- ;;; strlst------需写入文件字符串表
- ;;;返回值:文件名
- (defun xty-sys-makeFbylst (filename strlst / f n)
- (setq f (open filename "w"))
- (foreach n strlst
- (if (eq (type n) 'STR)
- (write-line n f)
- (write-line (vl-princ-to-string n) f)
- )
- )
- (close f)
- filename
- )
- (xty-sys-copyclipdcl (getfiled "dcl" "" "dcl" 16) "dcllst")
- ;;;ctrl+v粘贴,得下表
- (setq dcllst
- '(
- "MyIdialog:dialog{label=\"离线端头插入块\";"
- " :boxed_row{label=\"块名\";"
- " :edit_box{key=\"key1\";}"
- " :button{key=\"key11\";label=\"&Pick<<\";}"
- " }"
- " :boxed_column{"
- " :text{key=\"key12\";value=\"示例:235*2 200*2,20+50\";}"
- " :edit_box{label=\"距离\";key=\"key2\";value=\"0\";}"
- " }"
- " :edit_box{label=\"X比例\";key=\"key3\";value=\"1\";}"
- " :edit_box{label=\"Y比例\";key=\"key4\";value=\"1\";}"
- " :edit_box{label=\"Z比例\";key=\"key5\";value=\"1\";}"
- " :boxed_row{label=\"旋转\";"
- " :toggle{key=\"key6\";label=\"在屏幕上指定\";value=\"1\";}"
- " :edit_box{key=\"key7\";label=\"角度\";value=\"0\";}"
- " }"
- " :toggle{label=\"镜向\";key=\"key8\";value=\"0\";}"
- " ok_cancel;"
- "}"
- )
- )
- (xty-sys-makeFbylst (vl-filename-mktemp nil nil ".dcl")dcllst)
|