Original Article Date: April 19, 2001
There's still more to learn! This article which is Part 3 of a series about barmenus, takes a look at how to load macros, MDLs and UCMs.
Although the tricks are flowing now, there's still more to learn! Keep reading and I'll show you how we can load macros, MDLs and UCMs from the barmenu. To cap all this off - we're going to look at how we can organize our barmenus better by creating multiple MDF files that can be loaded from each menu.Load 'em on:In Part 1 and 2, we learned the basis of barmenus and established how to get them up and running. The next step is to add another layer of functionality - that is - the ability to load utilities directly from the barmenu. As you've probably already worked out, the MDF file uses normal MicroStation keyins such as LV=, LC=, and so on. Well, when it comes to loading utilities the arrangement is very similar. Have a look at the snip of an MDF file below:
As you can see, the basic structure is the same...the only differnce is that we've added the MicroStation keyin that's required to load a specific utility.This information can be added to the MDF file at any stage, however, it's a good idea to have the level definitions first followed by the extra functions at the end. Another thing to remember is that you can get quite clever and also add additional functionality to the level sections of the MDF file.For example, instead of using the line LV=59 REVISION CLOUDS, "LV=59;CO=3" to set our parameters for revision clouds, we could just as easily use a user command at this menu item: LV=59 REVISION CLOUDS, "UC=REV.UCM"The Big Switch:Right. Once you've added various menu items to your barmenu, you'll notice a bit of a problem start to emerge. With all of these extra menu items and sub-menus being added, the length of the barmenu file may become unmanageable. What can we do about it...? Well, as they say in The Hitchhikers Guide to the Galaxy..."DON'T PANIC!".To make the barmenu a wee bit smaller and neater in appearance, we set up a MAIN MDF file that will allow access to individual MDFs for the Civil, Structural and Mechanical menu items.
Again, the syntax for this MDF file is the same as before except that we've introduced a new variable:
For example, this string: MDL UNLOAD BARMENU; MDL LOAD BARMENU d:\workspace\standards\menus\civil.mdf is used to unload the barmenu MDL and reload it with a new MDF. Note that in each case we must put in the full path and name of the MDF file. Failure to do this will cause barmenu.ma to exit.Another thing to watch for is that if we leave the MicroStation session and re-enter it later, it's the MAIN file that is being loaded first. (You may remember that we looked at defining a configuration variable to control this in Fly with Barmenus - Part 1 of this series.)
If you were to test your new MDF file at this point, you'll notice that once you unload MAIN to access one of the other discipline specific MDF's (Civil, Mechanical or Structural), you won't be able to go back to MAIN. Although this appears to be a problem - it's realy very easy to correct! All you need to do is add and slightly edit the same commands from MAIN to the discipline specific MDFs. For example...the lines added to the Civil MDF file are shown below...notice that the links to the Civil MDF file has been swapped for a link back the MAIN!
The results of adding these lines will be evident as soon as you test your new menu!
AskInga Article #67