Visually See if SNAP is ON via color Swatch?

Visually See if SNAP is ON via color Swatch?

johnw
Collaborator Collaborator
4,214 Views
59 Replies
Message 1 of 60

Visually See if SNAP is ON via color Swatch?

johnw
Collaborator
Collaborator

We use SNAP when we draw and as a trainer I would like to easily see if someone has SNAP ON or OFF with a color swatch displayed on the ribbon panel. Is there a way to display a green swatch that is large enough to see from a distance if SNAP is ON and it turn RED if SNAP is OFF? Some folks use the classic toolbar menu as well so the swatch for that would have to be located at the bottom left of the menu in the startup. If someone could show me how to show this color switch in a Ribbon panel setting and as lower left corner of classic window setting that would be fantastic.

 

Much thanks,

 

John W.

0 Likes
Accepted solutions (1)
4,215 Views
59 Replies
Replies (59)
Message 21 of 60

paullimapa
Mentor
Mentor

Let's hope user doesn't change their crosshair size to be really small....

 

 

Area Object Link | Attribute Modifier | Dwg Setup | Feet-Inch Calculator
Layer Apps | List on Steroids | VP Zoom Scales |Exchange App Store


Paul Li
IT Specialist
@The Office
Apps & Publications | Video Demos
0 Likes
Message 22 of 60

alexKoshman
Collaborator
Collaborator

scot-65!

Agree! You are right!!

 

But adress this to topicstarter! ; ))

 

pli!

Agree! ; ))

0 Likes
Message 23 of 60

alexKoshman
Collaborator
Collaborator

scot-65!

Thank you! But I thought the CrossHair checking function must be right in the Reactor's LISP! ; ))

 

Here it is.

 

 

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

(vl-load-com)
(if (= 0 (getvar "SNAPMODE"))

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

;; Change crosshair color to GREEN here.
      (vla-put-ModelCrosshairColor (vla-get-display (vla-get-preferences (vlax-get-acad-object)))
        (vlax-make-variant 16777215)
      ) ; - 'vla-put0-...'
) ; - 'if'

;; -------------------------------------------------------------------
(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 (and (= (car lst) "SNAPMODE") (cdr lst))
    (if (= (ax-GetVar "SNAPMODE") 0)

;; Change crosshair color to RED here.
      (vla-put-ModelCrosshairColor (vla-get-display (vla-get-preferences (vlax-get-acad-object)))
        (vlax-make-variant 255 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)
      ) ; - 'vla-put0-...'

    ) ; - if
  ) ; - if
 (princ)
) ; - end Sys_Var_Chg_SNMODE
;; -------------------------------------------------------------------


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

(princ)

 

 

 

0 Likes
Message 24 of 60

johnw
Collaborator
Collaborator

Hi Alex, thanks for writing this. I have a slight problem with this working as we need it to. Currently, when I go to paperspace tab, my crosshairs turn red (which lets us know we're in Paperspace). When I click inside a viewport my crosshairs turn WHITE (which lets us know we're inside a viewport even though we're on a paperspace tab).

 

The command you wrote works perfectly in MODEL space tab (i changed the RED to PURPLE color). But if I go to paperspace and turn snap off it doesn't do anything. And  if I click inside a viewport and turn snap off the crosshairs remain white. And if I go back to model space while snap is still off, the crosshairs are still white.

 

I've attached the code your wrote with my color purple change and the original crosshair paperspace color change routine. Would it be possible to add your code to my original crosshair color change so the "snap off" color change works in paperspace and if we're inside a viewport?

 

PS - the two files attached have .txt extensions. It wouldn't let me upload .lsp files so I renamed the extensions.

 

That would make it perfect!

 

Thanks in advance,

 

John

0 Likes
Message 25 of 60

alexKoshman
Collaborator
Collaborator

At this weekend I had no time to think about Paper!..

: ((

 

Maybe later!..

0 Likes
Message 26 of 60

johnw
Collaborator
Collaborator
No Worries! Whenever you feel like fiddling with it is fine. Thank you!
0 Likes
Message 27 of 60

alexKoshman
Collaborator
Collaborator

Hello johnw!

 

I wrote it! And I didn't forget about changing Viewports!

; ))

 

Try it!..

0 Likes
Message 28 of 60

johnw
Collaborator
Collaborator

Hi Alex, thanks for taking time and writting this! This is definitely going to help me out. I tested it and it all worked except for one area.  I've attached a small .gif video to show you.

 

I hope this is an easy fix.

 

Thanks again!

 

John

 

 

 

 

0 Likes
Message 29 of 60

alexKoshman
Collaborator
Collaborator

Can't reproduce your situation!

 

Am I right:

0. ...

1. You are in Paper inside the VP - e.g. in Model Space ; )) and SNAP is OFF;

2. You move to Model Tab where SNAP is OFF and the Crosshair shows as "GOOD"???

 

Please send me THE COPY of that your file ; ))) after deleting everything and PURGE three times!

; ))

 

And send me your working LSP file!!

0 Likes
Message 30 of 60

johnw
Collaborator
Collaborator

Yes you are correct. On step 2, crosshairs show up White when they should be purple. As seen in the video I attached. Where you able to view that?


I've also attached the drawing and the lisp routine, with .txt extension.

 

Thanks.

 

 

0 Likes
Message 31 of 60

alexKoshman
Collaborator
Collaborator

It can't be possible.

You attach the file with NO PURPLE color at all.

It work perfect and I can't see any problems.

 

I think you load another LSP file.

0 Likes
Message 32 of 60

johnw
Collaborator
Collaborator

the 'variant' color that starts with 14****** is the PURPLE color I thought. It orginally was 16***** and I changed it to 14***** and the color was in the purple range. I only have the one crosshairsnap.lsp file so that has to be the correct one.

0 Likes
Message 33 of 60

alexKoshman
Collaborator
Collaborator

Hmm... I tnink it's blue...

; ))

 

I can't reproduce this bug!..

 

AND WHY it is dark RED in Paper in your GIF?? In this LSP file there's no such a color - just white and your "purple"!

That what I want to say!

0 Likes
Message 34 of 60

johnw
Collaborator
Collaborator

blue - purple - something around that color...

 

I just was checking to see if I could reproduce and I could.

 

I also noticed that if my SNAP is off, and I enter a command like "Line" the command cancels. Then SNAP turns back on. I then have to reenter the command again.

 

does that happen to you?

0 Likes
Message 35 of 60

alexKoshman
Collaborator
Collaborator

1. Why it is dark RED in Paper in your GIF?

In this LSP file there's no such a color - just white and your "purple"!

 

2. And no, I can reproduce that command behaviour too...

 

I think now you have some another Reactors in the Acad!

0 Likes
Message 36 of 60

johnw
Collaborator
Collaborator

my original crosshairs changed to RED when in paperspace and WHITE when in Model space (see attached). That file was loading in my video I sent you.

 

The new routine that you created needs to have the "RED" in paperspace.

 

That is why I sent the original xhairchange.lsp a while back to incorporate both together. Sorry I didn't realize that it was loading along with yours. Can the red portion of the orginal routine be incorporated?

0 Likes
Message 37 of 60

alexKoshman
Collaborator
Collaborator

Understand now about red crosshair!.. ; ))

0 Likes
Message 38 of 60

johnw
Collaborator
Collaborator

Thanks for combining. When on a paperspace tab and I turn snap off, then click inside a viewport, my crosshairs are RED and do not turn white. Do we need to add another condition so they turn white in a viewport when snap is on? 

0 Likes
Message 39 of 60

alexKoshman
Collaborator
Collaborator

No! It woun't work.

At Paper Space "there can be only one" crosshair color! ; ))

0 Likes
Message 40 of 60

johnw
Collaborator
Collaborator
Standard autocad - crosshairs are the same color in paper or model space. I had the original routine make crosshairs red when in paperspace and turn to white inside model space (or inside viewport). Now with your routine, in paperspace the crosshairs are red or purple when toggling snap, but when I go into model space through a viewport they are staying red. Model space should only be white and purple when toggling snap. I hope this makes sense. Sorry for all the back and forth. I know I'm asking a lot for you to do this and I really do appreciate your help.
0 Likes