MicroStation Development Library
  • Programming Tips
  • Programming Examples
MDL, C++, MicroStationAPI

LA Solutions staff have written a number of technical articles. These include programming, MicroStation®, Bentley Map, GeoGraphics, and relational databases. Some articles describe aspects of MicroStation software development, and others provide code examples.

The MicroStation Development Library (MDL) was created for MicroStation V4 and continues to evolve. The MicroStationAPI provides an additional API for MicroStation V8i and MicroStation XM that helps developers build a native-code written using C++.

See our books page for information about books that may be interesting to MicroStation developers.

You may also find the BE Newsletter useful. It is published by Bentley Systems.


MicroStation® Development Library (MDL)

MDL is a versatile way of developing applications for MicroStation, and Bentley Systems use it themselves. It is an implementation of ANSI C, with many extensions to match its capabilities to MicroStation's complex feature set.

You can write a native code application using C++ that calls MDL functions, just as you might call Win32 API functions from C++ code. native code means that your source code is compiled using Visual C++ to the binary code of your computer's processor. native code contrasts with the interpreted code created by a pure MDL application. A native code application is implemented in a DLL.

The MicroStation SDK Readme document provides some useful information about MDL and MicroStationAPI.


MicroStationAPI

MicroStation XM and subsequent versions of MicroStation provide, in addition to MDL, the MicroStationAPI, which is a C++ library. The MicroStationAPI sits alongside MDL but requires C++ to build an application. You can build a project the traditional way, using a Bentley make file (bmake), or use Visual Studio.

The MicroStationAPI has separate documentation to the MDL help manual.

MicroStationAPI Documentation

You can continue to create an MDL application using just the developer tools provided with MicroStation. However, a more productive route is to use Microsoft Visual C++™ VC++ to create a DLL. Moreover, some APIs in the MDL are already deprecated because prefered methods are provided by the MicroStationAPI.

Your VC++ code can call MDL functions just as you can call Windows Win32 API functions. Real benefits of this approach are the VC++ IDE and debugger, the productivity gains of writing C++, and use of the Standard Template Library (STL). You must use Visual C++ to be able to use the MicroStationAPI library.

The MicroStation SDK Readme document provides some useful information about MDL and MicroStationAPI.


MicroStationAPI Article Index

MicroStationAPI Articles
Set View Title MicroStationAPI C++ Project: Set View Window Title Demonstrates the MicroStationAPI — source code available
Transient Geometry MicroStationAPI C++ Project: View Transients Demonstrates the MicroStationAPI — source code available

MDL and C++ Article Index

Examples of code written in C++ that call functions provided in the MicroStation Development Library. The code treats MDL as a platform, just as a Windows application written in C uses the Win32 API as a platform. This section does not cover the MicroStationAPI.

MDL and C++ Articles
Graphic Groups and C++ MDL Graphic Groups Page Contained in article
Localised Date, Currency, and Numbers MDL Locale How to format a data string in your country's style
Memory Management in MDL and C++ Native Code Memory Management Page Contained in article
Undo Grouping and C++ MDL Undo Group Page Contained in article
Template Class for type-safe User Preferences CUserPreferences<T> Template class
Using the C++ Templates with MDL Make use of C++ templates in your MDL code
Using the C++ Standard Library with MDL Make use of the C++ Standard Library in your MDL code
Visual Studio and MDL Using Visual C++ to build an MDL application DLL
Windows and MDL Set up your Windows environment to build an MDL application

MDL Article Index

Examples of code written in C that call functions provided in the MicroStation Development Library. This is MDL programming the traditional way — Bentley encourage you use C++ for projects designed for MicroStation XM and later.

MicroStation® Development Library (MDL) Articles
Title Article Location Sample Code
Custom Menus with MDL MDL Menus Page Contained in article
Database Linkages Explained Database Linkages Page
Dialog Manager API (all you need to know about access strings but were afraid to ask) Dialog Manager Page Contained in article
Examples Bentley Systems' Example Links
Element & Descriptors Element & Descriptors
ElementRefs ElementRefs
Files Open a DGN File as Read-Only
Levels and MDL MDL Levels Page Contained in article
Localised Date, Currency, and Numbers MDL Locale How to format a data string in your country's style
ListBoxes, ListModels, and Editors ListModels Page Contained in article
Locating Objects with MDL MDL Locate Page Contained in article
Measuring Objects with MDL MDL Measurements Page Contained in article
Message Center for Developers Message Center Page Contained in article
Migrating Dimension Code to MicroStation V8 Bentley Technote See also MDL Help Documentation
Open a File with Associated Application Associated Application Page
Process Fence Contents using mdlFence_xxx or Scan Functions Process Fence Contents
Search for an Element by its ID Scan for Element ID
SnapMode Find how to get and set the current MicroStation snap mode
Stroke an Element Convert an element to a line string or shape Stroke.zip
Typedefs, structs, and Compiler Errors The Compiler issues an error when I attempt to use an MDL structure
Text Elements and Char Types Multibyte, Wide, Unicode questions & answers
User Data Linkages Explained User Data Page
Windows and MDL Set up your Windows environment to build an MDL application
XML Code Generator for C  & MDL XML Struct Page XML Struct ZIP archive