GetInstanceClass

Returns the handle to the class of which the instance is instantiated. In case the instance is instantiated on more than one class it will return 0.

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 (based on pure API calls)

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

using RDF;      //  include at least engine.cs within your solution

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

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

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

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

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