Lisp lệnh ZT trong chủ đề “Chỉnh sửa lisp cad tính diện tích về đơn vị m2”
(defun c:zt()
(defun ctext (diem gt / lst)
(setq lst
(list
(cons 0 "TEXT")
(cons 1 gt)
(cons 10 diem)
(cons 40 (getdist p "\Text heigh: "))
)
)
(entmake lst)
)
(defun dtdoituong (entdt /)
(command ".area" "o" entdt)
(command ".erase" entdt "")
(getvar "area")
)
(defun getbound(p)
(setq ent (entlast))
(command ".boundary" "A" "B" "E" "I" "Y" "" p "")
(setq ent1 (entlast))
(cond
((eq ent ent1) nil)
(t ent1)
)
)
(princ "\nCADViet.com (c) 2007")
(setq
p (getpoint "\Select area place by click a point: ")
entpl (getbound p)
)
(if entpl
(ctext p (rtos (dtdoituong entpl)))
(alert "Fail!")
)
(princ)
)
(princ "\ndtm - free lisp from www.cadviet.com")
(princ)
Em muốn nhờ mọi người chỉnh sửa kết quả giúp em xuống đơn vị 10^-6 và thêm chữ m2 vào sau kết quả với ạ. Em cảm ơn ạ.
- Tải lisp
- 433658_zt.lsp
Cách dùng
- Tải tệp 433658_zt.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 ZT để chạy lisp.
Mã nguồn 433658_zt.lsp
;; free lisp from cadviet.com
;;; this lisp was downloaded from https://www.cadviet.com/forum/topic/175350-ch%E1%BB%89nh-s%E1%BB%ADa-lisp-cad-t%C3%ADnh-di%E1%BB%87n-t%C3%ADch-v%E1%BB%81-%C4%91%C6%A1n-v%E1%BB%8B-m2/
(defun c:zt()
(defun ctext (diem gt / lst)
(setq lst
(list
(cons 0 "TEXT")
(cons 1 gt)
(cons 10 diem)
(cons 40 (getdist p "\Text heigh: "))
)
)
(entmake lst)
)
(defun dtdoituong (entdt /)
(command ".area" "o" entdt)
(command ".erase" entdt "")
(getvar "area")
)
(defun getbound(p)
(setq ent (entlast))
(command ".boundary" "A" "B" "E" "I" "Y" "" p "")
(setq ent1 (entlast))
(cond
((eq ent ent1) nil)
(t ent1)
)
)
(princ "\nCADViet.com (c) 2007")
(setq
p (getpoint "\Select area place by click a point: ")
entpl (getbound p)
)
(if entpl
(ctext p (rtos (dtdoituong entpl)))
(alert "Fail!")
)
(princ)
)
(princ "\ndtm - free lisp from www.cadviet.com")
(princ)Thảo luận gốc
Lisp được chia sẻ trong chủ đề Chỉnh sửa lisp cad tính diện tích về đơn vị m2. Xem đúng bài viết #433658 để đọc hướng dẫn và trao đổi thêm.