Lisp lệnh DD trong chủ đề “Xin lisp tính độ dốc giữa 2 điểm nằm trên một đường polyline”
Bạn thử cái này.
(defun c:dd(/ t1 t2 pl dai) (setq t1 (car (entsel "\nChon text cao do 1:")) t2 (car (entsel "\nChon text cao do 2:")) pl (car (entsel "\nChon polyline:")) dai (vlax-curve-getDistAtParam pl (vlax-curve-getEndParam pl))) (princ (strcat "\nDo doc : " (rtos(/ (- (atof (cdr (assoc 1 (entget t1)))) (atof (cdr (assoc 1 (entget t2))))) dai)))) (princ) )
- Tải lisp
- 312484_dd.lsp
Cách dùng
- Tải tệp 312484_dd.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 DD để chạy lisp.
Mã nguồn 312484_dd.lsp
;; free lisp from cadviet.com
;;; this lisp was downloaded from https://www.cadviet.com/forum/topic/110534-xin-lisp-t%C3%ADnh-%C4%91%E1%BB%99-d%E1%BB%91c-gi%E1%BB%AFa-2-%C4%91i%E1%BB%83m-n%E1%BA%B1m-tr%C3%AAn-m%E1%BB%99t-%C4%91%C6%B0%E1%BB%9Dng-polyline/
(defun c:dd(/ t1 t2 pl dai)
(setq t1 (car (entsel "\nChon text cao do 1:"))
t2 (car (entsel "\nChon text cao do 2:"))
pl (car (entsel "\nChon polyline:"))
dai (vlax-curve-getDistAtParam pl (vlax-curve-getEndParam pl)))
(princ (strcat "\nDo doc : " (rtos(/ (- (atof (cdr (assoc 1 (entget t1))))
(atof (cdr (assoc 1 (entget t2))))) dai))))
(princ)
)Thảo luận gốc
Lisp được chia sẻ trong chủ đề Xin lisp tính độ dốc giữa 2 điểm nằm trên một đường polyline. Xem đúng bài viết #312484 để đọc hướng dẫn và trao đổi thêm.