Working With Models


#define ANY_VIEW   (-1)
 This file contains the public functions that deal with "DgnModelRefP"s. More...

Detailed Description

Macro Definition Documentation

#define ANY_VIEW   (-1)

This file contains the public functions that deal with "DgnModelRefP"s.

DgnPlatform::DgnModelRef Discussion

MicroStation's referencing system (N.B. previous to V8's introduction of Models, this was referred to as "Reference Files") allows a "master" model to overlay, or "reference" other models in a readonly manner. A Reference from one model to another can include transforms and filters, to control the portion of the referenced model that is visible. The information about a Reference is saved persistently in a Model, in a Reference Attachment element.

When MicroStation loads a Model, it searches for its Reference Attachment elements, and creates a corresponding data object in memory to hold the information about the attachment. These objects are called DgnPlatform::DgnModelRef's and their lifetimes are controlled by the model from which they loaded. One of the members of a DgnPlatform::DgnModelRef is the name of the referenced model, and MicroStation will attempt to resolve that name by finding the file (in its native format - e.g. DGN or DWG, etc.) that contains it. If the file name is successfully resolved, MicroStation creates a DgnPlatform::DgnModel and loads the model. Note that the DgnPlatform::DgnModelRef exists whether or not the reference is successfully resolved. Also note that if more than one DgnPlatform::DgnModelRef references the same model, they will all reference the same DgnPlatform::DgnModel.

Application programmers reference DgnPlatform::DgnModelRefs via DgnModelRefPs by calling mdlDgnModelRef_ functions.

The macro ACTIVE_MODELREF can be used when referring to the active model. The value NULL is also interpreted as referring to the active model.

Iterating over References

The correct way to iterate over the references of a model is using the mdlModelRefIterator_ functions.

DgnModelRefP modelRef;
while (NULL != (modelRef = mdlModelRefIterator_getNext (iterator)))
// do something to each modelRef

NOTE: Views have a member that holds their root model. This is often a starting point for traversing models.

Copyright © 2017 Bentley Systems, Incorporated. All rights reserved.