Learning MicroStation VBA

Interacting with MDL Applications

Let's record a macro where we import an image using the MicroStation menu File > Import > Image. Browse to C:\Program Files\Bentley\MicroStation\bentleyb.jpg and place it in MicroStation. After the image is placed, stop recording the macro.

Before we look at the macro that was created, we should discuss the two methods of interacting with MDL Applications. The first method looks like our previous use of the "SendCommand" method where, after the command begins, we can supply points or other input as needed. The second method, using dialog boxes, requires a class module that handles the events of the dialog box.

The Import Image MDL application makes use of a dialog box so a new class is created that is used with the recorded macro. Let's begin by looking at the recorded macro. After we do, this we will look at the class module created by the macro recorder.

Sub <b class="bold">Macro5</b>()    Dim startPoint As Point3d    Dim point As Point3d, point2 As Point3d    Dim lngTemp As Long    Dim modalHandler As New Macro5ModalHandler    AddModalDialogEventsHandler modalHandler   '   The following statement opens modal dialog "Select Image File"   '   Start a command    CadInputQueue.SendCommand "MDL LOAD PLAIMAGE"   '   Coordinates are in master units    startPoint.X = -6.270784    startPoint.Y = 23.160278    startPoint.Z =...

UNLIMITED FREE
ACCESS
TO THE WORLD'S BEST IDEAS

SUBMIT
Already a GlobalSpec user? Log in.

This is embarrasing...

An error occurred while processing the form. Please try again in a few minutes.

Customize Your GlobalSpec Experience

Category: Low Light Cameras
Finish!
Privacy Policy

This is embarrasing...

An error occurred while processing the form. Please try again in a few minutes.