DG Kernel Documentation


Skip Navigation Links.
Start page
Quick Start
Search Page
Installation
Overview of the software
What is new
Licensing
Collapse ModelsModels
Collapse DG Kernel ComponentsDG Kernel Components
Collapse API ReferenceAPI Reference
Interface List
Vector Space
Collapse General GeometryGeneral Geometry
Collapse ModelModel
Collapse ViewView
Collapse General ComputingGeneral Computing
Collapse Samples and TutorialsSamples and Tutorials
Collapse GraphicsGraphics
Collapse Math ObjectsMath Objects
Collapse DeprecatedDeprecated
Redistribution
Model Viewer
Open Source
Support
Skip Navigation Links Search Documentation


Dynamically changing structure of a model

This topic describes how to modify hierarchy of objects in the model by deleting or adding new objects to the model.

Array of objects in the model and arrays of child objects of a parent object (entity) can be manipulated programmatically with IArray interface. When IArray obtained from IModel interface it manages top level objects of the model. When IArray is obtained from an ISection interface it manages array of child objects of the object, which implements the ISection interface.

To delete an object call RemoveAt() method of the IArray. To add a new object the object has to be created using correspondent Object Generator. See Dynamic object creation topic for details. Output of the object creation procedure is a reference to ISection interface, which can be supplied to Add() or InsertAt() methods of IArray.

For example to add new top level 3DO object to the model:

  1. Obtain  I3DSectionGenerator (See Dynamic object creation).
  2. Create new 3DO object using Create method of I3DSectionGenerator. 
  3. Query IArray interface from IModel
  4. Call Add() method of IArray, supplying the interface obtained in the step 2.

To add a new child object to an existing entity in step 3 query IArray form the correspondent ISection instead of IModel.

See also Object Array programming sample.