CreateInstanceW

Returns a handle to an on the fly created instance.
If the owlClass input is zero or not a class handle 0 will be returned,

Syntax

//
//   Strong typing definition
//
OwlInstance     CreateInstanceW(
                        OwlClass                owlClass,
                        const wchar_t           * name
                    );

static  inline  OwlInstance CreateInstanceW(
                                    OwlClass                owlClass,
                                    wchar_t                 * name
                                )
{
    return  CreateInstanceW(
                    owlClass,
                    (const wchar_t*) name
                );
}

static  inline  OwlInstance CreateInstanceW(
                                    OwlClass                owlClass
                                )
{
    const wchar_t  * name = nullptr;
    return  CreateInstanceW(
                    owlClass,
                    (const wchar_t*) name
                );
}


//
//   Weak typing definition
//
int64_t __declspec(dllexport) __stdcall CreateInstanceW(
                                                int64_t                 owlClass,
                                                const wchar_t           * name
                                            );

static  inline  int64_t CreateInstanceW(
                                int64_t                 owlClass,
                                wchar_t                 * name
                            )
{
    return  CreateInstanceW(
                    owlClass,
                    (const wchar_t*) name
                );
}

static  inline  int64_t CreateInstanceW(
                                int64_t                 owlClass
                            )
{
    const wchar_t  * name = nullptr;
    return  CreateInstanceW(
                    owlClass,
                    (const wchar_t*) name
                );
}
    

Property owlClass

Size: 64 bit / 8 byte (value)
This attribute represents a handle to the class. The term owl is comming from W3C, the classes follow the expression power of Semantic Web concepts, therefore classes support multiple inheritance. Technically classes can also be distributed over different resources, however for this the parametric library is required as an extension on the basic Geometry Kernel API.

Property name

Size: 32 bit / 4 byte (reference)
This attribute represents the name of the instance (given as wchar_t array / Unicode). The name is given by the host and the attribute is not changed.

Example (based on pure API calls)

Here you can find code snippits that show how the API call CreateInstanceW can be used.

#include    "./include/engine.h"
#include    <cmath>

int64_t model = CreateModel();

if (model) {
    //
    //  Classes
    //
    int64_t classArc3D = GetClassByNameW(model, L"Arc3D");

    //
    //  Datatype Properties (attributes)
    //
    int64_t propertyRadius = GetPropertyByNameW(model, L"radius"),
            propertyStart = GetPropertyByNameW(model, L"start"),
            propertySize = GetPropertyByNameW(model, L"size"),
            propertySegmentationParts = GetPropertyByNameW(model, L"segmentationParts");

    //
    //  Instances (creating)
    //
    int64_t myInstanceArc3D = CreateInstanceW(classArc3D, nullptr);

    double  Pi = 2. * acos(0.),
            radius = 2.1,
            start = 0.,
            size = 2. * Pi;
    int64_t segmentationParts = 36;
        
    SetDatatypeProperty(myInstanceArc3D, propertyRadius, &radius, 1);
    SetDatatypeProperty(myInstanceArc3D, propertyStart, &start, 1);     //  in this case we could also do without, i.e. default value
    SetDatatypeProperty(myInstanceArc3D, propertySize, &size, 1);       //  in this case we could also do without, i.e. default value
    SetDatatypeProperty(myInstanceArc3D, propertySegmentationParts, &segmentationParts, 1);

    //
    //  The resulting model can be viewed in 3D-Editor.exe
    //
    SaveModelW(model, L"c:\\created\\myFile.bin");
    CloseModel(model);
}