DG Kernel Documentation


Skip Navigation Links.
Start page
Quick Start
Search Page
Installation
Overview of the software
What is new
Licensing
Expand ModelsModels
Collapse DG Kernel ComponentsDG Kernel Components
Expand API ReferenceAPI Reference
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 Components > Programmatic Functionality > Generator Search Documentation


Object Generator

Object Generator is an object, which allow creation of other new objects. Object Generator is a sort of "new" operator similar to one of C++, C# etc.

Using Object Generator

Object Generator implements IObjectGenerator_DG interface, which can be queried from IModel_DG or from a standalone object as described in the Advanced section below.

IObjectGenerator_DG.Create method can be used to create new instances of objects. See details for types of available objects.

Advanced

A standalone instance of the Object Generator and its IObjectGenerator_DG can be obtained via call to CreateInstance() COM API in C/C++ or via the new operator and a cast in other languages.

In COM terminology DIObjGenerator  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 Object Generator can be created using standard new operator as (C# example):

       KernCADnet.DIObjGeneratorClass sect = new KernCADnet.DIObjGeneratorClass();

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 Object Generator can be instantiated by using its Class ID and call to CoGetClassObject() COM function. See  Cannon 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 gener3D As Object

            gener3D = CreateObject("KERNELCAD.DIObjGenerator.1")

IDs of DIObjGenerator 

Class ID:

// {B38689B7-0560-441a-B735-0E68F0953587}
static const GUID CLSID_DIObjGenerator = 
{ 0xb38689b7, 0x560, 0x441a, { 0xb7, 0x35, 0xe, 0x68, 0xf0, 0x95, 0x35, 0x87 } };

Program ID:  

KERNELCAD.DIObjGenerator.1

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

See also Deprecated Object Generators, Object Array sample and Cannon sample.