KernelCAD Documentation

DInsight Home
Skip Navigation Links. Skip Navigation LinksHome Page > KernelCAD Components > Interfaces > Topological Interfaces > IDIObjGenerator
IDIObjGenerator Interface

IDIObjGenerator Interface

Create
Create2
Create3

DIObjGenerator serves as a constructor of objects. 

DIObjGenerator is implemented by DIObjGenerator. In this release the only object, which can be created using this interface is a line.

There are two ways of obtaining IDIObjectGenerator: 

1. Created an Object Generator object directly as described in Object Generator topic and query IDIObjectGenerator from it.

2. Query DIObjGenerator from IModel interface. For this method to work the IModel must be obtained from the KernelCAD component using GetModel method.

See also Object Array sample, Cannon sample, Interface List


HRESULT Create(EObjectType eType, IUnknown **ppIUnknown)

Parameters

eType - [in] member of the Object type enumeration

ppIUnknown - [out, retval] pointer to variable, which will receive IUnknown interface, implemented by the created object. Normally actual type of the returned interface is different (but inherited from) IUnknown. For example, in case eType = eObjTypeLine it is ILine interface.  

Returns

S_OK in case of success.

Remarks:

Call to this method will create an object of type eType and will query from it a default interface, specific for the type, which will be returned in ppIUnknown.


HRESULT Create2(EObjectType eType, VARIANT* item)

Parameters

eType - [in] member of the Object type enumeration

item - [out, retval] reference to a VARIANT variable, which will receive IUnknown interface, implemented by the created object. Normally actual type of the returned interface is different (but inherited from) IUnknown. For example, in case eType = eObjTypeLine it is ILine interface. 

Returns

S_OK in case of success.

Remarks:

Create2 is an overloaded version of the Create method, provided for environments, which do not recognize IUnknown type.


HRESULT Create3(char* type, IUnknown **iUnknownt)

Parameters

type - [in] type name of the object. See remarks

ppIUnknown - [out, retval] pointer to variable, which will receive IUnknown interface, implemented by the created object. Normally actual type of the returned interface is different (but inherited from) IUnknown. For example, in case eType = eObjTypeLine it is ILine interface.  

Returns

S_OK in case of success.

Remarks:

Create3 is another version of the Create method aded in version 4.0 for wrapped OCCT types. The type parameter is described in documentation of relevant interfaces. For OCCT - related interfaces the name coinsides with name of the interface with front I letter removed. For example to create a 3D  circle use:

IKO_gp_Circ* iCurc = NULL;  iDIObjGenerator->Create3("KO_gp_Circ", (IUnknown**)&iCirc);               (Native C++)

IKO_gp_Circ iCirc = (IKO_gp_Circ) iDIObjGenerator.Create3("KO_gp_Circ");                                           (C#)

Dim iCurc As IKO_gp_Circ =  iDIObjGenerator.Create3("KO_gp_Circ")                                                    (Visual Basic .NET)

The method also creates the following native KC objects:

Type Returned interface
"VirtualView" IVirtualView
"Dictionary_KC" IDictionary_KC