Need help working from home with your Bentley software? We're here to help - click here
Did you know that you can include a MicroStation configuration variable (and then perform certain operations on those variables) in commands? For example, you can use:
$ model rename default $(basename(_DGNFILE))(that is a $ sign, then space, then model...) to rename the default model in your DGN file to the name of the file that you are in. What follows is how this works.
$ model rename default $(basename(_DGNFILE))
This is all straight MicroStation... no VBA required, although you can queue these sorts of commands in VBA macros if you want to. The $ at the beginning is a "shortcut" for "expand keyin", which is something that was introduced in MicroStation V8. What that does is "expand" anything in the key-in that references a configuration variable -- in this particular case, the $(basename(_DGNFILE)) part.
For the last part in that command, you might recognize _DGNFILE as the read-only configuration variable that contains your currently open file name, including extension, folder/path, etc. The basename(...) part is a variable definition reference. That particular reference "extracts" the filename without its extension. There are other references that can "extract" things (e.g. parent directory, filename with extension, etc.), those are documented in Help > Contents under "Configuration Variable File Syntax". Finally, the $(...) is what the "expand keyin" part operates on.
So basically, the $ at the beginning "tells" MicroStation's input processor to walk through the command line to see if there are any $(...) things included. Since there are, what is inside that is "expanded". In this particular case, basename(_DGNFILE) "returns" just your filename (without the extension), which is then substituted for that part of the command and voila, you have what you are looking for.
Set temporary variables with the Expand Set keyinReport your variables with Expand Echo keyinHow to set _WORKDIR=_ DGNDIR after starting MicroStation