LISP CẮT DIM ĐO ĐOẠN CUNG TRÒN
Bạn dùng thử xem co được không. Lệnh là SD2
(vl-load-com)
(defun c:sd2 (/ lstd en hd objTStyle objDoc tstyle m)
(setvar "cmdecho" 0)
(princ "\nChon cac DIM can sap xep")
(setq lstd (vl-remove-if
'listp
(mapcar 'cadr (ssnamex (ssget '((0 . "DIMENSION")))))
)
)
(setq m (getreal "\nHe so nhan: "));dung de chinh chieu dai chan dim theo ty le chieu cao text
(setq
en (vlax-ename->vla-object (car lstd))
tstyle (vla-get-textstyle en)
objDoc (vla-get-activedocument (vla-get-application en))
objTStyle (vla-item (vla-get-textstyles objdoc) tstyle)
hd (vla-get-height objTStyle)
)
(if (= hd 0.0)
(setq hd (vla-get-Textheight en))
)
(foreach e1 lstd
(setq en (vlax-ename->vla-object e1))
(vla-put-extlinefixedlensuppress en :vlax-true)
(vla-put-extlinefixedlen en (* m hd))
)
(princ)
)
- Tải lisp
- 423492_sd2.lsp
Cách dùng
- Tải tệp 423492_sd2.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 SD2 để chạy lisp.
Mã nguồn 423492_sd2.lsp
;; free lisp from cadviet.com
;;; this lisp was downloaded from https://www.cadviet.com/forum/topic/171365-gi%C3%BAp-%C4%91%E1%BB%A1-lisp-c%E1%BA%AFt-dim-%C4%91o-%C4%91o%E1%BA%A1n-cung-tr%C3%B2n/
(vl-load-com)
(defun c:sd2 (/ lstd en hd objTStyle objDoc tstyle m)
(setvar "cmdecho" 0)
(princ "\nChon cac DIM can sap xep")
(setq lstd (vl-remove-if
'listp
(mapcar 'cadr (ssnamex (ssget '((0 . "DIMENSION")))))
)
)
(setq m (getreal "\nHe so nhan: "));dung de chinh chieu dai chan dim theo ty le chieu cao text
(setq
en (vlax-ename->vla-object (car lstd))
tstyle (vla-get-textstyle en)
objDoc (vla-get-activedocument (vla-get-application en))
objTStyle (vla-item (vla-get-textstyles objdoc) tstyle)
hd (vla-get-height objTStyle)
)
(if (= hd 0.0)
(setq hd (vla-get-Textheight en))
)
(foreach e1 lstd
(setq en (vlax-ename->vla-object e1))
(vla-put-extlinefixedlensuppress en :vlax-true)
(vla-put-extlinefixedlen en (* m hd))
)
(princ)
)Thảo luận gốc
Lisp được chia sẻ trong chủ đề [GIÚP ĐỠ] LISP CẮT DIM ĐO ĐOẠN CUNG TRÒN. Xem đúng bài viết #423492 để đọc hướng dẫn và trao đổi thêm.