Background:
Running MicroStation CE Update 17.2 (10.17.02.61)
A client has hundreds of files in ProjectWise that we would like to convert the Tag Sets to Item Types.
My plan was to run Batch Process against the list of .dgn files within ProjectWise. (This part is simple and works).
The Batch Process macro would call a VBA application that would convert the Tag Sets to Item Types.
There is a key-in that brings up the Upgrade Tag Sets dialog which is "dialog upgrade tag sets"
Issue:
The missing piece is I'm not able to check the "Select All" checkbox on the Upgrade Tag Sets dialog, nor can I click the "Upgrade" button.
What I tried:
The Upgrade Tag Sets dialog is a modal dialog, which means a simple key in without some additional code is not possible.
The typical way to deal with this in VBA is to create a class module and doing a macro record and promote to VBA does this for me:
(This code goes in a class. In my case: clsTagsToItemTypes
Option Explicit Implements IModalDialogEvents Private Sub IModalDialogEvents_OnDialogClosed(ByVal DialogBoxName As String, ByVal DialogResult As MsdDialogBoxResult) End Sub Private Sub IModalDialogEvents_OnDialogOpened(ByVal DialogBoxName As String, DialogResult As MsdDialogBoxResult) If DialogBoxName = "Upgrade Tag Sets" Then CadInputQueue.SendKeyin "ITEMTYPE DIALOG DESELECTALL " CadInputQueue.SendKeyin "ITEMTYPE DIALOG SELECT Upgraded Tag Sets" ' Remove the following line to let the user close the dialog box. DialogResult = msdDialogBoxResultOK End If ' Upgrade Tag Sets End Sub
The module code looks like this:
Option Explicit Sub Convert_Tags_to_ItemTypes() Dim modalHandler As New clsTagsToItemTypes AddModalDialogEventsHandler modalHandler ' The following statement opens modal dialog "Upgrade Tag Sets" CadInputQueue.SendKeyin "dialog upgrade tag sets shown" ' Send a keyin that can be a command string CadInputQueue.SendKeyin "MDL KEYIN Bentley.CustomProperties, Bentley.CustomProperties DIALOG ITEMTYPE TOGGLE" RemoveModalDialogEventsHandler modalHandler CommandState.StartDefaultCommand End Sub
The idea is that when the Upgrade Tag Sets dialog is loaded it calls the OnDialogOpened event inside of clsTagsToItemTypes. That code sets the necessary field and clicks the Upgrade button.
What happens is the code in the class is never called. I put a Breakpoint on the "If DialogBoxName = "Upgrade Tag Sets" Then" but we never hit that line of code.
It appears the Upgrade Tags Sets dialog does not initiate the modal Dialog event inside of MicroStation.
Questions:
1. If anyone sees that I'm doing something wrong I would appreciate knowing what it is.
2. If VBA won't work for this is there a way to call Upgrade Tag Sets directly within the C# Add-In (MDL) methodology.
There are VBA functions that deal with Item Types and I'm sure .NET functions that would deal with Item Types but not aware of a simple: Upgrade Tag Sets call.
Thanks for any, and all, help on this.
Mike