GetClassesByIterator

Returns a handle to an class.
If input class is zero, the handle will point to the first relevant class.
If all classes are past (or no relevant classes are found), the function will return 0.

Syntax

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

Property model

Size: 64 bit / 8 byte (value)
The handle to the model. The model handle is static during its existance. Several models can be opened simultaniously within one session. Different models are always independent, threads are allowed to be running on different models simultaniously.

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.

Example

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

using Engine;

public Int64 GetClassCnt(Int64 model)
{
    Int64   classCnt = 0,
            myIteratedClass = Engine.x86_64.GetClassesByIterator(model, 0);
    while (myIteratedClass != 0) {
        IntPtr    classNamePtr = IntPtr.Zero;
        Engine.x86_64.GetNameOfClass(myIteratedClass, out classNamePtr);
        string className = System.Runtime.InteropServices.Marshal.PtrToStringAnsi(classNamePtr);
        Console.WriteLine(className);
        myIteratedClass = Engine.x86_64.GetClassesByIterator(model, myIteratedClass);
        classCnt++;
    }
    Console.WriteLine();

    return  classCnt;
}

public void Example()
{
    Int64 model = Engine.x86_64.CreateModel();

    if (model != 0)
    {
        Int64   classCnt = GetClassCnt(model);

        //
        //  Add a new class
        //
        Engine.x86_64.CreateClass(model, "CreatedClassToTestClassCnt");

        System.Diagnostics.Debug.Assert(GetClassCnt(model) == classCnt + 1);

        Int64   classCntThroughAPI = 0;
        Engine.x86_64.OrderedHandles(model, out classCntThroughAPI, (IntPtr) null, (IntPtr) null, 0, 0);

        System.Diagnostics.Debug.Assert(GetClassCnt(model) == classCntThroughAPI);

        Engine.x86_64.CloseModel(model);
    }
}