Here are answers to questions about MicroStation® Levels that are posted from time to time on the Bentley Discussion Groups. The questions are posted mostly by MDL and VBA developers.
Q What the user sees and what the MDL (or VBA) developer knows are different things. The difference can lead to confusion and prompt question similar to these …
A There are three pieces of information about a level: its name, code, and number. The user (or CAD Administrator) assigns the level name and level code. MicroStation assigns internally a number — the Level ID — to each level; the ID is not exposed to the user.
mdlElement_getProperties().
The internal ID is not exposed to the user: you will only ever see it as a VBA or MDL developer
The internal ID of a given level name is consistent within a DGN file, but is likely to be different in another DGN file
mdlLevel_getCode()
As an MDL or VBA developer, we work with level IDs, and must be aware that the level ID of a given name in one file is probably different to the level ID of that level name in another file. For example, if you are working with reference files, the ID of level 'Named MicroStation may assign a different Level ID to a named level in one DGN file compared to another DGN file. Level' in the active model is going to be different to the level ID of 'Named Level' in an attached model stored in a different DGN.
| Function | Purpose |
|---|---|
mdlLevel_getName() | Level name from the Level ID |
mdlLevel_getCode() | Level code from the Level ID |
mdlLevel_getIdFromCode() | Level ID from a user-assigned level code |
mdlLevel_getIdFromName() | Level ID from a user-assigned level name |
Q What about Levels 1 63 from MicroStation/J?
A The Level ID is assigned internally by MicroStation, and you can't control it. You can assign level codes 1…63. However, if you convert a V7 file to V8 you will find that those level numbers are created automatically by MicroStation.
Return to MDL articles index.