I am working on our company configuration and looking at -debug files is making my eyes cross.
I would like to write a VBA project to help me analyze variables, but I'm not sure if I can do what I want. I'd like some suggestions for a direction.
For instance, I might like to redefine _USTN_HOMEPREFS but I have no easy way of finding all the places _USTN_HOMEPREFS is used. I don't want the expansion, I want to know the names of other variables that are defined using _USTN_HOMEPREFS.
Or I'd like to look at MS_DEF and see a listing of the files and variables that process through to the current configuration. Some kind of single variable debug; the final expansion value is great, but I'd rather know how we got there.
Or even a VBA that could sort through the -debug text file so I could isolate all mentions of a single variable. This may be the easiest...Go through the debug, line by line. If the variable is mentioned in that line, copy the whole line to a text file and move to the next line.
I currently have OpenRoads Designer 2020 R3 (V. 10.9.0.91) I am limited to VBA by my distinct lack of programming ability.
Thank you.MaryB
Hi MaryB,
Yes its possible to create a project where you could select either a debug file or multiple CFG files and basic perform string operations on their contents however, from what you have mentioned by looking to track down instances of the variables, I would suggest to you a far simpler and more powerful solution:
I personally don't have any issues with tracking down variables usage as I leave the Standards.cfg in its delivered state and have 7 different CFG files of my own (also seen in the above image) where I have variables organised and processed in a specific order which makes for an easy to manage system, however Notepad++ being such a good text editor, makes the job so much easier than trying to do the same task in Notepad.
MaryB said:I would like to write a VBA project to help me analyze variables
Here are a couple of articles that may be useful...
Regards, Jon Summers LA Solutions
Hi Mary,
MaryB said:I would like to write a VBA project to help me analyze variables, but I'm not sure if I can do what I want. I'd like some suggestions for a direction.
Hmmmm ... it depends on
... and, unfortunately, VBA is not the best tool for some operations.
MaryB said:For instance, I might like to redefine _USTN_HOMEPREFS but I have no easy way of finding all the places _USTN_HOMEPREFS is used.
That's good question, but it's not possible. The problem is that MicroStation knows the variable definition, but it does not know "steps before". A simple example:
Because of that, it's possible to find "direct impacts" of the variable change, but not (in a simple way) to find further impacts..
A workaround can be similar to what Barry Lothian wrote:
MaryB said:Or I'd like to look at MS_DEF and see a listing of the files and variables that process through to the current configuration.
To go through msdebug.txt is the only option I guess.
MaryB said:Or even a VBA that could sort through the -debug text file so I could isolate all mentions of a single variable. This may be the easiest.
As I wrote above, I think it's not the easiest (because it's not simple), but it's the only way, because MicroStation (during a session) does not know how workspace configuration was processed. Even when in C++ API (and maybe also in NET) there is ConfigurationManager API available, it also does not provide complete information.
But, VBA is not in my opinion the right tool to write such tool, because of very limited string parsing and other missing advanced features. Something like C# is probably better tool to analyze msdebug.txt (or, even better, to analyze all cfg files directly ;-)
Regards,
Jan
Bentley Accredited Developer: iTwin Platform - AssociateLabyrinth Technology | dev.notes() | cad.point