SectSORGenerator class
This topic describes how to create new SOR objects in the model programmatically
at runtime using SectSORGenerator COM class. See also Object Array sample.
SectSORGenerator is an Object Generator, which allows creation of new SOR Entities. In COM terminology SectSORGenerator 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 SectSORGenerator can be created using standard new
operator as (C# example):
KernCADnet.SectSORGeneratorClass sect = new KernCADnet.SectSORGeneratorClass();
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 SectSORGenerator can be instantiated by using its Class ID and call
to CoGetClassObject() COM function. See CObjArrayDlg::CreateSOR() method
of Object Array sample for details of implementation.
In Visual Basic an instance of the class can be created using the Program ID
and CreateObject() function as follows:
Dim gener3D
As Object
gener3D
= CreateObject("KERNELCAD.EntitySOR.1")
SectSORGenerator implements a single interface ISOREntityGenerator,
which can be obtained via call to CreateInstance() COM API in C/C++ or
a cast in other languages.
Actual SOR objects can be created using Create() method of ISOREntityGenerator interface.
The method returns ISection interface, which can be used in a call to Add()
method of IArray interface to insert the new object in the model or make it a
child entity of another object.
Using Create method of IDIObjGenerator
with eType parameter set to eObjTypeSORGenerator provides another method of obtaining ISOREntityGenerator
interface.
IDs of SectSORGenerator
Class ID:
// {BF14B870-93AF-4822-89F3-A78ED9207483}
static const GUID CLSID_SectSORGenerator =
{ 0xbf14b870, 0x93af, 0x4822, { 0x89, 0xf3, 0xa7, 0x8e, 0xd9, 0x20, 0x74, 0x83 } };
Program ID:
KERNELCAD.EntitySOR.1
These definitions can also be found in Samples\VC\Inclide\DIInterface.h file of
the installation directory.
|