[Search tip detail and code files using keywords, tip number, author name, etc ]
Disappearing Toolbars
Tip# 3377 By Leonid Nemirovsky On 22-Mar-2010
Rated By 1 users
Categories : Toolbars
Software type : AutoCAD 2010
Rename File To : No Files to download.
Get quick and easy access to your commands, then hide them while you draw.

Frequent tipster Leonid Nemirovsky shares with us some simple code that can bring new life to your toolbars.

"I have my own toolbar that has 3 rows of 10 buttons each, with the AutoCAD and custom commands I use most. I wrote an absolutely simple LISP routine to tell AutoCAD to hide the toolbar, then start the command. Add this code to your ACADDOC.LSP file, or however you load your LISP routines automatically:
(defun c:dtb()
(command "toolbar" "MY_TOOLS" "f" "200,300" "3")
"In this code, '200,300' is the location of the toolbar, and '3' represents the number of toolbar rows. All of these settings can be modified to fit your needs. The location will vary depending on your screen resolution settings.

"Create a toolbar called MY_TOOLS. Make sure to include all the commands in it that you want to use. Now modify every button on the toolbar. Enter the following line of code in front of every command:

command "toolbar" "MY_TOOLS" "h"

"For example, If the command on the button was ^c^c_line, it should look like this:

^c^c(command "toolbar" "MY_TOOLS" "h");_line

"On the command prompt, type DTB (or assign it to a hot key), and your customized toolbar will pop up. As soon you click on any button, the toolbar will close and the corresponding command will be initiated."
Notes from Cadalyst Tip Patrol: I stopped using toolbars when the ribbon was introduced in AutoCAD 2009, but this tip might bring them back into daily use for me. The concept is simple: gain quick and easy access to your commands, then get them off the screen so you can draw. The code that goes into the ACADDOC.LSP file loads the shortcut that opens your toolbar. You can use Len's DTB or make up your own. If you have a multibutton mouse, program one of its buttons to open this toolbar. You could even program the code to open the toolbar where your mouse is pointing! The next step is to create the toolbar and edit the commands in the CUI (customize user interface). Great tip, Len!



Average Rating:

User comments