lisp chèn block phong thủy
nhoc xin mạn phép pst bài ở đây lun hen ^^, anh Ket xem có phải vậy ko anh
;; free lisp from cadviet.com
;;; this lisp was downloaded from https://www.cadviet.com/forum/index.php?showtopic=68603&pid=224799&st=0&#entry224799
;ns : nam sinh, string hoac so (~Int)
;gt : gioi tinh, string hoac so (~Int)
;(batquai 1987 1), (batquai "1987" "2") => tra ve ten Block
(defun c:pht (/ ns gt)
(setq ns (getint "\nNhap nam sinh of you:"))
(setq gt (getint "\nChon gioi tinh 1 la boy 2 la girl:"))
(princ "\n")
(princ "quai so cua ban la: ")
(princ (batquai ns gt))
(princ)
)
(defun batquai(ns gt / tst)
(defun tst(str / kq)(vl-load-com)
(while (> (setq kq (apply '+ (mapcar '(lambda(x)(atoi (chr x))) (vl-string->list str)))) 9)
(setq str (itoa kq))
) kq
)
(itoa (tst (itoa (abs (+ (tst (vl-princ-to-string ns)) (if (= (vl-princ-to-string gt) "1") -11 4))))))
)
;; free lisp from cadviet.com
;;; this lisp was downloaded from https://www.cadviet.com/forum/index.php?showtopic=68603&pid=224799&st=0&#entry224799
;ns : nam sinh, string hoac so (~Int)
;gt : gioi tinh, string hoac so (~Int)
;(batquai 1987 1), (batquai "1987" "2") => tra ve ten Block
(defun c:pht (/ ns gt)
(setq ns (getint "\nNhap nam sinh of you:"))
(setq gt (getint "\nChon gioi tinh 1 la boy 2 la girl:"))
(princ "\n")
(princ "quai so cua ban la: ")
(princ (batquai ns gt))
(princ)
)
(defun batquai(ns gt / tst)
(defun tst(str / kq)(vl-load-com)
(while (> (setq kq (apply '+ (mapcar '(lambda(x)(atoi (chr x))) (vl-string->list str)))) 9)
(setq str (itoa kq))
) kq
)
(itoa (tst (itoa (abs (+ (tst (vl-princ-to-string ns)) (if (= (vl-princ-to-string gt) "1") -11 4))))))
)
Tệp .lsp gốc không còn trên máy chủ. Hãy chép mã nguồn bên dưới (lấy từ bài viết gốc) vào một tệp văn bản, lưu với đuôi .lsp.
Cách dùng
- Chép mã nguồn, lưu thành tệp 224807_pht.lsp.
- 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 PHT để chạy lisp.
Mã nguồn 224807_pht.lsp (trích từ bài viết gốc)
;; free lisp from cadviet.com
;;; this lisp was downloaded from https://www.cadviet.com/forum/index.php?showtopic=68603&pid=224799&st=0entry224799
;ns : nam sinh, string hoac so (~Int)
;gt : gioi tinh, string hoac so (~Int)
;(batquai 1987 1), (batquai "1987" "2") => tra ve ten Block
(defun c:pht (/ ns gt)
(setq ns (getint "\nNhap nam sinh of you:"))
(setq gt (getint "\nChon gioi tinh 1 la boy 2 la girl:"))
(princ "\n")
(princ "quai so cua ban la: ")
(princ (batquai ns gt))
(princ)
)
(defun batquai(ns gt / tst)
(defun tst(str / kq)(vl-load-com)
(while (> (setq kq (apply '+ (mapcar '(lambda(x)(atoi (chr x))) (vl-string->list str)))) 9)
(setq str (itoa kq))
) kq
)
(itoa (tst (itoa (abs (+ (tst (vl-princ-to-string ns)) (if (= (vl-princ-to-string gt) "1") -11 4))))))
)Thảo luận gốc
Lisp được chia sẻ trong chủ đề [yêu cầu] lisp chèn block phong thủy. Xem đúng bài viết #224807 để đọc hướng dẫn và trao đổi thêm.