ElementID

Hello to all you VBA Masters.

I am an old MicroStation dog trying to learn some new tricks, without any formal training. Needless to say, I have lots of questions, but I'll start with this...

I've been experimenting with MVBA in XM to scan for, & extract data from, dgn model file elements to ascii. Does anyone know the purpose of the ElementID having a High and a Low attribute? It seems that the High is always set to 0 & the Low has the actual ID Value, such as what shows in a Element Information query. Does the High ever come into play?

Thanks in advance...

  • Element ID: 64-bit integer

    An Element ID is a 64-bit integer. However, VBA is derived from Visual Basic 5½ (VB), and in the days when Microsoft developed VB, 64-bit integers were a futuristic dream. In other words, VB/VBA doesn't support 64-bit integers and hence doesn't support Element IDs.

    When Bentley Systems developed MicroStation V8 and adopted VBA they were faced with a problem: they, and the C++ compilers they use, know about 64-bit integers. Element IDs are handled by C++, MicroStation, and Windows (all versions — not just the 64-bit versions). To enable MicroStation VBA to work with Element IDs, Bentley Systems created the DLong user-defined-type (UDT in VB terminology).

    A DLong contains two 32-bit integers, High and Low. Together, they provide a 64-bit container. When you look inside an Element ID it is rare, but not impossible, to find data in the High member as well as the Low of that UDT.

    As a developer, you should treat the Element ID as if it were a 64-bit integer, and forget that you discovered that a DLong is really a UDT. VBA provides functions that operate on DLongs. In your case, when writing data to a text file, then function DLongToString will be useful.

    Regards, Jon Summers
    LA Solutions

     
    Regards, Jon Summers
    LA Solutions