This Client Server article is republished in its entirety from 2002 for reference purposes.
By Bentley Technical Support Group30 April 2002
Have you ever noticed how the Examples workspace (the sample Workspace installed with MicroStation V8) is organized with several projects under the single Examples folder i.e. ..\Bentley\Workspace\projects\examples? In the MicroStation Manager when you select the Examples User, you have access to Projects such as Civil, General, Mapping, etc. If you have ever tried to recreate this setup with the User > New and Project > New options in the MicroStation Manager, you probably learned very quickly that this is not a straightforward process.
It is natural to wonder why a user would want to organize the Workspace. Suppose you have several departments working on a single job. Now, suppose you want to segregate each department into their own folder or subdirectory-not an unreasonable idea. But how does one do that? More importantly, what steps are required to programmatically automate this function?
In the past you may have tried developing a utility like this using MDL or MicroStation BASIC. Why? Because you would need access to configuration information only found in the MicroStation design environment. For instance, Workspace variables can only be accessed from within MicroStation, which limits the usefulness of other programming environments (VB, C, C++, etc.)
One of the exciting aspects of MicroStation V8 is the new Microsoft Visual Basic for Applications (VBA) programming environment. Microsoft's Visual Basic Editor is a great place to design a interactive utility to organize the MicroStation Workspace.
The goal of this example is to create a simple, user-friendly program to create a new Workspace based, on a new User and User-specific Projects, similar to the sample Examples Workspace. A Workspace is nothing more than a set of predefined directories and configuration files containing configuration variable definitions. The trick is in knowing what configuration variables and where to put the configuration files.
In a typical Workspace configuration there is a User, a Project and an Interface that can be selected from the MicroStation Manager. The interface is not a consideration for the Workspace Wizard utility, but it can be modified to incorporate Interface configuration variables. The User (.ucf) specifies configuration variables to be set at the User level (highest precedence). Common variables set at the User level are contained within the ..\Bentley\Workspace\Users\untitled.ucf, which is used as a template for a new User.
The Project(.pcf) specifies configuration variables to be set at the Project level (second highest precedence). Common variables set at the Project level are contained within the ..\Bentley\Workspace\Projects\untitled.pcf, which is used as a template for a new Project.
Have you ever noticed that, when you create a new User in the MicroStation Manager you are prompted to select a Project? However, what if that Project doesn't exist yet? On the other hand, you can create a new Project, but it is not tied to a given User (it falls under the default or root project directory). The situation seems like a classic chicken-or-the-egg quandary. To organize your workspace similar to Examples, it is necessary to manually create the initial directory in the Windows Explorer and then create the initial Project (.pcf). Then from the MicroStation Manager, create a new User, which gives you the option to select this existing Project. By doing so you can create new projects that will only be seen when your User is selected in the MicroStation Manager.
The Workspace Wizard utility described in this article-and available for download at MSM Online at SELECTservices, will automate this procedure by creating the directories, files and configuration variables to function as the Examples sample Workspace. In addition, you choose the location of the Projects. The Workspace Wizard may not fit the workflow in your office, but it demonstrates useful operations in the use of MicroStation V8 VBA, such as retrieving and setting the value of a MicroStation configuration variable.
The Workspace Wizard utility is simple to use. Place the wswizard.mvba file into the ..\Bentley\Workspace\Standards\vba directory of your MicroStation V8 installation. The key-ins to execute the Workspace Wizard are:
Vba load wswizardVba run [wswizard] startwizard
The initial screen will prompt you for a name of a new User: Once you've entered a name, select Next. The next screen will prompt you to create new Projects and choose the location of the Projects. The default location is defined by the _USTN_PROJECTSROOT configuration variable, otherwise key-in or browse the desired directory.
Once finished, close the current DGN. Doing so causes the MicroStation Manager to open. Select the User just created and view all the new Projects.
There were many options considered during the programming of the Workspace Wizard. The major consideration was the MicroStation V8 workspace, determining which configuration variables to use and how the project subdirectories were created. Here are the MicroStation configuration variables used in the Workspace Wizard:
USTN_USER: The location of the User configuration files (.ucf)USTN_PROJECT: The location of the Project configuration files (.pcf)USTN_PROJECTSROOT: The default Project directory, i.e.,..\Bentley\Workspace\ProjectsUSTN_PROJECTNAME: The name of the last project openedUSTN_PROJECTSUBDIRS: The variable that stores the listof Project subdirectories to be created, i.e., cell;data;dgn;out;seed;symb;dgnlibAnother consideration in writing the utility was the thought flow of the program. The decision was to make the utility as intuitive and user friendly as possible by incorporating features such as mnemonics. In addition, the utility program can be stopped at any point; no directories or files are created until the Finish button is selected. If you press the Back button on the second dialog, when you return, you'll notice all of the text fields and the contents of the list box are cleared. If you want to extend the Workspace Wizard's functionality, append each Project's DGN directory to MS_RFDIR in the User configuration file (.ucf):
MS_RFDIR>$(_USTN_PROJECT) ezpass/dgn/MS_RFDIR>$(_USTN_PROJECT) profiles/dgn/MS_RFDIR>$(_USTN_PROJECT) sections/dgn/MS_RFDIR>$(_USTN_PROJECT) tollbooth/dgn/
Client Server Archive
MicroStation Desktop TechNotes and FAQs
Bentley's Technical Support Group requests that you please confine any comments you have on this Wiki entry to this "Comments or Corrections?" section. THANK YOU!