You are currently reviewing an older revision of this page.
Document Type: TechNote Product(s): MicroStation Version(s): V8 Original Author: Bentley Technical Support Group
Document Type: TechNote
Product(s): MicroStation
Version(s): V8
Original Author: Bentley Technical Support Group
While the ultimate decision between the MDL and MicroStation BASIC programming environments will depend on the specific situation, what follows are some general "rules of thumb" to assist MicroStation application developers and users in determining which development tool is appropriate for a given job. Generally speaking, MDL is better suited for professional application development, whereas MicroStation BASIC caters more to user customizations. Given that there are "gray areas" that might be satisfied by either solution and there currently is (and will continue to be) some overlap between MicroStation BASIC and MDL, MicroStation BASIC is not going to "replace" MDL as the recommended tool to use to develop professional level applications.
You can compare the two environments in three contexts:
Almost all MicroStation functionality is packaged up as a series of one or more commands. MDL application developers program directly against MicroStation as a first step. After they have written their application-specific functions, they must then package them in the form of commands. (The MDL Programmer's Guide has a section devoted to the creation of command tables and associating commands with functions.) The main benefit of commands is that they allow a third-party MDL program to "fit in" and function seamlessly with the overall command processing state machine of MicroStation. The commands defined by MDL programmers are actually a valuable resource to MicroStation BASIC programmers. In fact, commands could almost be viewed as "built-in" functions by MicroStation BASIC programmers. All commands, be they defined by core MicroStation or third-party application developers, can be initiated and controlled from a MicroStation BASIC program.
Conversely, most of MicroStation BASIC's DGN object processing intelligence is packaged into a handful of objects (that is, MbeElement, MbeDgnInfo) with many methods (routines) being added on a regular basis. Furthermore, these MicroStation BASIC extensions are designed for interpreting and manipulating existing objects, not so much for generating new ones. In fact, there is no intrinsic MicroStation BASIC function or method for creating new objects. Instead, the MicroStation BASIC programmer must find an existing MicroStation or third-party application command that generates the desired objects and then "drive" that command from MicroStation BASIC. The MbeSendCommand MicroStation BASIC extension is used to launch a command. For example, this line of MicroStation BASIC code:
MbeSendCommand "PLACE LINE"
launches the internal MicroStation command to place a line. After starting the command, the MicroStation BASIC macro can then begin sequencing datapoints to the command, defining the end points of one or more line segments. For example:
‘ Coordinates are in master units startPoint.x = 496.386626# startPoint.y = 504.899972# startPoint.z = 2614.709421# ‘ Send a data point to the current command MbeSendDataPoint startPoint, 1%
Because you can drive MicroStation commands from a MicroStation BASIC program, you can create a variety of time-saving utilities. In the example above, a very complex series of line segments can be produced programmatically with little or no user input, whereas creating the same result manually might take many minutes of painstaking precision input.
The same effect can be achieved by using MDL, but many users don't have the C programming background necessary to do that. The learning curve represented by mastering the MDL development environment (learning C, mastering the compiler, linker, make files, command tables, dialog box definitions, etc.) can certainly be intimidating. In fact, one of the driving forces behind MicroStation BASIC was the often-heard request for a simpler way to implement quick and easy programs to allow simple modifications to designs.
MicroStation BASIC offers a number of extensions to the BASIC language for standard dialog formations and input collection. Some of these extensions include MbeMessageBox, MbeInputBox and MbeSelectBox. For the non-standard job, it is also possible to create custom dialogs in MicroStation BASIC. Keep in mind that with all dialog boxes displayed from MicroStation BASIC, there are limitations-all dialogs displayed in MicroStation BASIC are modal (they must be displayed, manipulated and dismissed before any other processing in MicroStation can take place) and only a subset of all dialog items are supported in MicroStation BASIC.
In MDL, on the other hand, you can create modal and modeless dialog boxes with fairly complex behavior. To see an example of "complex behavior" in a dialog box, run MicroStation and bring up the Modify Color dialog (invoke the Settings>ColorTable menu item, then double-click on any color). Click and drag around in the brightly colored "rainbow box." Note how the other items dynamically change to conform to the mouse movements. That shows the use of both generic items and asynchronous processing that would be impossible to emulate in a MicroStation BASIC custom dialog box.
Both MDL and MicroStation BASIC allow for the creation of a binary executable file (which can only be executed from within MicroStation). In the case of MDL, the application file has an .ma extension, and in MicroStation BASIC, a .ba extension. (Note: .ba files are automatically created in MicroStation-no external compilation is necessary, as with MDL.) The .ba file offers one level of flexibility not found in the MDL program; compiled MicroStation BASIC programs are binary portable to all MicroStation platforms.
Product TechNotes and FAQs
SELECTsupport TechNotes and FAQs - old
Bentley LEARN Server
Bentley's Technical Support Group requests that you please confine any comments you have on this Wiki entry to this "Comments or Corrections?" section. THANK YOU!