Desire a single message on command line with my macro

Desire a single message on command line with my macro

mikeshick
Collaborator Collaborator
765 Views
10 Replies
Message 1 of 11

Desire a single message on command line with my macro

mikeshick
Collaborator
Collaborator

I have this macro for toggeling osnapz.

 

I would like the command line to only show the SNAP SET TO ZERO ELEVATION OR SNAP SET TO 3D ELEVATION 

without showing the command running.  

 

Can someone direct me to the correct method?

 

Thank you,

Mike Shick
www.medesigns.us
0 Likes
Accepted solutions (1)
766 Views
10 Replies
Replies (10)
Message 2 of 11

paullimapa
Mentor
Mentor
0 Likes
Message 3 of 11

Moshe-A
Mentor
Mentor

@mikeshick  hi,

 

Where is the macro?

0 Likes
Message 4 of 11

Kent1Cooper
Consultant
Consultant

You can build in a setting of either the MENUECHO or NOMUTT System Variable, and resetting when past the parts you don't want to show.  But the command line will still show the first setting of MENUECHO/NOMUTT, which won't be suppressed.  [Putting ^P at the front is also >supposed to< suppress such things, but in quick testing seems to suppress only parts.]

Kent Cooper, AIA
0 Likes
Message 5 of 11

mikeshick
Collaborator
Collaborator
It's in a custom toolbar button.
Mike Shick
www.medesigns.us
0 Likes
Message 6 of 11

Kent1Cooper
Consultant
Consultant

@mikeshick wrote:
It's in a custom toolbar button.

[I think they were asking to see the contents of the macro.]

Kent Cooper, AIA
0 Likes
Message 7 of 11

mikeshick
Collaborator
Collaborator

Silly me, I thought I included it in OP.  Sorry.

 

(setvar "OSNAPZ" (if (= (getvar "OSNAPZ") 1)0 1))(princ (strcat "SNAP set to " (if (= (getvar "OSNAPZ") 1)"O ELEV""3D ELEVATION")))(princ)

Mike Shick
www.medesigns.us
0 Likes
Message 8 of 11

Kent1Cooper
Consultant
Consultant

If you use (prompt) instead of (princ), it at least doesn't both put it in and return it [showing twice in the command line], but the empty (princ) function doesn't seem to suppress the nil following.  But it works for me to define a command that can work as expected in that way:

 

(defun C:OSZT () ; = OSnapZ Toggle

  (setvar 'osnapz (- 1 (getvar 'osnapz)))

  (prompt (strcat "SNAP set to " (if (= (getvar 'osnapz) 1) "0" "3D") " ELEVATION."))

  (prin1)

)

 

and with that always loaded such as via acaddoc.lsp, put just this into the macro:

 

^POSZT

Kent Cooper, AIA
0 Likes
Message 9 of 11

mikeshick
Collaborator
Collaborator

i can barely make sense of it.  I understand coding, but don't know lisp.  

 

The function you provided didn't seem to work for me.

Mike Shick
www.medesigns.us
0 Likes
Message 10 of 11

Kent1Cooper
Consultant
Consultant
Accepted solution

First, select that code defining the OZST command, Ctrl+C copy it to the clipboard, and in a drawing, pick in the command line and Ctrl+V paste the code in.  [Hit Enter if it ends up waiting at the last closing right parenthesis.]  It should then show:
C:OSZT

to indicate that the command has been defined.

 

Put only ^POSZT in as the contents of the macro in your Tool Palette button, to fire that command [the ^P makes the entered command name not appear at the command line, but the command itself returns the prompt].  Then pick on that button a few times -- does it go back and forth notifying about the 0 and 3D elevation setting?  It should do the same if you type in the command name OSZT.

 

If that works, I can describe how to have it loaded in all drawings.

Kent Cooper, AIA
0 Likes
Message 11 of 11

mikeshick
Collaborator
Collaborator

yeah...I owe you a coffee or a beer 🙂

 

Thanks so much.  I cannot believe how many years I used that routine but hated the output....originally the text said On or Off...and when I relooked, I had the genius idea, why have I left the output so disturbingly confusing. 

 

Thanks, thanks, thanks.  

 

Venmo?

Mike Shick
www.medesigns.us
0 Likes