Here are answers to questions about MicroStation® MDL data structures that are posted from time to time on the Be Communities MicroStation Programming Forums. The questions are posted by developers using the MDL and MicroStationAPI Software Developer Kits.
Q
DPoint3D? DVec3D? DPoint3D? A
The DPoint3D is one of the fundamental data types used in MicroStation programming
using the MicroStation Development Library (MDL).
It is used extensively to hold a 3D data point.
Frequently you will use an array of data points that represent, for example, a vector in 3D space.
A
The DVec3D was introduced with MicroStation V8i.
It is one of the fundamental data types used in MicroStation programming
using the MicroStation Development Library (MDL).
It is used to store a 3D vector.
A DVec3d is a vector in the mathematical sense of a directed line.
The DPoint3D is one of the fundamental data types used in MicroStation programming
using the MicroStation Development Library (MDL).
DPoint3D is a C-language struct that
is defined in the MDL header (*.h) files.
You will find those header files in the MicroStation installation directory after you have installed the
Software Development Kit (SDK).
The header folder by default is …\MicroStation\mdl\include.
There is a similar data type DPoint2D, which is seldom needed.
A DPoint3D has three data members: x, y and z.
Each is a double-precision floating-point number (C double).
As a struct, the member variables of a DPoint3D are public:
you can read and write them directly …
DPoint3d point; point.x = 1.234; point.y = 2.345; point.z = 3.456;
MDL provides many ways to manipulate a DPoint3d point or vector.
The following function families are useful …
It's common to create a C array of DPoint3d …
#include <msdefs.h> DPoint3d points [MAX_VERTICES];
If you're writing C++, then you can create a std::vector of DPoint3d …
#include <vector> std::vector<DPoint3d> points;
There's more about MDL and the C++ Standard Library.
The DVec3d is one of the fundamental data types used in MicroStation programming
using the MicroStation Development Library (MDL).
MicroStation V8i distinguishes between a 3D point, represented by a DPoint3d,
and a 3D vector, represented by a DVec3d.
From the programming point of view, their data members (x, y and z) are the same.
However, they are two different C typedefs and your C or C++ compiler may complain when you use
a DVec3d in place of a DPoint3d and vice versa.
Many of the functions listed above that take a DPoint3d accept a DVec3d.
Here's a function to print the data members of a DPoint3d …
void PrintDPoint3d (DPoint3d const* point, DgnModelRefP modelRef)
{
char msg [128];
const double UORs = 1.0 / mdlModelRef_getUorPerMaster (modelRef);
sprintf (msg, "point: %.2lf,%.2lf,%.2lf",
point->x * UORs, point->y * UORs, point->z * UORs);
// Turn on DEBUG in Message Center options to see this message
mdlOutput_messageCenter (MESSAGE_DEBUG, msg, msg, FALSE);
}
Example call …
DPoint3d points [2];
... get points from line
PrintDPoint3d (points + 0);
PrintDPoint3d (points + 1);
Return to MDL articles index.