Hello,
I need help with this code. What it does is that it changes the color of the
crosshairs to red when osnaps are "on" then back to white if there are "no"
osnaps or if "turned off" (F3 function key).
The problem is when I am in a middle of a command (ex. line, move) and I hit
the function key F3. It changes the color of the crosshair like its suppose to but
it cancels the command. What am I doing wrong or what I am not doing?
I'd like this code to work even when I am in a middle of a command..transparently.
;Reactor for osmode
(VLR-SysVar-Reactor nil'((:VLR-sysVarChanged . SysVarChanged)))
(defun SysVarChanged (calling-reactor SysVarChangeInfo /)
(if (wcmatch (strcase (nth 0 SysVarChangeInfo) T) "osmode")
(progn
(setq AcadObj (vlax-get-acad-object)
AcadDoc (vla-get-ActiveDocument AcaObj)
AcadDsp (vla-get-Display (vla-get-Preferences AcaObj))
Cursnap (getvar "osmode")
Curspac (getvar "tilemode")
)
(if (= Cursnap 0)(progn
(if (= Curspac 0) (vla-put-LayoutCrosshairColor AcaDsp (vlax-make-variant 16777215 vlax-vbLong)))
(vla-put-ModelCrosshairColor AcaDsp (vlax-make-variant 16777215 vlax-vbLong))
)
)
(if (> Cursnap 0)(progn
(if (= Curspac 0) (vla-put-LayoutCrosshairColor AcaDsp (vlax-make-variant 255 vlax-vbLong)))
(vla-put-ModelCrosshairColor AcaDsp (vlax-make-variant 255 vlax-vbLong))
)
)
(if (> Cursnap 16384)(progn
(if (= Curspac 0) (vla-put-LayoutCrosshairColor AcaDsp (vlax-make-variant 16777215 vlax-vbLong)))
(vla-put-ModelCrosshairColor AcaDsp (vlax-make-variant 16777215 vlax-vbLong))
)
)
)
)
)
<edit: added code tags>