Quantcast
Channel: MicroStation Programming Forum - Recent Threads
Viewing all articles
Browse latest Browse all 7260

RE: [CE5 NET API C#] How to active existing Model

$
0
0

[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:

  1. Call #Create to create a DgnFile object.
  2. Call #LoadDgnFile to attempt to open the disk file.

To access models: A DgnFile is composed of \ref DgnPlatformModelsGroup. To access models:

  1. Call #GetModelIndex to detect what models are stored in a file.
  2. Call #FindModelIdByName to look up a specific model.
  3. 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.

  1. Call #FillSectionsInModel before attempting to access elements in a DgnModel.
  2. 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);

Viewing all articles
Browse latest Browse all 7260

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>