Lisp lệnh TEST trong chủ đề “Nhờ viết lisp thay đổi thay đổi tỷ lệ Annotation scale”
6 giờ trước, jangboko đã nói:
Bạn thử cái này xem:
(defun c:test (/ dict entsc)
(if (and
(setq dict (cdr (assoc 360 (entget (car (entsel "\nChon doi tuong anno: "))))))
(setq dict (dictsearch dict "AcDbContextDataManager"))
(setq dict (dictsearch (cdr (assoc -1 dict)) "ACDB_ANNOTATIONSCALES"))
)
(foreach n dict
(if (and
(= (car n) 350)
(setq entsc
(cdr (assoc 300 (entget (cdr (assoc 340 (entget (cdr n)))))))
)
);and
(setvar "CANNOSCALE" entsc)
)
);foreach
) ;if
(princ)
)
- Tải lisp
- 440724_test.lsp
Cách dùng
- Tải tệp 440724_test.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 TEST để chạy lisp.
Mã nguồn 440724_test.lsp
;; free lisp from cadviet.com
;;; this lisp was downloaded from https://www.cadviet.com/forum/topic/177899-nh%E1%BB%9D-vi%E1%BA%BFt-lisp-thay-%C4%91%E1%BB%95i-thay-%C4%91%E1%BB%95i-t%E1%BB%B7-l%E1%BB%87-annotation-scale/?tab=comments#comment-440688
(defun c:test (/ dict entsc)
(if (and
(setq dict (cdr (assoc 360 (entget (car (entsel "\nChon doi tuong anno: "))))))
(setq dict (dictsearch dict "AcDbContextDataManager"))
(setq dict (dictsearch (cdr (assoc -1 dict)) "ACDB_ANNOTATIONSCALES"))
)
(foreach n dict
(if (and
(= (car n) 350)
(setq entsc
(cdr (assoc 300 (entget (cdr (assoc 340 (entget (cdr n)))))))
)
);and
(setvar "CANNOSCALE" entsc)
)
);foreach
) ;if
(princ)
)Thảo luận gốc
Lisp được chia sẻ trong chủ đề Nhờ viết lisp thay đổi thay đổi tỷ lệ Annotation scale. Xem đúng bài viết #440724 để đọc hướng dẫn và trao đổi thêm.