CCAD inc. Home Page - Experienced Drafting & Design Services, AutoCAD Training & AutoCAD Enhancements. AutoCAD Tips, Tricks and Shortcuts by CCAD inc.

AutoCAD Tips to Work Smarter - October 2003

Design AutoCAD Training Calendar AutoCAD Tips Acad Faqs
AutoLISP® Downloads About CCAD Contact CCAD Search

Image Menus

An Image Menu is a graphic menu element that lets you make menu choices using an image or a picture. Image menus are frequently used to insert blocks. Unlike using DesignCenter to insert blocks, an Image menu selection can include additional parameters, like layer, scale and rotation options.

You should already be familiar with creating pull down menu before attempting to create an Image menu. Click HERE to learn about pull down menus. You should also be familiar with the AutoCAD File Search Path and installing custom menus. Click HERE to read more about locating custom files.

There are a few things you’ll need before you can create your image menu.  First, create a drawing for each graphic you plan to include in the menu.  Use the MSLIDE command to create a slide file (SLD) of the graphic. Tip: Fill the drawing screen with the graphic so it appears as large as possible in the image menu. Filled objects are displayed as frames in image menus, so limited the use of donuts and wide polylines.  Slide names should not include spaces or hyphens.

The name of my drawing is ANGLE_GATE_VALVE_WELDED_PLAN. Click HERE to download the drawing file.

After opening the drawing and using the Zoom Extents command to fill the screen with the valve, I type MSLIDE and press ENTER.  A file dialog appears.  The default name of the slide is the current drawing name.  Remember, image slides can not contain spaces or hyphens.  This is why I’ve used the name ANGLE_GATE_VALVE_WELDED_PLAN.

Now that I have the image for the menu, I need to create the menu file code.  The Visual LISP Editor included with AutoCAD can be used to create and modify menu files, as well, as AutoLISP files.  The Visual Lisp Editor is launched by selecting the menu path Tools > AutoLISP Visual LISP Editor.

***menugroup=symbols
***pop0
[Symbols]
[Fittings]

I’ve place the three above lines after the menu code for the menugroup and pop areas.  The first line defines the image menu section.  All the menu code that follows applies to image menus until another section is encountered.  ote: Sections begin with ***.  Since multiple image menus are allowed, each image menu must be named. **fittings is the name of my new image menu.  The next line defines the text that will be placed in the title bar of the image menu window.

***images
**fittings
[Fittings]
[ANGLE_GATE_VALVE_WELDED_PLAN]

In the fours lines of code above, I’ve added the name of the slide. Nothing will happen when the slide is selected because I haven’t defined action.

Before I can test my simple image menu, I need to complete the ***pop0 section to display the image menu.

***menugroup=symbols
***pop0
[Symbols]
[Fittings]$i=symbols.fittings $i=*

***images
**fittings
[Fittings]
[ANGLE_GATE_VALVE_WELDED_PLAN]

I’ve added $i=symbols.fittings $i=* to the [Fittings] menu item. The dollar sign symbol is a menu code that indicates that a submenu is being called.  Different menu sections used different letters to identify the section. Image menus use the letter i.  In the case of image menus, the submenu is first called and then the current image submenu is displayed. $i=symbols.fittings identifies the fittings image menu in the symbols menugroup as the submenu to display.  The $i=* code then displays the current image menu.

Remember, you'll need to load the menu and add the Symbols pull down to the menu bar before you try out the menu.




Ok, now I’ll create an action for the image menu item.

[fittings(ANGLE_GATE_VALVE_WELDED_PLAN)]^c^c-insert ANGLE_GATE_VALVE_WELDED_PLAN

^c^c-insert ANGLE_GATE_VALVE_WELDED_PLAN is the code to insert the drawing file ANGLE_GATE_VALVE_WELDED_PLAN. ^c^c executes two cancels to make sure no other commands are active.  -insert executes the insert command without a dialog box.

The slide name is used as the text in the left pane of the window.  A different text string can be used by adding a comma and the text following the slide name.

[fittings(ANGLE_GATE_VALVE_WELDED_PLAN,Gate Valve)]

In the line above ,Gate Valve has been added.

Slide Libraries

Slide Libraries can be used to efficiently manage the slides used for images.  The create a slide library you first must make a file containing a list of all the slides to be placed in the slide library.  The sld extension doesn’t need to be included.  I find it easiest to create the slide list in the same folder as the slides.  Tip: The output of the DOS command DIR can be redirected to a file to avoid typing all the slide names.  Go to the DOS prompt and change to the folder containing the slides.  Type DIR *.SLD /b > SLIDE.TXT and press ENTER.  The file SLIDE.TXT will contain a list of all the SLD files in the current folder.

Once a slide list is created, the SLIDELIB program is used to make the slide library.  I find is easiest to copy the SLIDELIB.EXE file to the folder with the slides and slide list file.  The SLIDELIB.EXE file is found in the Support folder of the AutoCAD program files.  The SLIDELIB.EXE is also a DOS command. To make a new library name NEWLIB type

slidelib newlib < slide.txt

at the DOS prompt.  The slides named in the SLIDE.TXT file will be included in the NEWLIB.SLBfile.  Note: SLIDELIB.EXE does not append or remove slides from a slide library.  Always keep the original slide files in a safe place.

I’ve found a simple way to automate the task of making slide libraries.  First, I copied the SLIDELIB.EXE file to a folder.  Then I created a file named MAKESLD.BAT in the same folder.  The MAKESLD.BAT file makes a file named slide.txt and then creates a slide library named NEWLIB using the slide list.  The MAKESLD.BATfile code is shown below.

dir *.sld /b > slide.txt
slidelib newlib < slide.txt

I then copy these two files into any folder with slides that I want to include in a slide library.  I double-click on the MAKESLD.BAT file in Explorer and rename the NEWLIB.SLB file.

Although simple, I hope this Tip Sheet helps you create Image menus. Keep in mind that the focus in this Tip Sheet was on the techniques specific to Image menus. As I mentioned, the action performed when a graphics is selected is typically the insertion of a drawing, but the action can be many things. Make sure the path to the drawings being inserted is correct. Note: Use / instead of \ to specify a path.