GetInstanceClass

Returns the handle to the class of which an instances is instantiated.

Note: internally this function is not rich enough as support for multiple inheritance
    is making it impossible to answer this request with always one class handle.
    Even in the case of pure single inheritance an instance of a class is also an instance of
    every parent classes in the inheritance tree. For now we expect single inheritance use
    and the returned class handle points to the 'lowest' class in the inheritance tree.

Syntax

public const string EngineDLL = @"engine.dll";[DllImport(EngineDLL, EntryPoint = "GetInstanceClass")]
public static extern Int64 GetInstanceClass(Int64 owlInstance);    

Property owlInstance

Size: 64 bit / 8 byte (value)
The handle to the specific instance in the design tree. The instance handle is static within one open model but is most probably different when the same instance is opened in another model. The instance is always exactly of one unique class.

Example

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

using Engine;

static void Main(string[] args)
{
    Int64 model = Engine.x86_64.CreateModel();

    if (model != 0)
    {
        //
        //  Classes
        //
        Int64   classAbcd = Engine.x86_64.CreateClass(model, "ABCD"),
                classCube = Engine.x86_64.CreateClass(model, "Cube"),
                classMatrix = Engine.x86_64.CreateClass(model, "Matrix");

        //
        //  Instances
        //
        Int64   instanceAbcd = Engine.x86_64.CreateInstance(classAbcd, (string) null),
                instanceCube = Engine.x86_64.CreateInstance(classCube, (string) null),
                instanceMatrixI = Engine.x86_64.CreateInstance(classMatrix, (string) null),
                instanceMatrixII = Engine.x86_64.CreateInstance(classMatrix, (string) null);

        System.Diagnostics.Debug.Assert(Engine.x86_64.GetInstanceClass(instanceAbcd) == classAbcd);
        System.Diagnostics.Debug.Assert(Engine.x86_64.GetInstanceClass(instanceCube) == classCube);
        System.Diagnostics.Debug.Assert(Engine.x86_64.GetInstanceClass(instanceMatrixI) == Engine.x86_64.GetInstanceClass(instanceMatrixII));

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