Mbesendkeyin to automatically place view on Drwaing or sheet

Hello, I am using AECOsim SS5 to develop an annotation cell as part of DataGroup item, whose attributes in DataGroup Explorer would generate sheet index in Excel format.  I came across a challenge and was wondering if anyone knows of a suggestion. 

I wanted to apply a command line using MbeSendKeyin to get a particular task automated so that I can apply this to over 500 sheet files.  The line looks like this;

MbeSendKeyin "NamedView PlaceView ""xxxxx-xxx.dgn"" ""Design Model"" ""DV"" 0"

Currently, in order for the macro to continue to run, the line ""xxxxx-xxx.dgn"" must match the file name I have open.  I have tried using FileName, DgnFileName, or $FileName to no avail. I am looking for a syntax that would continue the command by knowing the file that is currently opened.  So far my batch process stops because it does not know the name of the next file that the batch process has opened.

  • Hi,

    I think your solution is not good. MicroStation BASIC was deprecated many years ago, so it's highly recommended to use it anymore, especially for new projects. You should use MicroStation VBA instead of it.

    I think the solution can be to create very short macro, which will check what design file and model are opened, will create a proper key-in and will send it using e.g. SendKeyin method.

    The macro itself can be called using Batch Process tool for all sheet files.

    Regards,

     Jan

  • I found a similar code and modified it to fit my needs.  Here is how,  

    Sub main

       Dim startPoint As MbePoint

       Dim point As MbePoint, point2 As MbePoint

       Dim filenaam As string

       Filenaam = MbeDgnInfo.DgnFileName

    '   Send a keyin that can be a command string

       MbeSendKeyin "NamedView PlaceView " & Chr$(34) & filenaam & Chr$(34) & " ""Design Model"" ""DV"" 0"

    '   When a command brings up a modal dialog,

    '   a later statement must close the dialog,

    '   or the MbeState.modalDialogByUser property

    '   should be set to 1 so that the user must close

    '   the dialog when the macro is executed.

    '   Also, you may not use the debugger "Step"

    '   commands while a modal dialog is displayed.

    '   Opened modal dialog "Create Drawing"

       MbeSendKeyin "MDL COMMAND CREATEDRAWING_CREATESHEET_OFF"

       MbeSendKeyin "MDL COMMAND CREATEDRAWING_DRAWINGEXTERNALFILE_ON"

       MbeSendKeyin "MDL COMMAND CREATEDRAWING_OPENMODEL_OFF"

    '   Closed modal dialog "Create Drawing"

    '   Following comment is the command to close a modal dialog

      MbeSendCommand "MBE1 CLOSEMODAL OK"

    End Sub

    Answer Verified By: Ken Shigemitsu 

  • Thanks Jan, I appreciate the suggestion.  I will look into using VBA for my future needs.  Best,

    Ken Shigemitsu