Lisp lệnh CLTF trong chủ đề “Nhập các File *.lsp thành một file *.fas”
Trước hết bạn phải tải các file doslib...arx vào thư mục support hoạc bất kỳ thư mục nào mà bạn đã add trong "support file search path. Tải các file doslib tại đây: http://www.en.na.mcneel.com/doslib.htm
Đây là lisp Thiep thêm arxload:
(cond ((eq (getvar "acadver") "19.0s (LMS Tech)")
(arxload "doslib19")
)
((or (eq (getvar "acadver") "18.2s (LMS Tech)")
(eq (getvar "acadver") "18.1s (LMS Tech)")
(eq (getvar "acadver") "18.0s (LMS Tech)")
)
(arxload "doslib18")
)
((or (eq (getvar "acadver") "17.2s (LMS Tech)")
(eq (getvar "acadver") "17.1s (LMS Tech)")
(eq (getvar "acadver") "17.0s (LMS Tech)")
)
(arxload "doslib17")
)
)
(defun c:cltf (/ lsp fas lst)
(setq
lsp (dos_getdir "Browse for folder" " " "Select a folder as source" t)
)
(setq fas (dos_getdir "Browse for folder"
" "
"Select a folder as destination"
t
)
)
(setq lst (vl-directory-files lsp "*.lsp" 1))
(if lst
(progn
(foreach x lst
(vlisp-compile 'st
(strcat lsp x)
(strcat fas (substr x 1 (- (strlen x) 4)) ".fas")
)
) ; foreach
) ; progn
(alert "There is not contained file")
) ; if
(princ)
)
Tuy nhiên, lisp trên chỉ compiler mỗi một file *.lsp thành 1 file *.fas. Chưa biết làm sao compiler nhiều file thành 1 file được. (Nếu làm trong VLISP thì ok rồi)
- Tải lisp
- 386535_cltf.lsp
Cách dùng
- Tải tệp 386535_cltf.lsp về máy.
- Trong AutoCAD gõ lệnh APPLOAD, chọn tệp vừa tải rồi bấm Load. Cũng có thể kéo thả tệp .lsp vào cửa sổ bản vẽ.
- Gõ lệnh CLTF để chạy lisp.
Mã nguồn 386535_cltf.lsp
;; free lisp from cadviet.com
;;; this lisp was downloaded from https://www.cadviet.com/forum/topic/6124-nh%E1%BA%ADp-c%C3%A1c-file-lsp-th%C3%A0nh-m%E1%BB%99t-file-fas/
(cond ((eq (getvar "acadver") "19.0s (LMS Tech)")
(arxload "doslib19")
)
((or (eq (getvar "acadver") "18.2s (LMS Tech)")
(eq (getvar "acadver") "18.1s (LMS Tech)")
(eq (getvar "acadver") "18.0s (LMS Tech)")
)
(arxload "doslib18")
)
((or (eq (getvar "acadver") "17.2s (LMS Tech)")
(eq (getvar "acadver") "17.1s (LMS Tech)")
(eq (getvar "acadver") "17.0s (LMS Tech)")
)
(arxload "doslib17")
)
)
(defun c:cltf (/ lsp fas lst)
(setq
lsp (dos_getdir "Browse for folder" " " "Select a folder as source" t)
)
(setq fas (dos_getdir "Browse for folder"
" "
"Select a folder as destination"
t
)
)
(setq lst (vl-directory-files lsp "*.lsp" 1))
(if lst
(progn
(foreach x lst
(vlisp-compile 'st
(strcat lsp x)
(strcat fas (substr x 1 (- (strlen x) 4)) ".fas")
)
) ; foreach
) ; progn
(alert "There is not contained file")
) ; if
(princ)
) Thảo luận gốc
Lisp được chia sẻ trong chủ đề Nhập các File *.lsp thành một file *.fas. Xem đúng bài viết #386535 để đọc hướng dẫn và trao đổi thêm.