Background color changing option via color book

Background color changing option via color book

Anonymous
Not applicable
589 Views
1 Reply
Message 1 of 2

Background color changing option via color book

Anonymous
Not applicable

Dear Experts,

 

Below is the code for AutoCAD background color change option.

 

Requirement is to add an option to select the colour from color book. (User wants to select the color from color book dialogue box)

 

Thanks in advance to all.

(defun c:tbg (/ col)
  (if tbg:flg
    (setq col 16777215
	  tbg:flg nil
    )
    (setq col 0
	  tbg:flg t
    )
  )
  (foreach prp '(graphicswinmodelbackgrndcolor
		 modelcrosshaircolor
		 graphicswinlayoutbackgrndcolor
		 layoutcrosshaircolor
		)
    (vlax-put-property (acdisp) prp (setq col (- 16777215 col)))
  )
  (princ)
)
(defun acdisp nil
  (eval (list 'defun 'acdisp 'nil (vla-get-display (vla-get-preferences (vlax-get-acad-object)))))
  (acdisp)
)
(vl-load-com)
(princ)

 

0 Likes
590 Views
1 Reply
Reply (1)
Message 2 of 2

Sea-Haven
Mentor
Mentor

Try 

(acad_colordlg 1)

(acad_truecolordlg 1 )

0 Likes