Results 1 to 8 of 8

Thread: Modify the color of the UCS icon via LISP?

  1. #1
    Woo! Hoo! my 1st post
    Join Date
    2005-04
    Posts
    1
    Login to Give a bone
    0

    Angry Modify the color of the UCS icon via LISP?

    Does anyone know how to modify the color of the UCS icon via LISP? I have not been able to find a system variable or command-line-only option. My programming skills are pretty feeble, but below is the code (so far) of what I'm trying to accomplish:

    P.S. - I use AutoCAD 2000i.

    Thanks!

    S.P.

    ; This is a command to rotate the display orientation incrementally by 90 degrees (for fold-out type plans/elevations).

    (defun c:display-rotate ()
    (setq iconstate (getvar "ucsicon"))
    (command "ucsicon" "on")

    ; --------------------------------------------------------------------------------------------------
    ; I WOULD LIKE TO MAKE THE UCS ICON RED AS A REMINDER THAT THE DISPLAY ORIENTATION HAS BEEN MODIFIED
    ; --------------------------------------------------------------------------------------------------

    ; Rotate the UCS 90d, then use "plan" to have the display match the new orientation

    (command "ucs" "n" "z" "90")
    (command "plan" "current")
    (princ "\nUCS and Display Orientation have been rotated 90 degrees.
    \nUse the command [ display-restore ] to return your view settings to normal.")
    (princ)
    )

    (defun c:display-restore ()
    (command "ucsicon" iconstate)
    (command "ucs" "w")
    (command "plan" "w")
    (princ "\nUCS and Display Orientation have been restored to normal.")
    (princ)
    )

    ; I'D EVENTUALLY LIKE TO DEVELOPE A DIALOG INTERFACE TO ROTATE 90d, 180d, 270d, SET AN ARBITRARY OR ENTITY'S ANGLE, OR RESET TO "NORMAL" UCS/DISPLAY ORIENTATION
    Last edited by scottphillipsarch; 2005-04-29 at 04:33 PM.

  2. #2
    The Silent Type RobertB's Avatar
    Join Date
    2000-01
    Location
    Seattle WA USA
    Posts
    5,859
    Login to Give a bone
    0

    Default Re: Modify the color of the UCS icon via LISP?

    I don't think it is possible in Visual LISP.

  3. #3
    100 Club lance.81922's Avatar
    Join Date
    2005-01
    Location
    Santa Fe, NM
    Posts
    176
    Login to Give a bone
    0

    Default Re: Modify the color of the UCS icon via LISP?

    I have been looking into this, and can't find a way to access the UCS Icon's properties even in the registry. Clearly it's stored somewhere, but it's not obvious where. It looks like the AutoCAD Object Model makes no reference to the UCS Icon other than on/off/origin etc. This is a puzzlement.

  4. #4
    The Silent Type RobertB's Avatar
    Join Date
    2000-01
    Location
    Seattle WA USA
    Posts
    5,859
    Login to Give a bone
    0

    Default Re: Modify the color of the UCS icon via LISP?

    Quote Originally Posted by lance.81922
    I have been looking into this, and can't find a way to access the UCS Icon's properties even in the registry. Clearly it's stored somewhere, but it's not obvious where. It looks like the AutoCAD Object Model makes no reference to the UCS Icon other than on/off/origin etc. This is a puzzlement.
    It is probably accessible from ObjectARX, but not Visual LISP.

  5. #5
    100 Club
    Join Date
    2000-12
    Posts
    126
    Login to Give a bone
    0

    Default Re: Modify the color of the UCS icon via LISP?

    Modelspace icon color: (getenv "UcsIconActiveColor")
    Layout icon color: (getenv "UcsIconNonActiveColor")

    Setting colors with SETENV requires a regen for updating. Tested in 2005.

  6. #6
    100 Club lance.81922's Avatar
    Join Date
    2005-01
    Location
    Santa Fe, NM
    Posts
    176
    Login to Give a bone
    0

    Default Re: Modify the color of the UCS icon via LISP?

    Thank you! Very cool!

  7. #7
    The Silent Type RobertB's Avatar
    Join Date
    2000-01
    Location
    Seattle WA USA
    Posts
    5,859
    Login to Give a bone
    0

    Default Re: Modify the color of the UCS icon via LISP?

    Thanks Stig. I thought that there might be Acad.cfg access to it, but didn't take the time to dig that far.

  8. #8
    100 Club lance.81922's Avatar
    Join Date
    2005-01
    Location
    Santa Fe, NM
    Posts
    176
    Login to Give a bone
    0

    Default Re: Modify the color of the UCS icon via LISP?

    Here's your code with the UCSIcon embellishment:

    Code:
    ;;; DISPLAY-ROTATE.LSP
    ;;; Note that this program declares the variables
    ;;; ICONSTATE and UCSICONCOLOR as global variables
    ;;; so that they can be retrieved by DISPLAY-RESTORE
    
    ;;; to alter UCSICON properties
    ;;; Model Space icon color: (getenv "UcsIconActiveColor")
    ;;; Layout icon color: (getenv "UcsIconNonActiveColor")
    
    ;;; NOTE: GETENV and SETENV calls are CASE-SENSITIVE!
    
    (defun c:display-rotate ( / tilemode)
      (setq iconstate (getvar "UCSICON")
    	tilemode  (getvar "TILEMODE")
      )
      (command "UCSICON" "ON")
      (if (= tilemode 1)
    	(setq UCSIconColor (getenv "UcsIconActiveColor"))
    	(setq UCSIconColor (getenv "UcsIconNonActiveColor"))
      )
    ; Rotate the UCS 90d, then use "plan" to have the display match the new orientation
    
      (command "_UCS" "n" "z" "90")
      (command "_PLAN" "Current")
      (if (= tilemode 1)
    	(setenv "UcsIconActiveColor" "1")
    	(setenv "UcsIconNonActiveColor" "1")
      )
      (command "_REGEN")
      (princ
    	"\nUCS and Display Orientation have been rotated 90 degrees. 
    \nUse the command \"DISPLAY-RESTORE\" to return your view settings to normal."
      )
      (princ)
    )
    
    (defun c:display-restore ()
      (setvar "UCSICON" iconstate)
      (command "_UCS" "w")
      (command "_PLAN" "w")
      (if (=(getvar "TILEMODE") 1)
    	(setenv "UcsIconActiveColor" UCSIconColor)
    	(setenv "UcsIconNonActiveColor" UCSIconColor)
      )
      (command "_REGEN")
      (princ
    	"\nUCS and Display Orientation have been restored to normal."
      )
      (princ)
    )

Similar Threads

  1. Color wheel icon properties in ribbon
    By mroth3270139 in forum Software
    Replies: 0
    Last Post: 2010-09-13, 09:26 PM
  2. Modify layers by color
    By Capn in forum AutoLISP
    Replies: 5
    Last Post: 2008-07-11, 05:39 PM
  3. Icon background color in 2009
    By jpaulsen in forum AutoCAD CUI Menus
    Replies: 6
    Last Post: 2008-05-20, 03:31 PM
  4. Icon Color in Tool Palettes
    By rgorman in forum AutoCAD General
    Replies: 5
    Last Post: 2006-11-17, 09:13 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
  •