Lisp lệnh KEODAI trong chủ đề “Hỏi cách kéo dài đoạn thẳng từ cả 2 phía?”
Đã có
https://www.cadviet.com/forum/topic/13203-viet-lisp-theo-yeu-cau-phan-2/page-154#entry128473
;; free lisp from cadviet.com ;;; this lisp was downloaded from https://www.cadviet.com/forum/topic/13203-viet-lisp-theo-yeu-cau-phan-2/page-154#entry128473 ;free lisp from cadviet.com @ ketxu (defun c:keodai (/ ss kc) (vl-load-com) (setq ss (ssget "_:L" '((0 . "LINE,LWPOLYLINE,ARC"))) kc (getdist "\nChieu dai phan dua ra: ")) (foreach ent (vl-remove-if 'listp (mapcar 'cadr (ssnamex ss))) (command "_.lengthen" "_delta" kc (list ent (vlax-curve-getendpoint ent)) (list ent (vlax-curve-getstartpoint ent)) "" ) ;kthuc command ) ; kthuc vong lap (princ))
- Tải lisp
- 284065_keodai.lsp
Cách dùng
- Tải tệp 284065_keodai.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 KEODAI để chạy lisp.
Mã nguồn 284065_keodai.lsp
;; free lisp from cadviet.com
;;; this lisp was downloaded from https://www.cadviet.com/forum/topic/97148-h%E1%BB%8Fi-c%C3%A1ch-k%C3%A9o-d%C3%A0i-%C4%91o%E1%BA%A1n-th%E1%BA%B3ng-t%E1%BB%AB-c%E1%BA%A3-2-ph%C3%ADa/
;; free lisp from cadviet.com
;;; this lisp was downloaded from https://www.cadviet.com/forum/topic/13203-viet-lisp-theo-yeu-cau-phan-2/page-154#entry128473
;free lisp from cadviet.com @ ketxu
(defun c:keodai (/ ss kc) (vl-load-com)
(setq ss (ssget "_:L" '((0 . "LINE,LWPOLYLINE,ARC")))
kc (getdist "\nChieu dai phan dua ra: "))
(foreach ent
(vl-remove-if 'listp (mapcar 'cadr (ssnamex ss)))
(command "_.lengthen" "_delta" kc
(list ent (vlax-curve-getendpoint ent))
(list ent (vlax-curve-getstartpoint ent)) ""
) ;kthuc command
) ; kthuc vong lap
(princ))Thảo luận gốc
Lisp được chia sẻ trong chủ đề Hỏi cách kéo dài đoạn thẳng từ cả 2 phía?. Xem đúng bài viết #284065 để đọc hướng dẫn và trao đổi thêm.