How to load a custom UCF at startup of Microstation CE/OpenCities Map application.

Hello everyone, I have a question regarding loading custom UCF file during the startup of Microstation CE application(and also OpenCitiesMap/Advanced, OpenCities Map Ultimate).

Back in the days of V8I, there was an option to launch the Microstation with my own UCF file using the command line switch ws_USTN_USERCFG="myFile.cfg"... I made some investigation on this approach in this CE world and found out following :

  • _USTN_USERCFG is not usable anymore (because it was locked and I cannot change its value.. or is there a way?)
  • Custom configuration, preference files etc. are now stored in LOCKED position (i mean, I found out you can change the position of your prefs folder, however .ucf file is not affected by that)
  • Every program - Microstation, OpenCities Map, OpenCities Map Advanced, OpenCities Map Ultimate has its own prefs folder with files I mentioned before.

My question is, how did you guys solve the situation to launch a given application but with your own UCF file? I mean, I was thinking about copying my files into the prefs folder and name them Personal, but that means my configuration will replace everything and maybe sometimes I want to use it without it. Then another problem is that every product has its own folder path, so basically I have to copy my UCF into the correct folder depending on the installed version (and then I also though about what would happen if the directory path changes with some new updates[right now its in Microstation\10.0.0\prefs] - another trouble!).

Or is there a better and easier way to achieve loading selected UCF during the startup?

Thanks for any suggestions.

  • the fact that the MSLOCAL file needs to be included in your custom configuration file is the whole problem.

    If Bentley would fix/change this then this whole situation would not be needed.

    Timothy Hickman

    CADD Manager | CADD Department

    timothy.hickman@colliersengineering.com

    Main: 877 627 3772| 

    1000 Waterview Drive Suite 201 | Hamilton, New Jersey 08691

  • Hello Marc, thanks for your input!

    I found a way to retrieve the path to the product/config/ folder (from registry!). This way, i can refer to the correct mslocal.cfg with my own .cfg file. I was just wondering, if there exists some kind of variable, that is available to me in my own .cfg, that references the directory of the application that is being called (for example MapAdvanced.exe directory etc.). All these paths are defined only after including mslocal.cfg. And I wanted them before the include.

    I like this setup more over your ConfigurationSetup.cfg, because I can save my .cfg file whenever I want without modifying multiple files on host machine (just like back in the days of V8I, with possibility to attach our own UCF file). But to be honest, I´m glad you suggested this approach as well, as I didnt know about it before. Now i have another option available, so thank you.

  • Hi Lubo,

    The file where a custom configuration is best defined is "C:\ProgramData\Bentley\<applicationName>\Configuration\ConfigurationSetup.cfg"

    You can also define additional statements in the General section of that file, for example:

    _USTN_WORKSPACENAME = MyWorkSpace
    %lock _USTN_WORKSPACENAME
    _USTN_WORKSETNAME = MyWorkSet
    %lock _USTN_WORKSETNAME

    Which would pre-set WorkSpace and WorkSet.

    ConfigurationSetup.cfg is the recommended point at which to start configuration; we do not recommend modifying mslocal.cfg or any other system CFG files.

    I will discuss your question with a colleague from the OpenCities product team.

    Regards

    Marc

  • Hello, sorry for late response. I found quite a workaround, with macro USTN_WORKSPACEROOT and defining my own Workspaces/NoWorkSpace/NoWorkSet.cfg. It is working the way I want, but it is probably not the right way to do that. 

    You might be right, including the mslocal.cfg might be the thing im missing.

    However, is it possible to use also some kind of generic way to include the proper mslocal.cfg ? In case of different applications (OpenCities Map Advances, PowerView, Ultimate...), they all have different folder structures and places where these mslocals are stored.

    Edit: I have tried it and it works, after i included mslocal (with fixed path). Thanks! The remaining subquestion remains though, to retrieve the path of exe that is executed, so i know where to look for mslocal no matter which application is being called. 

    Edit2: Basically the directories are defined AFTER mslocal.cfg is included, like the path where configuration files are stored