Message 1 of 3
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
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)
Solved! Go to Solution.