Lisp lệnh RDPL trong chủ đề “nhờ viết lisp đánh số thứ tự đỉnh Pline và đo kích thước tự động”
Lệnh là RDPL
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
(defun pline>listdinh (curve / listd)
(if (wcmatch (cdr(assoc 0 (entget curve))) "*POLYLINE")
(foreach x (entget curve) (if (= (car x) 10) (setq listd (append listd (list(cdr x))))))
)
listd)
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
(defun c:rdpl ()
(setq ddd (car (entsel "\nChon Pline:")))
(setq tapdinh (pline>listdinh ddd))
(setq tendinh 0)
(foreach tddinh tapdinh
(setq tendinh (+ 1 tendinh))
(setq tendinhnoi (strcat "D" (rtos tendinh 2 0)))
(entmake (list (cons 0 "TEXT")(cons 10 tddinh)(cons 11 tddinh)(cons 40 1)(cons 50 0)(cons 72 0)(cons 1 tendinhnoi)(cons 7 (getvar "TEXTSTYLE"))(cons 8 "layerkhac_text")(cons 62 256)))
(cond
((/= tendinh 1) (command ".DIMALIGNED" "_non" dinhcu "_non" tddinh "_non" tddinh))
)
(setq dinhcu tddinh)
)
)
- Tải lisp
- 439371_rdpl.lsp
Cách dùng
- Tải tệp 439371_rdpl.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 RDPL để chạy lisp.
Mã nguồn 439371_rdpl.lsp
;; free lisp from cadviet.com
;;; this lisp was downloaded from https://www.cadviet.com/forum/topic/177294-nh%E1%BB%9D-vi%E1%BA%BFt-lisp-%C4%91%C3%A1nh-s%E1%BB%91-th%E1%BB%A9-t%E1%BB%B1-%C4%91%E1%BB%89nh-pline-v%C3%A0-%C4%91o-k%C3%ADch-th%C6%B0%E1%BB%9Bc-t%E1%BB%B1-%C4%91%E1%BB%99ng/
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
(defun pline>listdinh (curve / listd)
(if (wcmatch (cdr(assoc 0 (entget curve))) "*POLYLINE")
(foreach x (entget curve) (if (= (car x) 10) (setq listd (append listd (list(cdr x))))))
)
listd)
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
(defun c:rdpl ()
(setq ddd (car (entsel "\nChon Pline:")))
(setq tapdinh (pline>listdinh ddd))
(setq tendinh 0)
(foreach tddinh tapdinh
(setq tendinh (+ 1 tendinh))
(setq tendinhnoi (strcat "D" (rtos tendinh 2 0)))
(entmake (list (cons 0 "TEXT")(cons 10 tddinh)(cons 11 tddinh)(cons 40 1)(cons 50 0)(cons 72 0)(cons 1 tendinhnoi)(cons 7 (getvar "TEXTSTYLE"))(cons 8 "layerkhac_text")(cons 62 256)))
(cond
((/= tendinh 1) (command ".DIMALIGNED" "_non" dinhcu "_non" tddinh "_non" tddinh))
)
(setq dinhcu tddinh)
)
)Thảo luận gốc
Lisp được chia sẻ trong chủ đề nhờ viết lisp đánh số thứ tự đỉnh Pline và đo kích thước tự động. Xem đúng bài viết #439371 để đọc hướng dẫn và trao đổi thêm.