Hello All,
I was wondering if anyone has had any luck with doing something like the following:
I want to make a keyboard shortcut that will turn on/off my osnap, polar, and otrack.
I would be fine with setting F3 to do this, or any other key really...
I like to be able to turn these off on the fly, but it is getting old having to press all three.
Why do I want this? I guess it is just me being weird lol
Assign this to a button:
(defun c:OSnapPolarOTrackToggle (/) (setvar 'AUTOSNAP (boole 6 (getvar 'AUTOSNAP) 24)) (setvar 'OSMODE (boole 6 (getvar 'OSMODE) 16384)) (princ) )
Don't forget to prefix the command with an apostrophe so it can be executed transparently.
eg. 'OSnapPolarOTrackToggle
Now, keep in mind that this is a toggle for each variable, meaning that if polar is off and otrack is on, they will be toggle.
@alanjt_ wrote:....
Now, keep in mind that this is a toggle for each variable, meaning that if polar is off and otrack is on, they will be toggle.
I was thinking the same thing. Postmaster_G, would it be acceptable to have two commands, one to turn all three off together [whatever their current states may be, and whether or not they are the same as each other] and one to turn all three on?
Just in case:
(defun c:OSnapPolarOTrackToggle (/) (setvar 'AUTOSNAP (boole 6 (getvar 'AUTOSNAP) 24)) (setvar 'OSMODE (boole 6 (getvar 'OSMODE) 16384)) (princ) ) (defun c:OSnapPolarOTrackOn (/) (setvar 'AUTOSNAP (boole 7 (getvar 'AUTOSNAP) 24)) (setvar 'OSMODE (boole 2 (getvar 'OSMODE) 16384)) (princ) ) (defun c:OSnapPolarOTrackOff (/) (setvar 'AUTOSNAP (boole 2 (getvar 'AUTOSNAP) 24)) (setvar 'OSMODE (boole 7 (getvar 'OSMODE) 16384)) (princ) )
This is what I am looking for...
Now the problem is how do I add this to a button?
When you say button do you mean a key on my keyboard or a button on the cad screen?
I wouldn't mind just making my F3 be the button that toggles all of these.
Also, I think the version where nomatter what state each button is in, pushing F3 will either turn them all on or off.
I use the snaps a lot, but sometimes I like to be able to turn them all off so that I can wing something into the position I like without the snaps taking over.
Thank you
@Postmaster_G wrote:
I wouldn't mind just making my F3 be the button that toggles all of these.
Thank you
Have a look at the attached...
Once you have created your routine with the the command "c:XXX",
open the CUI and create the command in the bottom-left pane.
Drag and drop to the upper-left.
Highlight the command in the upper left, then do your thing in the lower-right pane.
Of course the routine you created must be in a support path defined folder.
???
Scot-65
A gift of extraordinary Common Sense does not require an Acronym Suffix to be added to my given name.
It seems to have worked. This is what I did.
First I took the first routine that you gave me and created a lsp
Next I made sure that my lsp folder was in my support file search path list
Then I did an appload of that lsp and added it to the startup suite in that dialog
I created a command that used the "OSNAPPOLAROTRACKTOGGLE" lsp command
I assigned a button image to it
Added that button to my single slim common use toolbar I had created for other common commands
Then the last step, which was tricky and Im not sure I did it correctly, was to create a copy of one of the keyboard shortcuts and edit it to be as i wanted it. It gave me a warning that F3 was already used and that the priority of the list was bottom to top, but I couldn't move mine below the other F3 command on the list.
Either way it works!!!! And very nicely I might add, I love it!
Thank You!!!
Can we marked this as solved? Also, any comments on the "last step" I mentioned would be appreciated.
You're very welcome.
Another thing you can do, which will make loading routines, settings would be to use your own custom mnu/mnl. Easy to edit and work with. Put both files in a support path and MENULOAD the .mnu file. The rest is done for you from now on, and since it will be loaded after the core menu files, it gets priority.
I used your name as the menu group title, but you can change it however you like.