Visually See if SNAP is ON via color Swatch?

Visually See if SNAP is ON via color Swatch?

johnw
Collaborator Collaborator
4,224 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,225 Views
59 Replies
Replies (59)
Message 2 of 60

Anonymous
Not applicable

Isn't the status tabs at the bottom of thr screen (ORTHO, OSNAP, SNAP, etc.) work for you? The tabs change between dark and light indicating status of OFF and ON

0 Likes
Message 3 of 60

johnw
Collaborator
Collaborator
They don't work from a distance. That's why I requested this.
0 Likes
Message 4 of 60

johnw
Collaborator
Collaborator
They don't work from a distance. That's why I requested this.
0 Likes
Message 5 of 60

ВeekeeCZ
Consultant
Consultant
0 Likes
Message 6 of 60

scot-65
Advisor
Advisor
(setvar "MODEMACRO" "$(if,$(getvar,snapmode), Snap is ON, Snap is OFF)")

Scot-65
A gift of extraordinary Common Sense does not require an Acronym Suffix to be added to my given name.

0 Likes
Message 7 of 60

johnw
Collaborator
Collaborator
Any way to display a color green if it's on and color red if it's off?
0 Likes
Message 8 of 60

alexKoshman
Collaborator
Collaborator

Why not to change the color OF THE CROSSHAIR!?

; ))

0 Likes
Message 9 of 60

johnw
Collaborator
Collaborator

Sounds like a great idea! I have a routine that someone wrote that changes my crosshairs to RED when I'm in paperspace and WHITE when in model space (see attached lisp routine - i had to change extension to .txt for attachment to load). How would I add changing the color to PURPLE if SNAP IS OFF in Either paper or model space???

 

 

0 Likes
Message 10 of 60

alexKoshman
Collaborator
Collaborator

You have to fully rewrite this example program with "VLR-SysVarChanged" Reactor for catching user changes the "SNAPMODE" system variable and then change the "ModelCrosshairColor" or " "LaypoutCrosshairColor" Property for Model or Model depending on your current Space!

; ))

0 Likes
Message 11 of 60

johnw
Collaborator
Collaborator

Sorry, I don't have a clue on how to do this.

0 Likes
Message 12 of 60

alexKoshman
Collaborator
Collaborator

Sorry! But I have no time to write it now!..

Maybe on weekend?..

0 Likes
Message 13 of 60

martin_leiter
Advocate
Advocate

an Example... http://ww3.cad.de/foren/ubb/Forum145/HTML/004108.shtml

 

Best Regards Martin

0 Likes
Message 14 of 60

alexKoshman
Collaborator
Collaborator

You mean that of cause:

 

(vla-put-ModelCrosshaircolor (vla-get-display (vla-get-preferences (vlax-get-acad-object)))
  (cdr (assoc 420 (acad_truecolordlg (cons 420 16777215))))
)

 

Because we mustn't use "setvar" (see there below) in Reactors for variables changing...

Message 15 of 60

johnw
Collaborator
Collaborator
Do I insert these lines of code inside the file I attached earlier or insert it into the acad.lsp file? Not sure...
0 Likes
Message 16 of 60

alexKoshman
Collaborator
Collaborator

They ARE in the code already!

 

I told this to martin.leiter...

0 Likes
Message 17 of 60

johnw
Collaborator
Collaborator

I'm sorry I don't understand what you mean. If you added this code to my original attachment can you attach the revised code so I can download it. Or if I need to do something on my end please let me know.

 

Thanks.

0 Likes
Message 18 of 60

scot-65
Advisor
Advisor
Accepted solution

Attached file is code for the reactor part.

I was not sure how to handle the "answer" in a timely manner.

However, the attached file reactor does work with limited testing. Remove the ".TXT" extension.

I am also displaying the code here with revisions:

 

;; System Variable Changed Exercise

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

(defun Sys_Var_Chg_SNMODE (obj lst / )
 (if (and (= (car lst) "SNAPMODE") (cdr lst))
  (if (= (getvar "SNAPMODE") 0)
   ;change crosshair color to RED here.
;change crosshair color to GREEN here. );if );if (princ) );end Sys_Var_Chg_SNMODE

 

Good Luck.


Scot-65
A gift of extraordinary Common Sense does not require an Acronym Suffix to be added to my given name.

Message 19 of 60

johnw
Collaborator
Collaborator

Thanks Scott, I got this working in modelspace! Thank you.

 

Thank all of you for your comments and help!

0 Likes
Message 20 of 60

scot-65
Advisor
Advisor
Just an additional thought...
The crosshair color is recorded into the registry when editor is closed.
By opening another file that has the opposite setting of SNAPMODE
the color would be wrong.
To fix this, add code inside S::STARTUP (or equal):
(vl-load-com)
(if (= (getvar "SNAPMODE") 0)
;change crosshair color to RED here.
;change crosshair color to GREEN here.
);if

???

Scot-65
A gift of extraordinary Common Sense does not require an Acronym Suffix to be added to my given name.

0 Likes