[quote user="Nenad Poljcic"]How do I activate existing DgnModel using NET API c# ?[/quote]
You've opened a DgnFile and now want to make active a DgnModel in that file?
Here's what I found in DgnPlatformNet help about DgnFile...
Accessing an existing file
To open a design file:
- Call #Create to create a DgnFile object.
- Call #LoadDgnFile to attempt to open the disk file.
To access models: A DgnFile is composed of \ref DgnPlatformModelsGroup. To access models:
- Call #GetModelIndex to detect what models are stored in a file.
- Call #FindModelIdByName to look up a specific model.
- Call #LoadRootModelById to get a DgnModel.
Call #GetDictionaryModel to access data that applies to all models in a DgnFile. Levels, linestyles, and other styles are defined in the dictionary model. Special elements such as Shared cell definitions are also defined there. To access elements: All data for a DgnFile is stored in its Elements and their XAttributes. Elements are stored in models within a file. Opening a DgnFile does not cause it to load any element or XAttribute data. Likewise, model look-up functions such as #LoadModelById do not load element data. To access elements, you must access a DgnModel and then "fill" it.
- Call #FillSectionsInModel before attempting to access elements in a DgnModel.
- Use DgnModel methods to access elements.
I think by #GetModelIndex they mean DgnFile.GetModelIndexCollection(). Then do something like this...
DgnFile dgnFile ... ModelIndexCollection collection = dgnFile.GetModelIndexCollection(); IEnumerator<ModelIndex> models = collection.GetEnumerator (); ... find model by ModelIndex.Name? StatusInt status; DgnModel model = dgnFile.LoadRootModelById (status, modelIndex.Id); model.FillSection(DgnModelSections.GraphicElements);