MicroStationAPI |
The MicroStation Development Library (MDL) and MicroStationAPI provide APIs for developers wanting to create custom applications for MicroStation® from Bentley Systems. We create a MicroStation application as a DLL, written using C++ and built with the Microsoft C++ compiler and linker provided with Visual Studio.
When editing your source code, you can choose whether to use Microsoft Visual Studio, Microsoft Visual Studio Code, or one of your favourite text editors.
When building your app, you can use Visual Studio or the Bentley Systems make (bmake) tools.
This article is for C++ developers who want to write an application for MicroStation CONNECT. It describes DGN element mensuration — a way to extract metrics such as length, area and volume.
This article clarifies the process of finding element metrics — length, area or volume —
using the c++ MicroStationAPI.
The MicroStationAPI is huge, and delivered in multiple header (*.h
, *.fdf
) files and
library (*.lib
) files.
It's documented in several help files …
The help files are not cross-referenced. Sometimes it's tricky to discover the connection between one part of the API and another. to a task that would otherwise be simple.
If you're writing a .NET AddIn for MicroStation, using the DgnPlatformNET API, then look at this article.
The MicroStationAPI abstracts element mensuration
to the unpublished MeasureGeomCollector
class.
Bentley Systems senior staffer
Brien Bastings
commented:
mdlMeasure_volumeProperties
, mdlMeasure_areaProperties
, and mdlMeasure_linearProperties
do exactly what you want and are just thin wrappers around MeasureGeomCollector
.
At some time, you probably want to show the results of mensuration to the MicroStation user. Bentley Systems provide several formatters documented in MicroStationAPI help. These formatters provide precise customisation possibilities of floating-point numbers and understand 1D, 2D and 3D quantities …
DistanceFormatter
class
AreaFormatter
class
VolumeFormatter
class
They each inherit from DoubleFormatterBase
.
Those formatters are simple to use: set your display preferences (e.g. decimal separator, thousands separator,
precision, units etc.), then call the ToString (double numberToFormat)
method …
#include <DgnPlatform/ValueFormat.h> double numberToFormat = 1234.456; DistanceFormatter formatter; // Initialised using active DGN model coordinate system ... modify formatter settings WString formattedResult = formatter.ToString (numberToFormat);
Post questions about C++ and the MicroStationAPI to the MicroStation Programming Forum.