Namespaces | Typedefs | Functions
DgnModel Functions

Gets the active ModelRef. More...

Namespaces

 Bentley
 The Bentley namespace contains types defined by the Bentley Library.
 

Typedefs

typedef int(* PFDgnLibIterateCallback )(DgnModelP model, CallbackArgP callbackArg)
 UserFunction called to process files in MS_DGNLIBLIST. More...
 

Functions

StatusInt mdlDgnLib_iterate (PFDgnLibIterateCallback pCallbackFunc, CallbackArgP pCallbackArg, MstnPlatform::DgnLibSelector dgnLibSelector)
 Process the DgnLibs specifed in the specified DgnLibSelector (or combination of DgnLibSelectors). More...
 
void mdlDgnLib_dumpAll (WCharCP prefixMessage)
 Dump to console all the files currently open because they are listed in the MS_DGNLIBLIST configuration variable. More...
 
bool mdlModelRef_inMasterFile (DgnModelRefP modelRef)
 Determines whether the specified modelRef is contained in the master file. More...
 
bool mdlModelRef_isActiveModel (DgnModelRefCP modelRef)
 Determines whether the specified modelRef is the active model. More...
 
bool mdlModelRef_isReference (DgnModelRefCP modelRef)
 Determines whether the specified modelRef is a reference model. More...
 
DgnModelRefP mdlModelRef_getParent (DgnModelRefCP modelRef)
 Gets the DgnModelRefP for the model that is the parent of the specified modelRef. More...
 
bool mdlModelRef_isNestedReference (DgnModelRefP modelRef)
 Determines whether the specified reference model is attached to another reference model. More...
 
bool mdlModelRef_isReadOnly (DgnModelRefP modelRef)
 Determines whether a modelRef is read-only. More...
 
bool mdlModelRef_areSame (DgnModelRefP modelRef1, DgnModelRefP modelRef2)
 Determines whether two specified modelRefs are actually the same. More...
 
StatusInt mdlModelRef_getFileName (DgnModelRefP modelRef, WCharP fileName, int fileNameBufSize)
 Gets the name of the file that contains the data for the specified model. More...
 
bool mdlModelRef_isDisplayedInView (DgnModelRefP modelRef, int viewIndex)
 Determines whether the specified DgnPlatform::DgnModelRef is displayed in the specified view. More...
 
int mdlModelRef_getViewMask (DgnModelRefP modelRef)
 Gets a bitmask representing the views that display the specified modelRef. More...
 
StatusInt mdlModelRef_deleteModel (DgnModelRefP modelRef, bool deleteElements)
 Deletes the specified model from the file that contains it. More...
 
StatusInt mdlModelRef_activateAndDisplay (DgnModelRefP newModelRef)
 Activates and displays the specified modelRef. More...
 
StatusInt mdlModelRef_createWorking (DgnModelRefP *dgnModelRefP, DgnFileP dgnFileP, DgnPlatform::ModelId modelID, bool fillCache, bool loadRefs)
 Creates a "working" DgnModelRefP that can be passed to functions that take DgnModelRefP arguments. More...
 
StatusInt mdlModelRef_createCacheSpecificWorking (DgnModelRefP *dgnModelRefP, DgnFileP dgnFileP, DgnPlatform::ModelId modelID, bool fillCache, bool loadRefs, bool includeUndisplayedRefs, DgnPlatform::DgnModelSections sectionsToFill)
 Creates a "working" DgnModelRefP containing the specified cache sections that can be passed to functions that take DgnModelRefP arguments. More...
 
StatusInt mdlModelRef_createWorkingByName (DgnModelRefP *dgnModelRefP, DgnFileP dgnFileP, const WChar *modelNameP, bool fillCache, bool loadRefs)
 Creates a "working" DgnModelRefP that can be passed to functions that take DgnModelRefP arguments. More...
 
StatusInt mdlModelRef_freeWorking (DgnModelRefP modelRef)
 Frees modelRef's created using mdlModelRef_createWorking or mdlModelRef_createWorkingByName. More...
 
void mdlModelRef_setDefaultBackgroundColor (DgnModelRefP modelRefP)
 Sets the model background color to the default value for that model type. More...
 
StatusInt mdlModelRef_checkAllRightsIfDisplayed (DgnModelRefP modelRef, UInt32 rights, int view, MessageDestination displayError)
 Check if the specified rights are granted to the current user for the given model and all references that are displayed in the selected view(s). More...
 
StatusInt mdlModelRef_checkAllRights (DgnModelRefP modelRef, UInt32 rights, MessageDestination displayError)
 Check if the specified rights are granted to the current user for the given model and all references. More...
 
StatusInt mdlModelRef_checkAllRightsIncludingProtectedRefs (DgnModelRefP modelRef, UInt32 rights, MessageDestination displayError)
 Check if the specified rights are granted to the current user for the given model and all references, including the references that could not be opened because the user lacked viewing access. More...
 
StatusInt mdlModelRef_copyModel (DgnModelRefP *returnDestModelRef, DgnModelRefP sourceModelRef, DgnFileP destFile, const WChar *pDestModelName, const WChar *pDestModelDescr)
 Copy a model from one location to another. More...
 
DgnModelP mdlModelRef_getDgnModel (DgnModelRefP modelRef)
 Gets a pointer to the DgnModel that holds elements in the model. More...
 
DgnFileP mdlModelRef_getDgnFile (DgnModelRefCP modelRef)
 Gets the DgnFileObj that contains the specified modelRef. More...
 
StatusInt mdlModelRef_getUorScaleBetweenModels (double *pUorFactor, DgnModelRefCP srcModelRef, DgnModelRefCP dstModelRef)
 Gets the scale factor between the UORs of two models. More...
 
StatusInt mdlModelRef_loadReferenceModels (DgnModelRefP modelRef, bool loadCache, bool loadRasterRefs, bool loadUndisplayedRefs)
 Loads the reference models attached to the specified modelRef. More...
 
UInt32 mdlModelRef_getEof (DgnModelRefP modelRef)
 Gets the EOF (end-of-file) file position for the specified model. More...
 
DgnPlatform::ElementId mdlModelRef_getAttachmentID (DgnModelRefCP modelRef)
 Gets the element ID of the Reference Attachment element for the specified modelRef. More...
 
bool mdlModelRef_isEmpty (DgnModelRefP modelRef)
 Determines whether the specified model is empty. More...
 
int mdlModelRef_getChildCount (DgnModelRefCP modelRef, int childTypeMask)
 Gets the count of models of the specified type that are attached to the specified model. More...
 
ElementRefP mdlModelRef_getElementRef (DgnModelRefP modelRef, UInt32 filePos)
 Gets an ElementRefP given a DgnModelRefP and a filePos. More...
 
bool mdlModelRef_is3D (DgnModelRefCP modelRef)
 Determine whether the specified model is three dimensional. More...
 
bool mdlModelRef_isTransient (DgnModelRefP modelRef)
 Determines whether the specified modelRef is the transient model. More...
 
bool mdlModelRef_isSheet (DgnModelRefCP modelRef)
 Determines whether the specified model is a sheet model. More...
 
bool mdlModelRef_isDefault (DgnModelRefCP modelRef)
 Determines whether the specified model is set as the "default" model. More...
 
bool mdlActiveModel_is3d ()
 
bool mdlActiveModel_isReadonly ()
 
StatusInt mdlModelRefIterator_create (ModelRefIteratorP *mrIteratorP, DgnModelRefCP rootModelRef, int iteratorType, int depth)
 Creates a ModelRefIterator. More...
 
StatusInt mdlModelRefIterator_free (ModelRefIteratorP *mrIteratorP)
 Frees a ModelRefIterator. More...
 
DgnModelRefP mdlModelRefIterator_getFirst (ModelRefIteratorP mrIterator)
 Resets the iterator to the beginning and gets the first modelRef item. More...
 
DgnModelRefP mdlModelRefIterator_getCurrent (ModelRefIteratorP mrIterator)
 Gets the current modelRef included in the specified iterator. More...
 
DgnModelRefP mdlModelRefIterator_getNext (ModelRefIteratorP mrIterator)
 Advances the position of the iterator to the next modelRef and returns the modelRef from that position. More...
 
DgnModelRefP mdlModelRef_getTransient ()
 Gets the transient modelRef. More...
 
DgnModelRefP mdlModelRef_getActive (void)
 

Detailed Description

Gets the active ModelRef.

Returns
the DgnModelRefP that represents the currently active model. If there is no currently active model, it returns INVALID_MODELREF.
Remarks
The active model is the model that is the root model of the views that are currently displayed.
The ACTIVEMODEL and MASTERFILE macros are both defined to mdlModelRef_getActive.

Typedef Documentation

typedef int(* PFDgnLibIterateCallback)(DgnModelP model, CallbackArgP callbackArg)

UserFunction called to process files in MS_DGNLIBLIST.

Remarks
Returning any value other than SUCCESS will stop the iteration.
Parameters
[in]modelThe default model for the file.
[in]callbackArguser argument, as passed to mdlDgnLib_iterate.
Remarks
Required Library: mdlbltin.lib
See also
mdlDgnLib_iterate

Function Documentation

bool mdlActiveModel_is3d ( )
Returns
true if the active model is 3d.
Remarks
Required Library: mdlbltin.lib
bool mdlActiveModel_isReadonly ( )
Returns
true if the active model in a readonly file.
Remarks
Required Library: mdlbltin.lib
void mdlDgnLib_dumpAll ( WCharCP  prefixMessage)

Dump to console all the files currently open because they are listed in the MS_DGNLIBLIST configuration variable.

Missing dgnlibs will not be listed. This is a debugging function only.

Parameters
[in]prefixMessageA message to print out with each model.
Remarks
Required Library: mdlbltin.lib
StatusInt mdlDgnLib_iterate ( PFDgnLibIterateCallback  pCallbackFunc,
CallbackArgP  pCallbackArg,
MstnPlatform::DgnLibSelector  dgnLibSelector 
)

Process the DgnLibs specifed in the specified DgnLibSelector (or combination of DgnLibSelectors).

Remarks
All DgnLibs iterated have granted DGNFILE_RIGHT_Export to the user.
Parameters
[in]pCallbackFuncThe function to call for each file in the MS_DGNLIBLIST.
[in]pCallbackArgThe user arguments to pass into the callback function.
[in]dgnLibSelectorA value from the DgnLibSelector enum, or an 'Or'ed combination of values.
Remarks
Required Library: mdlbltin.lib
Returns
The status returned from the iterator function.
StatusInt mdlModelRef_activateAndDisplay ( DgnModelRefP  newModelRef)

Activates and displays the specified modelRef.

The function checks if the model is displayed in the current views and, if not, new views are opened with the modelRef as their root.

Parameters
[in]newModelRefthe model to activate. The modelRef must be from the current master file.
Returns
SUCCESS if the model is found and activated successfully; otherwise, ERROR.
bool mdlModelRef_areSame ( DgnModelRefP  modelRef1,
DgnModelRefP  modelRef2 
)

Determines whether two specified modelRefs are actually the same.

Parameters
[in]modelRef1the first modelRef.
[in]modelRef2the second modelRef.
Returns
true if the two modelRefs the same.
StatusInt mdlModelRef_checkAllRights ( DgnModelRefP  modelRef,
UInt32  rights,
MessageDestination  displayError 
)

Check if the specified rights are granted to the current user for the given model and all references.

Parameters
[in]modelRefThe modelRef to check.
[in]rightsthe rights to query. See mdlDgnFileObj_checkRights for a description of the rights values.
[in]displayErrorDetermines whether an error should be displayed in the message center, a pop-up dialog, or the function should return silently.
Returns
SUCCESS if all of the rights are granted for all files.
See also
digitalRights_checkRights
StatusInt mdlModelRef_checkAllRightsIfDisplayed ( DgnModelRefP  modelRef,
UInt32  rights,
int  view,
MessageDestination  displayError 
)

Check if the specified rights are granted to the current user for the given model and all references that are displayed in the selected view(s).

Parameters
[in]modelRefThe modelRef to check.
[in]rightsthe rights to query. See mdlDgnFileObj_checkRights for a description of the rights values.
[in]viewthe view to query or ANY_VIEW.
[in]displayErrorDetermines whether an error should be displayed in the message center, a pop-up dialog, or the function should return silently.
Returns
SUCCESS if all of the rights are granted for all files in the specified view.
See also
mdlModelRef_checkAllRights
digitalRights_checkRights
StatusInt mdlModelRef_checkAllRightsIncludingProtectedRefs ( DgnModelRefP  modelRef,
UInt32  rights,
MessageDestination  displayError 
)

Check if the specified rights are granted to the current user for the given model and all references, including the references that could not be opened because the user lacked viewing access.

Parameters
[in]modelRefThe modelRef to check.
[in]rightsthe rights to query. See mdlDgnFileObj_checkRights for a description of the rights values.
[in]displayErrorDetermines whether an error should be displayed in the message center, a pop-up dialog, or the function should return silently.
Returns
SUCCESS if all of the rights are granted for all files. MDLERR_RIGHT_NOT_GRANTED if any of the opened references do not have the specified rights, or if there were references that could not be opened because the user did not have any access rights to the file.
See also
digitalRights_checkRights
StatusInt mdlModelRef_copyModel ( DgnModelRefP *  returnDestModelRef,
DgnModelRefP  sourceModelRef,
DgnFileP  destFile,
const WChar *  pDestModelName,
const WChar *  pDestModelDescr 
)

Copy a model from one location to another.

This function handles copying levels, styles, etc. necessary for elements in the model.

Remarks
Export rights for the source modelRef and edit rights for the destination file are checked.
Parameters
[out]returnDestModelRefWorking model ref for resulting model. If NULL is not passed for this parameter, the resulting modelRef must be freed using mdlModelRef_freeWorking.
[in]sourceModelRefModel to copy.
[in]destFileFile in which the model should be written.
[in]pDestModelNameName for the copied model.
[in]pDestModelDescrDescription for the copied model; may be NULL.
Returns
SUCCESS if the model was copied successfully; error returns are defined in mdlerrs.r.h.
See also
mdlDgnFileObj_createModel
StatusInt mdlModelRef_createCacheSpecificWorking ( DgnModelRefP *  dgnModelRefP,
DgnFileP  dgnFileP,
DgnPlatform::ModelId  modelID,
bool  fillCache,
bool  loadRefs,
bool  includeUndisplayedRefs,
DgnPlatform::DgnModelSections  sectionsToFill 
)

Creates a "working" DgnModelRefP containing the specified cache sections that can be passed to functions that take DgnModelRefP arguments.

The ModelRef created must be freed using ~mmdlModelRef_freeWorking. If the file specified as dgnFileP is read-only, then the modelRef will be read-only also.

Parameters
dgnModelRefPOUT modelRef referring to the model created
dgnFilePIN the file object to search for the model
modelIDIN the ID of the model to load
fillCacheIN true if the cache for the model should be filled. Operations like changing name, description, etc., can be performed even if the cache is not filled.
loadRefsIN true if the caches for the model's attached references should also be loaded. The fillCache argument must be true for this to work.
includeUndisplayedRefsIN If true, load the caches for references that are not displayed. The fillCache and loadRefs arguments must be true for this to work.
sectionsToFillIN Specific cache sections to fill.
Returns
SUCCESS if the modelRef is returned and filled as requested.
See also
usmthmdlModelRef_createWorkingC
StatusInt mdlModelRef_createWorking ( DgnModelRefP *  dgnModelRefP,
DgnFileP  dgnFileP,
DgnPlatform::ModelId  modelID,
bool  fillCache,
bool  loadRefs 
)

Creates a "working" DgnModelRefP that can be passed to functions that take DgnModelRefP arguments.

The ModelRef created must be freed using mdlModelRef_freeWorking. If the file specified as dgnFileP is read-only, then the modelRef will be read-only also.

Parameters
[out]dgnModelRefPmodelRef referring to the model created
[in]dgnFilePthe file object to search for the model
[in]modelIDthe ID of the model to load
[in]fillCachetrue if the cache for the model should be filled. Operations like changing name, description, etc., can be performed even if the cache is not filled.
[in]loadRefstrue if the caches for the model's attached references should also be loaded. The fillCache argument must be true for this to work.
Returns
SUCCESS if the modelRef is returned and filled as requested.
See also
mdlModelRef_createWorkingByName
StatusInt mdlModelRef_createWorkingByName ( DgnModelRefP *  dgnModelRefP,
DgnFileP  dgnFileP,
const WChar *  modelNameP,
bool  fillCache,
bool  loadRefs 
)

Creates a "working" DgnModelRefP that can be passed to functions that take DgnModelRefP arguments.

The ModelRef created must be freed using mdlModelRef_freeWorking. If the file specified as dgnFileP is read-only, then the modelRef will be read-only also.

Parameters
[out]dgnModelRefPmodelRef referring to the model created
[in]dgnFilePthe file object to search for the model
[in]modelNamePthe name of the model to find in the design file.
[in]fillCachetrue if the cache for the model should be filled. Operations like changing name, description, etc., can be performed even if the cache is not filled.
[in]loadRefstrue if the caches for the model's attached references should also be loaded. The fillCache argument must be true for this to work.
Returns
SUCCESS if the modelRef is returned and filled as requested.
See also
mdlModelRef_createWorking
StatusInt mdlModelRef_deleteModel ( DgnModelRefP  modelRef,
bool  deleteElements 
)

Deletes the specified model from the file that contains it.

Parameters
[in]modelRefthe model to delete.
[in]deleteElementsIf true, the model will not be deleted unless it is empty. If false, all elements assigned to the model are also deleted.
Returns
SUCCESS if the model is found and deleted successfully; otherwise, ERROR.
Remarks
This action is undoable if the model is deleted from the master file
See also
mdlModelRef_isReadOnly
StatusInt mdlModelRef_freeWorking ( DgnModelRefP  modelRef)

Frees modelRef's created using mdlModelRef_createWorking or mdlModelRef_createWorkingByName.

Parameters
[in]modelRefthe modelRef to free.
Returns
SUCCESS if the model ref is freed, MDLERR_BADMODELREF if the modelRef specified is not a working modelRef.
Remarks
Only modelRefs created with mdlModelRef_createWorking or mdlModelRef_createWorkingByName can be freed using this function. An attempt to free other modelRefs causes a returns value of MDLERR_BADMODELREF.
See also
mdlModelRef_createWorking mdlModelRef_createWorkingByName
DgnModelRefP mdlModelRef_getActive ( void  )
DgnPlatform::ElementId mdlModelRef_getAttachmentID ( DgnModelRefCP  modelRef)

Gets the element ID of the Reference Attachment element for the specified modelRef.

Parameters
[in]modelRefThe model to get the attachment element ID for.
Returns
If the modelRef represents a reference attachment, the ElementId of the attachment element. If the modelRef is not a reference attachment, returns 0.
See also
usmthmdlModelRef_isReferenceC
int mdlModelRef_getChildCount ( DgnModelRefCP  modelRef,
int  childTypeMask 
)

Gets the count of models of the specified type that are attached to the specified model.

Parameters
[in]modelRefThe model to query.
[in]childTypeMaskThe type of child that is being counted. Valid values for this argument include:
  • MRCHILD_PrimaryRefs include primary (graphics) references
  • MRCHILD_ExtendedRefs include extended references
Returns
The number of children of the given type attached to the specified model.
Remarks
The MRCHILD_xxx constants are individual bits that can be ORed together to count children of multiple types with the same call.
Extended references are attached to a file to allow shared cells from those files to be located. Their graphics are not displayed.
DgnFileP mdlModelRef_getDgnFile ( DgnModelRefCP  modelRef)

Gets the DgnFileObj that contains the specified modelRef.

Parameters
[in]modelRefThe model to get the design file for.
Returns
The Design File object for the design file containing the specified modelRef, if the model is valid; otherwise, NULL.
DgnModelP mdlModelRef_getDgnModel ( DgnModelRefP  modelRef)

Gets a pointer to the DgnModel that holds elements in the model.

Parameters
[in]modelRefThe model to get the element cache for.
Returns
A DgnModelP reference to the element cache if modelRef is valid; otherwise, NULL.
ElementRefP mdlModelRef_getElementRef ( DgnModelRefP  modelRef,
UInt32  filePos 
)

Gets an ElementRefP given a DgnModelRefP and a filePos.

This can also be accomplished by calling mdlModelRef_getDgnModel and then calling the dgnCache_findElemByFilePos.

Parameters
[in]modelRefThe model that the filePos pertains to.
[in]filePosFile position of the element to return the ElementRefP for.
Returns
An ElementRefP for the desired element, or NULL if the filePos or modelRef is invalid.
UInt32 mdlModelRef_getEof ( DgnModelRefP  modelRef)

Gets the EOF (end-of-file) file position for the specified model.

Parameters
[in]modelRefThe model to query.
Returns
The file position of the EOF. If an error occurs, 0 is returned and the reason code is returned in mdlErrno.
StatusInt mdlModelRef_getFileName ( DgnModelRefP  modelRef,
WCharP  fileName,
int  fileNameBufSize 
)

Gets the name of the file that contains the data for the specified model.

Parameters
[in]modelRefthe model to query.
[out]fileNamebuffer to hold the file name.
[in]fileNameBufSizesize of the buffer (in characters) pointed to by fileName.
Returns
SUCCESS if the name is obtained without error; MDLERR_BADARG if modelRef was invalid; MDLERR_BADMODELREF if the file could not be obtained.
Remarks
This function requires that the element cache exists for the specified modelRef. For example, this function can fail if the specified modelRef is a reference model that is not displayed, or is not found. In this case, mdlRefFile_getRefParameter can be used to get the file name stored in the reference attachment.
A more modern version that returns a WString is modelRef->GetDgnFileP()->GetFileName().
See also
mdlModelRef_getDgnFile
DgnModelRefP mdlModelRef_getParent ( DgnModelRefCP  modelRef)

Gets the DgnModelRefP for the model that is the parent of the specified modelRef.

Parameters
[in]modelRefThe model to get the parent of.
Returns
The modelRef for the parent model of the specified modelRef if a parent exists; otherwise, NULL.
Remarks
Reference attachments have a parent, but the active model does not. The parent of a directly attached reference is the active model. The parent of a nested reference is the model to which it is attached.
DgnModelRefP mdlModelRef_getTransient ( )

Gets the transient modelRef.

Returns
the DgnModelRefP of the transient modelRef. The value returned will always be the same for a given session.
StatusInt mdlModelRef_getUorScaleBetweenModels ( double *  pUorFactor,
DgnModelRefCP  srcModelRef,
DgnModelRefCP  dstModelRef 
)

Gets the scale factor between the UORs of two models.

The scale factor accounts for the resolution (storage unit) differences between the two models, but ignores any reference scale relationship between them. This value can be used to scale elements from the source model before adding them to the destination model so that the real-world size of the elements does not change.

Remarks
The uor scale can only be computed if the storage units of the two models have the same base. If the unit bases are different, a scale factor of 1.0 will be returned along with an error status. See ~s"Unit Functions" for more information on unit bases.
Parameters
[out]pUorFactorThe scale factor.
[in]srcModelRefModel ref that elements are to be scaled from.
[in]dstModelRefModel ref that elements are to be scaled to.
Returns
SUCCESS if both model refs are valid and a scale factor could be computed; otherwise ERROR. ""
int mdlModelRef_getViewMask ( DgnModelRefP  modelRef)

Gets a bitmask representing the views that display the specified modelRef.

Parameters
[in]modelRefthe model to get the view bitmask for.
Returns
An integer value that is has one bit for each of views 1 through 8 whether the modelRef is displayed in the corresponding view. Bit 0 corresponds to "View 1".
See also
mdlModelRef_isDisplayedInView
bool mdlModelRef_inMasterFile ( DgnModelRefP  modelRef)

Determines whether the specified modelRef is contained in the master file.

Parameters
[in]modelRefthe model to test.
Returns
true, if the modelRef is valid and its data is stored in the current master file.
See also
mdlModelRef_isReference mdlModelRef_getDgnFile
bool mdlModelRef_is3D ( DgnModelRefCP  modelRef)

Determine whether the specified model is three dimensional.

Parameters
[in]modelRefThe model to test.
Returns
true if the model is three dimensional.
bool mdlModelRef_isActiveModel ( DgnModelRefCP  modelRef)

Determines whether the specified modelRef is the active model.

Parameters
[in]modelRefthe model to test.
Returns
true, if the modelRef is the currently active model.
See also
mdlModelRef_isReference ustmthmdlModelRef_isNestedReferenceC
bool mdlModelRef_isDefault ( DgnModelRefCP  modelRef)

Determines whether the specified model is set as the "default" model.

The default model is the model that becomes active when the file containing that model is first opened.

Parameters
[in]modelRefThe model to test.
Returns
true if the model is currently set as the default.
bool mdlModelRef_isDisplayedInView ( DgnModelRefP  modelRef,
int  viewIndex 
)

Determines whether the specified DgnPlatform::DgnModelRef is displayed in the specified view.

Parameters
[in]modelRefthe the model to query.
[in]viewIndexthe view index to test. This value should be in the range of 0 - (DgnPlatform::MAX_VIEWS-1), or the value ANY_VIEW if the test is to see whether it is displayed in any view.
Returns
true if the specified modelRef is currently displayed in the given view.
Remarks
A model is not displayed in a view if it is not the root model for that view or one of its descendants.
If the modelRef is a reference modelRef, it is not displayed in any view if its display flag is turned off, or if the file or model referenced could not be found. It is also not displayed in a particular view if the level of its reference attachment element is turned off in that view.
See also
mdlModelRef_getViewMask
bool mdlModelRef_isEmpty ( DgnModelRefP  modelRef)

Determines whether the specified model is empty.

A model is empty if it contains no graphics elements and no control elements.

Parameters
[in]modelRefThe model to test.
Returns
true if the specified model is empty. ""
bool mdlModelRef_isNestedReference ( DgnModelRefP  modelRef)

Determines whether the specified reference model is attached to another reference model.

Parameters
[in]modelRefthe model to test.
Returns
true if the specified modelRef is referenced from another referenced model.
See also
mdlModelRef_isReference mdlModelRef_isActiveModel
bool mdlModelRef_isReadOnly ( DgnModelRefP  modelRef)

Determines whether a modelRef is read-only.

Parameters
[in]modelRefthe modelRef to test.
Returns
true if the specified model is read-only.
See also
mdlModelRef_isReference
bool mdlModelRef_isReference ( DgnModelRefCP  modelRef)

Determines whether the specified modelRef is a reference model.

Parameters
[in]modelRefThe model to test.
Returns
true if the specified modelRef represents a reference model.
bool mdlModelRef_isSheet ( DgnModelRefCP  modelRef)

Determines whether the specified model is a sheet model.

A sheet model is always viewed from the top and typically is used to reference other models for plotting purposes.

Parameters
[in]modelRefThe model to test.
Returns
true if the model is a sheet model.
bool mdlModelRef_isTransient ( DgnModelRefP  modelRef)

Determines whether the specified modelRef is the transient model.

MicroStation always maintains a "transient" model to hold elements that are displayed on the screen but are not stored permanently in any model.

Parameters
[in]modelRefThe model to test.
Returns
true if the model is transient.
StatusInt mdlModelRef_loadReferenceModels ( DgnModelRefP  modelRef,
bool  loadCache,
bool  loadRasterRefs,
bool  loadUndisplayedRefs 
)

Loads the reference models attached to the specified modelRef.

By default, reference models are loaded only for the active modelRef (and its descendants), and child DgnModelRefP's for other modelRefs are not created. When this function is called, the child DgnModelRefPs will be created so they can be iterated using mdlModelRefIterator_create.

Parameters
[in]modelRefThe modelRef for which the reference DgnModelRefPs are to be created.
[in]loadCachetrue if caches should be loaded for reference models, false if only modelRefs should be created.
[in]loadRasterRefstrue if raster reference files should be loaded, false if not.
[in]loadUndisplayedRefstrue if even undisplayed reference files should be loaded.
Returns
SUCCESS or a nonzero error code. ""
Remarks
Required Library : mdlbltin.lib
void mdlModelRef_setDefaultBackgroundColor ( DgnModelRefP  modelRefP)

Sets the model background color to the default value for that model type.

This has an effect only on sheet models, because there is no default background color for normal models..

Parameters
[in]modelRefPthe modelRef for which the default background color is set.
StatusInt mdlModelRefIterator_create ( ModelRefIteratorP *  mrIteratorP,
DgnModelRefCP  rootModelRef,
int  iteratorType,
int  depth 
)

Creates a ModelRefIterator.

ModelRefIterators are used to iterate through the modelRefs That are attached as references.

Parameters
[out]mrIteratorPPointer to the ModelRefIteratorP
[in]rootModelRefThe root model for the iteration.
[in]iteratorTypeDetermines which type of models are included. The argument should be an OR of one or more of the following values:
  • MRITERATE_Root Specifies that the rootModelRef is to be included in the iteration. It will always be returned first.
  • MRITERATE_PrimaryChildRefs Specifies that the primary (graphics) reference modelRefs are to be included in the iteration.
  • MRITERATE_ExtendedChildRefs Specifies that extended reference modelRefs are to be included in the iteration.
[in]depthThe nesting depth. If this value is set to zero, then only the root modelRef (if specified) and the directly attached reference files are included. If this value is -1, then files attached heirarchically (nested reference files) are included as well, and the depth is unlimited.
Returns
SUCCESS if successful. DGNMODEL_STATUS_BadModelPtr if rootModelRef is not valid.
Remarks
If rootModelRef is the active model, then the iteration includes the reference models of the type indicated by iteratorType. If rootModelRef is a reference modelRef, then the iteration includes models under it in the hierarchy.
Remember to call mdlModelRefIterator_free to reclaim the memory allocated by the ModelRefIterator.
Extended references are attached to a file to allow shared cells from those files to be located. Their graphics are not displayed. ""
StatusInt mdlModelRefIterator_free ( ModelRefIteratorP *  mrIteratorP)

Frees a ModelRefIterator.

Parameters
[in]mrIteratorPA pointer to the ModelRefIteratorP to free. The contents of the pointer will be set to NULL by the function.
Returns
SUCCESS ""
DgnModelRefP mdlModelRefIterator_getCurrent ( ModelRefIteratorP  mrIterator)

Gets the current modelRef included in the specified iterator.

Does not advance the iterator to the next modelRef.

Parameters
[in]mrIteratorThe iterator to get the current modelRef from.
Returns
The current modelRef that is included in the iteration. ""
DgnModelRefP mdlModelRefIterator_getFirst ( ModelRefIteratorP  mrIterator)

Resets the iterator to the beginning and gets the first modelRef item.

Parameters
[in]mrIteratorThe iterator to reset and get the first modelRef from.
Returns
The first modelRef that is included in the iteration.
Remarks
It is not necessary to call ~mmdlModelRefIterator_getFirst before calling mdlModelRefIterator_getNext. In most iterations, a while loop of the following form can be used: pre> ModelRefIteratorP iterator; DgnModelRefP modelRef;

mdlModelRefIterator_create (&iterator, masterModelRef, MRITERATE_PrimaryChildRefs, 0);

while (NULL != (modelRef = mdlModelRefIterator_getNext (iterator))) { // do something to each modelRef }

mdlModelRefIterator_free (&iterator); /pre> ""

DgnModelRefP mdlModelRefIterator_getNext ( ModelRefIteratorP  mrIterator)

Advances the position of the iterator to the next modelRef and returns the modelRef from that position.

Parameters
[in]mrIteratorThe iterator to get the next modelRef from.
Returns
The current modelRef that is included in the iteration. After iterating through all modelRefs in the iteration, returns NULL.
Remarks
It is not necessary to call ~mmdlModelRefIterator_getFirst before calling mdlModelRefIterator_getNext. In most iterations, a while loop of the following form can be used: pre> ModelRefIteratorP iterator; DgnModelRefP modelRef;

mdlModelRefIterator_create (&iterator, masterModelRef, MRITERATE_PrimaryChildRefs, 0);

while (NULL != (modelRef = mdlModelRefIterator_getNext (iterator))) { // do something to each modelRef }

mdlModelRefIterator_free (&iterator); /pre> ""


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