Original Article Date: Dec 1, 1998
A quick little article that explains MicroStation /J's configuration variable directives and how to use them to construct new variables.
1998-12-01 Originally published in The Client Server.
2006-03-02 Aquired and posted on AskInga.
MicroStation’s workspace capabilities allow you to easily customize your working environment to suit individual, project, site, organization or discipline-specific needs and specifications. Significant, powerful new functionality is included in MicroStation/J to make this process even easier. New configuration variable directives enable you to be very resourceful in the definition of your workspaces. By using these directives, you can now define your variables so they more readily rely on the definitions of other variables, including using bits and pieces of other variables to construct, or build ( ), a new configuration variable. This lets you to reduce the number of variables you need to define (or “hard-code”). With this new methodology, you can more efficiently redefine a multitude of variables in minor or major ways—simply by changing one variable.
If a configuration variable is set as follows:
MS_EXAMPLE = D:\Bentley\Workspace\MyProject\3dcells.cel
This directive: | Returns this information: | Using the above example: | Will result in: |
Dev( ) | Device | Test = ${dev {MS_EXAMPLE}} | Test=d: |
Dir( ) | Directory | Test = ${dir {MS_EXAMPLE}} | Test=\bentley\workspace\myproject\ |
Devdir( ) | Device and directory | Test = ${devdir {MS_EXAMPLE}} | Test=d:\bentley\workspace\myproject\ |
Parentdir( ) | Parent directory | Test = ${parentdir {MS_EXAMPLE}} | Test=\bentley\workspace\ |
Parentdevdir( ) | Device and parent directory | Test = ${parentdevdir {MS_EXAMPLE}} | Test=d:\bentley\workspace\ |
Basename( ) | Filename | Test = ${basename {MS_EXAMPLE}} | Test=3dcells |
Filename( ) | Filename with extension | Test = ${filename {MS_EXAMPLE}} | Test=3dcells.cel |
Ext( ) | File extension | Test = ${ext {MS_EXAMPLES}} | Test=.cel |
Noext( ) | Complete file specification minus extension | Test = ${noext {MS_EXAMPLES}} | Test=d:\bentley\workspace\myproject\3dcells |
If a configuration variable is set as follows:
MS_CELL = d:\cell\mycells\;c:\cell\;g:\mycells\
First( ) | First path from a list of paths | Test=$(first (MS_CELL)) | Test=d:\cell\mycells\ |
Concat( ) ♦ | Concatenated string | Test=$(concat (“my”, ”cell”)) | Test=mycell |
build( ) ♦♦ | Constructs a definition from pieces of variables etc... | Test=$(build (“c:”,parentdir(MS_EXAMPLE),”yourcells”, ext (first(MS_EXAMPLE)))) | Test=c:\Bentley\Workspace\yourcells.cel |
♦ The concat( ) directive allows you to stitch text together to populate your variable.
♦ ♦ The build( ) directive extends the abilities of concat( ) by providing the ability to stitch together text, as well as operate with the other variable directives as shown above in the examples. It will also try to resolve any missing directory separators:
test=$(build (“d:”, “mycells”) will give test=d:\mycells.
AskInga Article #287