Results 1 to 7 of 7

Thread: Changing background color via Lisp

  1. #1
    I could stop if I wanted to
    Join Date
    2001-01
    Posts
    257
    Login to Give a bone
    0

    Smile Changing background color via Lisp

    Hi All

    I am working on a routine to restore our office's standard setting and I am having trouble with restoring the drawing background color. I have tried the following piece of code with no luck at all. Any help is greatly appreciated. Thanks.

    Manuel

    Code:
    (vl-load-com)
    ((vl-registry-write (strcat "HKEY_CURRENT_USER\\Software\\Autodesk\\AutoCAD\\R18.1\\ACAD-9001:409\\Profiles\\"  (getvar "cprofile") "\\Drawing Window") "Background" "0"))
    Last edited by Opie; 2011-02-07 at 04:59 PM. Reason: [code] tags added

  2. #2
    Administrator BlackBox's Avatar
    Join Date
    2009-11
    Posts
    5,719
    Login to Give a bone
    0

    Default Re: Changing background color via Lisp

    Look into the GraphicsWinModelBackgrndColor and the GraphicsWinLayoutBackgrndColor properties, of the PreferencesDisplay object.
    "How we think determines what we do, and what we do determines what we get."

    Sincpac C3D ~ Autodesk Exchange Apps

    Computer Specs:
    Dell Precision 3660, Core i9-12900K 5.2GHz, 64GB DDR5 RAM, PCIe 4.0 M.2 SSD (RAID 0), 16GB NVIDIA RTX A4000

  3. #3
    100 Club
    Join Date
    2005-09
    Posts
    111
    Login to Give a bone
    0

    Default Re: Changing background color via Lisp

    See: http://forums.autodesk.com/t5/Visual...or/m-p/1605657

    Code:
    (defun c:wb () ;;white background
    (setq acadobject (vlax-get-acad-object))
    (setq acadpref (vlax-get-property acadobject 'preferences))
    (setq acaddisp (vlax-get-property acadpref 'display))
    (vlax-put-property acaddisp 'GraphicsWinmodelBackgrndColor 16777215)
    (vlax-put-property acaddisp 'ModelCrosshairColor 0)
    )
     
    (defun c:bb () ;; black background
    (setq acadobject (vlax-get-acad-object))
    (setq acadpref (vlax-get-property acadobject 'preferences))
    (setq acaddisp (vlax-get-property acadpref 'display))
    (vlax-put-property acaddisp 'GraphicsWinmodelBackgrndColor 0)
    (vlax-put-property acaddisp 'ModelCrosshairColor 16777215)
    )
    Regards HofCAD CSI.
    Last edited by hofcad; 2011-02-07 at 05:59 PM.

  4. #4
    I could stop if I wanted to
    Join Date
    2001-01
    Posts
    257
    Login to Give a bone
    0

    Default Re: Changing background color via Lisp

    Hofcad

    Can you tell me the names of the variables for paperspace background and crosshair color? Thanks.

    Manuel

  5. #5
    Administrator rkmcswain's Avatar
    Join Date
    2004-09
    Location
    Earth
    Posts
    9,805
    Login to Give a bone
    0

    Default Re: Changing background color via Lisp

    Here is a method to toggle the color between black and white: http://cadpanacea.com/node/50
    R.K. McSwain | CAD Panacea |

  6. #6
    Administrator rkmcswain's Avatar
    Join Date
    2004-09
    Location
    Earth
    Posts
    9,805
    Login to Give a bone
    0

    Default Re: Changing background color via Lisp

    Quote Originally Posted by cadconcepts View Post
    Hofcad

    Can you tell me the names of the variables for paperspace background and crosshair color? Thanks.

    Manuel
    That should be answered in this post.
    R.K. McSwain | CAD Panacea |

  7. #7
    I could stop if I wanted to
    Join Date
    2001-01
    Posts
    257
    Login to Give a bone
    0

    Default Re: Changing background color via Lisp

    That worked. Thank you all for your help.

    Manuel

Similar Threads

  1. 2014: Changing the Color of the Display Paper Background!?
    By WJM_Jr in forum AutoCAD General
    Replies: 7
    Last Post: 2013-10-07, 06:47 PM
  2. Change command line background color lisp
    By Dave Lewis in forum AutoLISP
    Replies: 1
    Last Post: 2012-08-07, 07:17 PM
  3. Changing Background Color
    By sinanbakir in forum Revit Structure - General
    Replies: 4
    Last Post: 2010-11-12, 04:42 PM
  4. Lisp for changing layer color in XREF's
    By cadd4la in forum AutoLISP
    Replies: 5
    Last Post: 2005-09-28, 01:16 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •