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


Model Class

This topic describes how to create standalone models, which are not associated with any component or control, programmatically at runtime using Model COM class. See also Object Array sample.

In COM terminology Model  is a Class Factory. It can be instantiated in COM-enabled development environments by using either its Class ID or Program ID (see below). Note that DG Kernel control does not have to be created in the application before creation of the object. 

In .NET environment instances of the Model class can be created using standard new operator as (C# example):

            KernCADnet.ModelClass model = new KernCADnet.ModelClass();

Actual name of the wrapper class might be different in different versions of the development environment. Refer to Object Browser in the project after adding a reference to the KernelCADnet component (See Patch Tutorial).

In C++ the Sect3DGenerator can be instantiated by using its Class ID and call to CoGetClassObject() COM function. See CObjArrayDlg::Create3DS() method of Object Array sample for details of implementation.

In native Visual Basic an instance of the class can be created using the Program ID and CreateObject() API as follows:

            Dim model As Object

            model = CreateObject("KERNELCAD.Model.1")

Model class  implements two interfaces: IModel and  IModelEx, which can be obtained via call to CreateInstance() COM API in C/C++ or a cast in other languages. If IModelEx was obtained in this way. IModel cal be queried from IModelEx, but not vice versa.

IDs of Sect3DGenerator 

Class ID:

// {E70C92E2-0F1B-4d3c-8DDB-C50374604FB6}
static const GUID CLSID_Model
{ 0xe70c92e2, 0xf1b, 0x4d3c, { 0x8d, 0xdb, 0xc5, 0x3, 0x74, 0x60, 0x4f, 0xb6 } };

Program ID:  

KERNELCAD.Model.1

These definitions can be found in Samples\VC\Inclide\DIInterface.h file of the installation directory.