|
I basically used the same code as in the Purge All button, but specified blocks instead of all. I made the button icon by starting with the Make Block icon and adding a red minus sign. I made sure to save this to my icon folder as well.
Managing Icon Images One of the most frustrating things about using custom buttons when AutoCAD loses track of them. When this happens, the custom icons are replaced with the dreaded Smiley face.
One way to avoid this is to specifically name and locate the button icons . I keep all my button icons in one folder and include that folder in the AutoCAD File Search Path.
That's not all though. Here is the toolbar code for two PURGE buttons created above.
[_Button("Purge All", "ICON6500.bmp", "ICON_16_BLANK")]^C^C-purge all * no [_Button("Purge All Blocks", "ICON9169.bmp", "ICON_16_BLOCK")]^C^C-purge blocks * no
Notice the icon names specified in the code. Check out the Custom Toolbar Flyout Tip for information on button codes. These are not the names I specified, but ones that AutoCAD made up. The icon files are placed in the current drawing folder when the button is made, so eventually, when I work on a drawing in a different folder, AutoCAD won't be able to find the icon files. Voila, Smiley faces.
So, what I do is manually edit the *.MNS file and enter the file name that I specified. Don't forget to backup your *.MNS files just like drawing files. I've known a lot of people that accidentally reload their menu template file and destroy all their custom toolbars. Here is what my button code looks like after inserting my bitmap names.
[_Button("Purge All", "purge_all.bmp", "purge_all.bmp")]^C^C-purge all * no [_Button("Purge All Blocks", "purge_blocks.bmp", "purge_blocks.bmp")]^C^C-purge blocks * no
Creating a DLL File A dynamic link library (DLL) is a collection of small programs or resources, any of which can be called when needed by a larger program that is running in the computer.
If you create dozens of toolbar buttons, you might want to investigate placing them in a DLL file. AutoCAD will automatically load and search a DLL file with the same name as a loaded partial menu. See the Custom Menus Tip Sheet for information on creating partial menus. Typically, you need to write a C program to place icon files in a DLL. However, I've found a freeware program named
ResourceHacker that not only allows you to create DLL files, it let's you extract icons from other DLL files.
So in my case, I've created a partial menu file named CINDY.MNU containing the toolbar described above. Then, using ResourceHacker, I created a file name CINDY.DLL and added the PURGE_ALL.BMP file and PURGE_BLOCKS.BMP file. Again, I've placed these files in a folder on the
AutoCAD Support File Search Path so they will be found.
I hope you've enjoyed this small series on Toolbar Customization. If you have any ideas for future Tip Sheets, please contact me at the link to the left.
Top of Page
|
|