DG Kernel (ActiveX) Documentation


Skip Navigation Links.
Start page
Quick Start
Search Page
Installation
What is new
Upgrading Native Apps
Licensing
Expand ModelsModels
Collapse DG Kernel ControlsDG Kernel Controls
Expand API ReferenceAPI Reference
Expand ViewsViews
Expand Samples and TutorialsSamples and Tutorials
Expand GraphicsGraphics
Expand Math ObjectsMath Objects
Expand DeprecatedDeprecated
Redistribution
Model Viewer
Open Source
Support
Skip Navigation LinksHome Page > DG Kernel Controls > Programmatic Functionality > Programming Go to DGKC docs Search Documentation


Programming the DG Kernel Control

Manipulation of a model and its rendering properties is performed via interfaces implemented by DG Kernel control. Interface is a simple notion, which does not require any special knowledge. Interface is a small group of methods (functions) related to a certain functionality. Programming Samples provide ample examples of their usage.

DG Kernel interfaces are organized in a hierarchical fashion. This means that one have to traverse the interface hierarchy tree using casts and other methods to obtain needed interface of a particular object. 

IModel_DG is the root interface for geometry-related interfaces, from which all its dependent interfaces can be obtained. IModel_DG interface can be obtained by calling GetModel() method of the control and query/cast IModel_DG from it.

The interface hierarchy can be traversed using casts (or QueryInterface() calls in C++) and other interface methods like IModel_DG::GetEntity() to obtain the interface needed and call its methods.

IView_DG interface is the root for functionality related to 3D rendering and user interaction. IView_DG reference is returned by query GetView() > IView_DG.

In unmanaged environments like native C++, every interface reference, obtained with the QueryInterface() or a call to an interface method, should be released with a call to Release() method, like pIModel->Release(), when it is no longer needed.  This can be made seamless by using smart pointers. See C++ samples for an example.

C++ interface declarations are available in DgInterface.h located in Samples\VC\Include directory of the installation folder. The same folder contains DIError.h with declarations of error codes specific to DInsight software. All other return codes for interface methods are contained in Winerror.h - the standard header file of your development environment. If you cannot find one on your machine use copy from Samples\Vc\Include directory of this product installation folder. 

Microsoft Visual Basic and Microsoft Visual Studio .NET detect control's interfaces and types automatically after the control has been added to the project. To access this information open Object Browser and activate KernelCADTypeLib set.

Advanced: DG Kernel software slightly deviates from the COM standard. In some (rare) situations, traversing the Interface Hierarchy can obtain interface implemented by an object different from the original one. This means that result of a query depends on the query path. For example for an entity with 3DS geometry, path IEntity_DG > IArray returns IArray of its child entities, but path IEntity_DG > IAxiBase > IArray returns IArray of its base knots.

See also Interface queries