Lisp lệnh VG trong chủ đề “Vẽ vuông góc với 1 Pline bất kì”
pfievxd thử lisp này :
- Tải lisp
- 129036_vg.lsp
Cách dùng
- Tải tệp 129036_vg.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 VG để chạy lisp.
Mã nguồn 129036_vg.lsp
;; free lisp from cadviet.com
;;; this lisp was downloaded from https://www.cadviet.com/forum/topic/31600-v%E1%BA%BD-vu%C3%B4ng-g%C3%B3c-v%E1%BB%9Bi-1-pline-b%E1%BA%A5t-k%C3%AC/
(defun c:Vg (/ curve pt ang vs)
(if (and
(setq curve (car (entsel "\nChon Curve : ")))
(setq pt (getpoint "\n Chon diem tren Curve : ")))
(progn
(setq VS (* 0.1 (getvar "Viewsize")))
(setq pt (vlax-curve-getClosestPointTo curve (trans pt 1 0))
ang (angle '(0 0) (Vlax-curve-getfirstderiv curve (vlax-curve-getParamAtPoint curve pt))) )
(entmake (list '(0 . "LINE")(cons 10 pt)(cons 11 (polar pt (+ ang (/ pi 2) ) vs))(cons 62 3) ))
(entmake (list '(0 . "LINE")(cons 10 pt)(cons 11 (polar pt (- ang (/ pi 2) ) vs))(cons 62 4) ))
))
(princ) )Thảo luận gốc
Lisp được chia sẻ trong chủ đề Vẽ vuông góc với 1 Pline bất kì. Xem đúng bài viết #129036 để đọc hướng dẫn và trao đổi thêm.