I know this is an old post but, I came across the source code for msmtools.ma from the 1998 Microstation online MDL Corner article.
I am in the process of updating the code to use level names. Programming is not my primary job function nor is mdl a language I am well versed in so it may be a while before I get a working app.
I thought I would post the unmodified code up for others who are more experienced with mdl, so that maybe they can come up with a more elegant solution.