color when snaps are on

color when snaps are on

Migumby
Advocate Advocate
438 Views
2 Replies
Message 1 of 3

color when snaps are on

Migumby
Advocate
Advocate

Hello,

I just saw this on forums, and I thought it was a good idea.

I'm thinking of having the crosshair as red when snap is on and white when off.

does anyone know how to modifiy this to do that?

thanks

 

;; -------------------------------------------------------------------
;;
;; System Variable Changed Exercise
;;
;; -------------------------------------------------------------------

(vl-load-com)

;;; ------------------------------------------------------------------
(defun ax-GetVar ( varname / )
  (vl-load-com)
  (vlax-variant-value (vla-GetVariable (vla-get-ActiveDocument (vlax-get-Acad-Object)) varname))
) ; - 'defun'
;;; ------------------------------------------------------------------



(if (= (ax-GetVar "CTAB") "Model")
  (if (= 0 (ax-GetVar "SNAPMODE"))
;; Change crosshair color to PURPLE here.
     (vla-put-ModelCrosshairColor (vla-get-display (vla-get-preferences (vlax-get-acad-object)))
        (vlax-make-variant 14777215 19)
      ) ; - 'vla-put0-...'

;; Change crosshair color to WHITE here.
      (vla-put-ModelCrosshairColor (vla-get-display (vla-get-preferences (vlax-get-acad-object)))
        (vlax-make-variant 16777215 19)
      ) ; - 'vla-put0-...'
  ) ; - 'if'
  (if (= 0 (ax-GetVar "SNAPMODE"))
;; Change crosshair color to PURPLE here.
      (vla-put-LayoutCrosshairColor (vla-get-display (vla-get-preferences (vlax-get-acad-object)))
        (vlax-make-variant 14777215 19)
      ) ; - 'vla-put0-...'

;; Change crosshair color to RED here.
      (vla-put-LayoutCrosshairColor (vla-get-display (vla-get-preferences (vlax-get-acad-object)))
        (vlax-make-variant 255 19)
      ) ; - 'vla-put0-...'
  ) ; - 'if'
) ; - 'if in Model'





;; -------------------------------------------------------------------
(defun Sys_Var_Chg_SNMODE (obj lst / alex-ax-GetVar)


;;; ------------------------------------------------------------------
(defun ax-GetVar ( varname / )
  (vl-load-com)
  (vlax-variant-value (vla-GetVariable (vla-get-ActiveDocument (vlax-get-Acad-Object)) varname))
) ; - 'defun'
;;; ------------------------------------------------------------------

  (if (or
       (and (= (car lst) "SNAPMODE") (cdr lst))
        (and (= (car lst) "CVPORT") (cdr lst))
      ) ; - 'or'

(if (= (ax-GetVar "CTAB") "Model")
  (if (= 0 (ax-GetVar "SNAPMODE"))
;; Change crosshair color to PURPLE here.
     (vla-put-ModelCrosshairColor (vla-get-display (vla-get-preferences (vlax-get-acad-object)))
        (vlax-make-variant 14777215 19)
      ) ; - 'vla-put0-...'

;; Change crosshair color to WHITE here.
      (vla-put-ModelCrosshairColor (vla-get-display (vla-get-preferences (vlax-get-acad-object)))
        (vlax-make-variant 16777215 19)
      ) ; - 'vla-put0-...'
  ) ; - 'if'
  (if (= 0 (ax-GetVar "SNAPMODE"))
;; Change crosshair color to PURPLE here.
      (vla-put-LayoutCrosshairColor (vla-get-display (vla-get-preferences (vlax-get-acad-object)))
        (vlax-make-variant 14777215 19)
      ) ; - 'vla-put0-...'

;; Change crosshair color to RED here.
      (vla-put-LayoutCrosshairColor (vla-get-display (vla-get-preferences (vlax-get-acad-object)))
        (vlax-make-variant 255 19)
      ) ; - 'vla-put0-...'
  ) ; - 'if'
) ; - 'if in Model'
  ) ; - if
 (princ)
) ; - end Sys_Var_Chg_SNMODE
;; -------------------------------------------------------------------


;; -------------------------------------------------------------------
(vl-load-com)
(vlr-sysvar-reactor nil '((:vlr-sysVarChanged . Sys_Var_Chg_SNMODE)))
;; -------------------------------------------------------------------

(princ)
0 Likes
Accepted solutions (1)
439 Views
2 Replies
Replies (2)
Message 2 of 3

alexKoshman
Collaborator
Collaborator
Accepted solution

Good idea...

One only thing - just make a link to discussion!..

; ))

0 Likes
Message 3 of 3

alexKoshman
Collaborator
Collaborator

... just make a link to discussion!.. Smiley Mad

 

Smiley Happy

0 Likes