Hello all,
We are using MicroStation CONNECT Edition Update 16.
We currently have a batch job written in MDL that needs to be converted to C#. It's a very simple job of attaching cell library to files specified in the command line argument.
I found this page:https://communities.bentley.com/products/microstation/w/microstation__wiki/8873/microstation-command-line-options-and-switches
Looks like I can use the -wa to start the C# add-in but I'm not seeing any way to pass along arguments for the add-ins (DGN file and cell library).
Thanks in advance,
Kevin
Kevin Ho said:Looks like I can use the -wa to start the C# add-in
That's termed an INIT_APP. The app. specified after -wa is in control of MicroStation's start-up process. You can alternatively specify a list of INIT_APPS in configuration variables MS_INITAPPS.
-wa
MS_INITAPPS
Here's a function that reveals how an AddIn was started...
private static void OnMasterFileStart(DgnFile dgnFile) { string s = null; switch (s_addIn.ApplicationType) { case MdlApplicationType.DesignApp: s = $"Opening DGN file '{dgnFile.GetFileName()}' as DGNAPP"; break; case MdlApplicationType.User: s = $"Opening DGN file '{dgnFile.GetFileName()}' as USER"; break; case MdlApplicationType.InitApp: s = $"Opening DGN file '{dgnFile.GetFileName()}' as INITAPP"; break; }
Register that function, perhaps in the Run method, with MicroStation using this statement...
Run
Session.Instance.OnMasterFileStart += OnMasterFileStart;
Kevin Ho said: I'm not seeing any way to pass along arguments for the add-ins
It's customary to pass arguments each prefixed with -i. Your AddIn is responsible for parsing the command line to extract those switch values.
-i
MicroStation.exe -waKevinsInitApp -iArg1 -iArg2 ...
Regards, Jon Summers LA Solutions
Answer Verified By: Kevin Ho