Lisp lệnh IMPPNT trong chủ đề “Lisp thay đổi độ cao node của PL-DONE”
Chào Tuynh
Mạn phép bác Hoành cho phép Tue_NV chỉnh lại Code của bác để giúp cho bạn Tuynh
@Tuynh : Chạy Lisp sau -> Chọn File txt của bạn -> sẽ được kết quả
Có gì chưa được hãy post lên đây. Tue_NV sẽ chỉnh lại giúp bạn
- Tải lisp
- 72239_imppnt.lsp
Cách dùng
- Tải tệp 72239_imppnt.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 IMPPNT để chạy lisp.
Mã nguồn 72239_imppnt.lsp
;; free lisp from cadviet.com
;;; this lisp was downloaded from https://www.cadviet.com/forum/topic/47417-lisp-thay-%C4%91%E1%BB%95i-%C4%91%E1%BB%99-cao-node-c%E1%BB%A7a-pl-done/?tab=comments#comment-72236
(defun c:imppnt ( / fn fid strht vt n x y z lis cao)
(defun pos (sub st / l1 l2 index)
(setq index 1
l1 (strlen sub)
l2 (strlen st)
)
(while
(and ( (setq index (1+ index))
)
(if (= sub (substr st index l1))
index
nil
)
)
(princ "\neiPoint © 2007 Cadviet.com")
(setq fn (getfiled "Ten tep de nhap toa do x y z"
(getvar "dwgprefix")
"txt"
2
)
fid (open fn "r")
lis nil
)
(while (setq strht (read-line fid))
(setq strht (strcat strht "\t\t\t"))
(if (/= strht " ")
(progn
(setq
vt (pos "\t" strht)
n (atof (substr strht 1 (1- vt)))
strht (substr strht (1+ vt))
vt (pos "\t" strht)
x (atof (substr strht 1 (1- vt)))
strht (substr strht (1+ vt))
vt (pos "\t" strht)
y (atof (substr strht 1 (1- vt)))
strht (substr strht (1+ vt))
vt (pos "\t" strht)
z (atof (substr strht 1 (1- vt)))
)
(setq lis (append lis (list(list n x y z))))
)
)
)
(close fid)
(Command "3dpoly")
(foreach x lis (command (cdr x)))
(command "")
(setq cao (getdist "\n Chon chieu cao chu :"))
(foreach x lis (wtxt (rtos (car x) 2 0) (cdr x) 0 cao))
)
;
(defun wtxt (txt p ang h / sty)
(setq sty (getvar "textstyle"))
(entmake (list (cons 0 "TEXT") (cons 7 sty)
(cons 1 txt) (cons 10 p) (cons 11 p)
(cons 72 2) (cons 73 2) (cons 50 ang)
(cons 40 h) (cons 41 0.8))
)
)
Thảo luận gốc
Lisp được chia sẻ trong chủ đề Lisp thay đổi độ cao node của PL-DONE. Xem đúng bài viết #72239 để đọc hướng dẫn và trao đổi thêm.