DG Kernel (ActiveX) Documentation


Skip Navigation Links.
Skip Navigation LinksHome Page > API Reference > Model > IModel_DG Go to DGKC docs Search Documentation


IModel_DG Interface

Implemented by models.

IModel_DG, implemented by the main model of DGK control, can be obtained via: DGKernel > GetModel() > IModel_DG. It is also returned as result of model construction using the IObjectGenerator_DG.Create<Model_DG>() call. More methods of obtaining the interface may also be available.

Implements also: IObject_DG, IObjectGenerator_DG, IStdShape_DG, IStdShapeRef_DG, ILighting_DG, IDraw_DG, IError_DG.

GetEntityCount
GetEntityAt
GetEntity
GetLastEntity
AddEntity
InsertEntity
Add
AddNewEntity
AddNewEntity1
AddBRepShape
AddNewBRepShape
AddNewBRepSolid
GetEntityArray
GetEntities
GetEntityPath
RemoveAt
RemoveEntity
RemoveEntities
RemoveAll
Find
FindEntity
BuildChildToParentMap
GetBoundingBox
Load
LoadEx
LoadFromMemory
LoadFromMemory1
Save
SaveEx
SaveToMemory
SaveToMemory1
GetName
SetName
GetDescription
SetDescription
IsPersistModified
SetPersistModified
Copy
Clone
UpdateDeep
GetEnumerator

int GetEntityCount()


IEntity_DG GetEntityAt(int index)


IEntity_DG GetEntity(string path)

Indexes entities by their names. Allows retrieving entites on level deeper than the first.
Examples:
MyTopBox\ChildSphere\Cone
TopTorus\2
The second example is used in case when the third child has empty name string, in which case zero based indices are used. The search is case insencetive.


IEntity_DG GetLastEntity()


void AddEntity(IEntity_DG entity)


void InsertEntity(IEntity_DG entity, int indexAt)


void Add(IEntityArray_DG entities, int insertAtOrNegative)

Inserts the entity at the specified index or adds at the end if the second parameter is negative.


IEntity_DG AddNewEntity()


IEntity_DG AddNewEntity1(string type)

type specifies type of geometry. Valid values are listed in IEntity_DG.SetGeometryType() topic


IEntity_DG AddBRepShape(IBRepShape_DG shape)

Creates and adds new entity of BRep type with shape attached to it.


IEntity_DG AddNewBRepShape(ShapeType_DG type)

Creates and adds new entity of BRep type with an empty shape of the specified type.


IEntity_DG AddNewBRepSolid()


IEntityArray_DG GetEntityArray(bool includeDescendents)


IEntityArray_DG GetEntities(string path, bool includeDescendents)

Lists descendents of the entity identified by its path. See GetEntity(string path)


string GetEntityPath(IEntity_DG entity)

Returns file system - like path of entity names separated by backward slashes. See GetEntity(string path) for an example


void RemoveAt(int index)


bool RemoveEntity(IEntity_DG entity)

Removes entity from the array of the top-level entities of the model. Returns false if the entity was not found.


void RemoveEntities(IEntityArray_DG entities)

Removes the entities from the model. The entities can be at any level in the hierarchy.


void RemoveAll(bool includingDescendantsFromParents)


int Find(IEntity_DG entity)

Returns index of entity at the top level or -1 if not found


string FindEntity(IDictionary_DG query)

Returns path of the entity specified by the query.

In this version the query can have the following paramaters:

Name Type Value
By String "ConvertableToMesh"
TopLevelOnly bool  
IncludeThis bool  

IMapUnkn_DG BuildChildToParentMap()

The returned map contains entities (map[IEntity_DG]) is an IEntity_DG) and is read-only in this release. map[entity] is the parent of entity in this model or null for the top-level entities.


Box_DG GetBoundingBox()

Returns global axes-aligned minimal box containing all entities in the model.


bool Load(string filePath)

The path can have any supported extension. Returns false in case of errors.


bool LoadEx(string filePath, IDictionary_DG options)

The path can have any supported extension. If filePath has no extension and is a valid folder path, the folder is considered as an stl tree directory. Returns false in case of errors.

The options parameter is used only for .stl extension. In any case it can be null. If options is not null the software checks for the following parameters inside:

Parameter Name Type Meaning Default
Verbose Boolean If true, the software displays a pop-up dialogue for the Binary option True
NeedWarnings Boolean If true, the component will display a warning message when a data directory is about to be deleted. True
SeparateObjects Boolean If true the component will analyse the mesh and separate linked sub-meshes as different entities. Set this property to false to improve performance. This property should also be set to true when loading is performed from an STL Data Directory. In this case each STL file will be stored or loaded into/from different entity in the model True
CreaseAngle in radians Double Crease angle. If actuall angle between normals of two adjacent simplices is greated than that, the shared egde will be considered a part of a wire between the adjacent faces(patches) PI/6

bool LoadFromMemory(IBlob_DG data, CADFormat_DG format)

Loads the model from a memory buffer.


bool LoadFromMemory1(SAFEARRAY* data, CADFormat_DG format)

Loads the model from a memory buffer.


bool Save(string filePath)

The path can have any supported extension. Returns false in case of errors.


bool SaveEx(string filePath, IDictionary_DG options)

The path can have any supported extension. If filePath has no extension, the model is saved as an stl directory. Returns false in case of errors.

The options parameter is used only for .stl extension. In any case it can be null. If options is not null the software checks for two parameters inside:

Parameter Name Type Meaning Default
Verbose Boolean If true, the software displays a pop-up dialogue for the Binary option True
Binary Boolean Binary or text type of stl to be saved into True

IBlob_DG SaveToMemory(CADFormat_DG format)

Returns data in the specified format for transmission or writing to a file.


SAFEARRAY SaveToMemory1(CADFormat_DG format)

Returns data in the specified format for transmission or writing to a file.


string GetName()


void SetName(string name)


string GetDescription()


void SetDescription(string description)


void Copy(IModel_DG model)


IModel_DG Clone()


void UpdateDeep()

Call for this method is required when some low-level attributes have been modified and the software has no way to detect it automatically. The call invokes search and update of higher level modified flags.


IEnumerator GetEnumerator()

Returns enumerator of the top level entities.