GetNameOfClassW

Returns the name of the class, if the class does not exist it returns nullptr.

Syntax

public const string enginedll = @"engine.dll";

[DllImport(enginedll, EntryPoint = "GetNameOfClassW")]
public static extern IntPtr GetNameOfClassW(Int64 owlClass, out IntPtr name);

public static string GetNameOfClassW(Int64 owlClass)
        {
            IntPtr name = IntPtr.Zero;
            GetNameOfClassW(owlClass, out name);
            return System.Runtime.InteropServices.Marshal.PtrToStringUni(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 class (given as wchar_t array / Unicode). The name is defined in space allocated by the library, this memory will be released as soon as the model is closed, or memory release is forced by CleanMemory.

Example (based on pure API calls)

Here you can find code snippits that show how the API call GetNameOfClassW 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   myClass = RDF.engine.CreateClassW(model, System.Text.Encoding.Unicode.GetBytes("MyCreatedClass"));

        //
        //  Datatype Properties (attributes)
        //
        Int64   propertyLength = RDF.engine.GetPropertyByNameW(model, System.Text.Encoding.Unicode.GetBytes("length"));

        //
        //  Instances (creating)
        //
        Int64   myInstance = RDF.engine.CreateInstanceW(myClass, (string) null);

        double  length = 2.0;

        RDF.engine.SetDatatypeProperty(myInstance, propertyLength, ref length, 1);

        System.Diagnostics.Debug.Assert(RDF.engine.GetVolume(myInstance, (IntPtr) 0, (IntPtr) 0) == 0.0);

        IntPtr  classNamePtrI = IntPtr.Zero;
        RDF.engine.GetNameOfClassW(myClass, out classNamePtrI);
        string classNameI = System.Runtime.InteropServices.Marshal.PtrToStringUni(classNamePtrI);


        RDF.engine.SetNameOfClassW(myClass, System.Text.Encoding.Unicode.GetBytes("OtherClassName"));

        IntPtr  classNamePtrII = IntPtr.Zero;
        RDF.engine.GetNameOfClassW(myClass, out classNamePtrII);
        string classNameII = System.Runtime.InteropServices.Marshal.PtrToStringUni(classNamePtrII);

        RDF.engine.SetClassParent(myClass, RDF.engine.GetClassByNameW(model, System.Text.Encoding.Unicode.GetBytes("Cube")), 1);

        System.Diagnostics.Debug.Assert(RDF.engine.GetVolume(myInstance, (IntPtr) 0, (IntPtr) 0) == 8.0);

        RDF.engine.SetNameOfClassW(myClass, System.Text.Encoding.Unicode.GetBytes("OutOfIdeasForClassName"));

        IntPtr  classNamePtrIII = IntPtr.Zero;
        RDF.engine.GetNameOfClassW(myClass, out classNamePtrIII);
        string classNameIII = System.Runtime.InteropServices.Marshal.PtrToStringUni(classNamePtrIII);

        //
        //  The retrieved class names have the following values 
        //      classNameI   :  'MyCreatedClass'
        //      classNameII  :  'OtherClassName'
        //      classNameIII :  'OutOfIdeasForClassName'
        //

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