Models of DG Kernel
A Model is a collection of objects and related information displayed as a scene in 3D window of DG Kernel
or loaded to perform background manipulations
Models consist of Entities.
Entities are arranged in a child/parent tree.
Model keeps array of top-level entities. The rest of the entities are children and descendents of top-level entities
Major attributes of a model:
- Array of top level entities
- Name
- Description
Model also serves as a document of DG Kernel software. It contains all information stored or loaded via the supported formats
Programmatically model can be accessed and manipulated via IModel_DG interface,
acquired via GetModel() method of DG Kernel control
Empty models (models, which do not contain any items) are considered valid.
Structure of a model can be viewed in Model Explorer,
available via Model > Explore context menu command.
Model Persistance
Models can be loaded or saved by DG Kernel component programmatically at runtime.
To save use either Save
or SaveAs
methods of the component or IModel_DG.Save*() methods.
To load a model, either change the ModelPath
property to a new location or use IModel_DG.Load*()..
The required format in the above operations is determined by the file extension
IModel_DG
also provides methods for saving and loading the model to and from a memory
buffer bypassing the file system, which allows embedding DG Kernel models in
application documents and other tasks.
Standalone Models
Standalone Models are model instances not attached to a control, so they are not displayed in a view. They are useful in background operations involving models,
for an example for saving a selected subset of entities.
Standalone models can be created using IObjectGenerator_DG.Create<IModel_DG>();
Standalone models are deleted as soon as the last reference to the model goes out of scope or the object holding the reference is deleted
|