Lisp đổi màu nền của cad
Đây bạn! Lisp này tôi mót được của By Jimmy Bergmark (thank you). Lệnh BGT. Gõ BGT: chuyển đen qua trắng, gõ tiếp BGT: chuyển trắng qua đen. Cứ thế tiếp tục...
- Tải lisp
- 185198_bgwhite_bgblack_bgt.lsp
Cách dùng
- Tải tệp 185198_bgwhite_bgblack_bgt.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 BGWHITE BGBLACK BGT để chạy lisp.
Mã nguồn 185198_bgwhite_bgblack_bgt.lsp
;; free lisp from cadviet.com
;;; this lisp was downloaded from https://www.cadviet.com/forum/topic/60949-y%C3%AAu-c%E1%BA%A7u-lisp-%C4%91%E1%BB%95i-m%C3%A0u-n%E1%BB%81n-c%E1%BB%A7a-cad/
;----- Set the background in model and paper space to white
(defun c:BGWhite ()
(vl-load-com)
(setq disp (vla-get-display (vla-get-preferences (vlax-get-acad-object))))
(setq drafting (vla-get-drafting (vla-get-preferences (vlax-get-acad-object))))
(vla-put-GraphicsWinModelBackgrndColor disp 16777215)
(vla-put-GraphicsWinLayoutBackgrndColor disp 16777215)
(vla-put-LayoutCrosshairColor disp 0)
(vla-put-ModelCrosshairColor disp 0)
(vla-put-AutoTrackingVecColor disp 0)
(vla-put-AutoSnapMarkerColor drafting 6)
(princ))
;----- Set the background in model and paper space to black
(defun c:BGBlack ()
(vl-load-com)
(setq disp (vla-get-display (vla-get-preferences (vlax-get-acad-object))))
(setq drafting (vla-get-drafting (vla-get-preferences (vlax-get-acad-object))))
(vla-put-GraphicsWinModelBackgrndColor disp 0)
(vla-put-GraphicsWinLayoutBackgrndColor disp 0)
(vla-put-LayoutCrosshairColor disp 16777215)
(vla-put-ModelCrosshairColor disp 16777215)
(vla-put-AutoTrackingVecColor disp 16777215)
(vla-put-AutoSnapMarkerColor drafting 2)
(princ))
;----- Background toggle between black and white
(defun c:bgt ()
(vl-load-com)
(setq disp (vla-get-display (vla-get-preferences (vlax-get-acad-object))))
(setq drafting (vla-get-drafting (vla-get-preferences (vlax-get-acad-object))))
(if (= (vlax-variant-value (vlax-variant-change-type (vla-get-graphicswinmodelbackgrndcolor disp) vlax-vblong)) 0)
(c:bgwhite)
(c:bgblack))
(princ))
(princ)
Thảo luận gốc
Lisp được chia sẻ trong chủ đề [Yêu cầu] Lisp đổi màu nền của cad. Xem đúng bài viết #185198 để đọc hướng dẫn và trao đổi thêm.