GetNameOfClass
Syntax
public const string enginedll = @"engine.dll"; [DllImport(enginedll, EntryPoint = "GetNameOfClass")] public static extern IntPtr GetNameOfClass(Int64 owlClass, out IntPtr name); public static string GetNameOfClass(Int64 owlClass) { IntPtr name = IntPtr.Zero; GetNameOfClass(owlClass, out name); return System.Runtime.InteropServices.Marshal.PtrToStringAnsi(name); }
Property owlClass
Size: 64 bit / 8 byte (value)Property name
Size: 64 bit / 8 byte (reference)
Example (based on pure API calls)
Here you can find code snippits that show how the API call GetNameOfClass 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.CreateClass(model, "MyCreatedClass"); // // Datatype Properties (attributes) // Int64 propertyLength = RDF.engine.GetPropertyByName(model, "length"); // // Instances (creating) // Int64 myInstance = RDF.engine.CreateInstance(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.GetNameOfClass(myClass, out classNamePtrI); string classNameI = System.Runtime.InteropServices.Marshal.PtrToStringAnsi(classNamePtrI); RDF.engine.SetNameOfClass(myClass, "OtherClassName"); IntPtr classNamePtrII = IntPtr.Zero; RDF.engine.GetNameOfClass(myClass, out classNamePtrII); string classNameII = System.Runtime.InteropServices.Marshal.PtrToStringAnsi(classNamePtrII); RDF.engine.SetClassParent(myClass, RDF.engine.GetClassByName(model, "Cube"), 1); System.Diagnostics.Debug.Assert(RDF.engine.GetVolume(myInstance, (IntPtr) 0, (IntPtr) 0) == 8.0); RDF.engine.SetNameOfClass(myClass, "OutOfIdeasForClassName"); IntPtr classNamePtrIII = IntPtr.Zero; RDF.engine.GetNameOfClass(myClass, out classNamePtrIII); string classNameIII = System.Runtime.InteropServices.Marshal.PtrToStringAnsi(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.SaveModel(model, "c:\\created\\myFile.bin"); RDF.engine.CloseModel(model); } }