[Search tip detail and code files using keywords, tip number, author name, etc ]
Program Keyboard and Mouse Inputs
Tip# 3366 By Jamie Duncan On 15-Mar-2010
Rated By 1 users
Categories : Menus
Software type : AutoCAD 2010
Rename File To : No Files to download.
Set up mouse and keyboard inputs that can change your osnap settings on the fly.

Jamie Duncan sends us a tip to set up some mouse and keyboard inputs that can change your osnap settings on the fly.

"This tip shows how to set up a Ctrl + Shift + right-click keystroke combination to restore many user settings transparently in AutoCAD Commands. Before doing this set your osnaps, orthomode, polarmode, and polarang to your favorite settings.

1. Copy and paste the following LISP code to the command line in AutoCAD:

 (setq str1 "")
   (if (getvar x)
     (setq str1 (strcat str1 "'setvar;" x ";" (cond
                                                ((= (type (getvar x))
'INT)(itoa (getvar x)))
                                                ((= (type (getvar x))
'REAL)(rtos (* 180.0 (/ (getvar x) pi)) 2 4))

2.    This will print a line or two of text to the command line (press function key F2 to see all the text). It will look similar to this:


3.    Highlight the text and copy it to the clipboard. Do not include the quotation marks.

4.    Open the CUI (customize user interface) editor.

5.    Create a new command in ACAD.CUI called Favesnaps.

6.    Open the Macro Editor and delete everything.

7.    Paste the text into the macro — note important!

8.    Access the mouse buttons portion of the CUI and click to expand the Ctrl + Shift + Click section.

9.    Drag the new Favesnaps command onto Button 2, replacing the existing command.

10.    Apply, and then exit the CUI editor.

You can now restore your favorite settings by holding the Ctrl and Shift keys down and pressing the right mouse button. This will work even in the midst of an AutoCAD command (i.e., transparently).
Notes from Cadalyst Tip Patrol: Anything that can help a user work more quickly is a plus, and programming AutoCAD's mouse buttons is a good use of the hardware. The code that is to be pasted into the command line in this tip simply reads and displays the settings for your osnaps and other tools. It puts it into a form that you can repeat and set your osnaps with. This can save a lot of time, especially if you regularly change your osnap settings.


Average Rating:

User comments