GetNameOfInstanceW
Syntax
public const string enginedll = @"engine.dll"; [DllImport(enginedll, EntryPoint = "GetNameOfInstanceW")] public static extern IntPtr GetNameOfInstanceW(Int64 owlInstance, out IntPtr name); public static string GetNameOfInstanceW(Int64 owlInstance) { IntPtr name = IntPtr.Zero; GetNameOfInstanceW(owlInstance, out name); return System.Runtime.InteropServices.Marshal.PtrToStringUni(name); }
Property owlInstance
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 GetNameOfInstanceW 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 classCube = RDF.engine.GetClassByNameW(model, System.Text.Encoding.Unicode.GetBytes("Cube")); // // Datatype Properties (attributes) // Int64 propertyLength = RDF.engine.GetPropertyByNameW(model, System.Text.Encoding.Unicode.GetBytes("length")); // // Instances (creating) // Int64 myInstanceI = RDF.engine.CreateInstanceW(classCube, System.Text.Encoding.Unicode.GetBytes("")), myInstanceII = RDF.engine.CreateInstanceW(classCube, System.Text.Encoding.Unicode.GetBytes("secondInstance")); System.Diagnostics.Debug.Assert(RDF.engine.GetVolume(myInstanceI, (IntPtr) 0, (IntPtr) 0) == 0.0); double length = 2.0; RDF.engine.SetDatatypeProperty(myInstanceI, propertyLength, ref length, 1); IntPtr instanceNamePtrI = IntPtr.Zero; RDF.engine.GetNameOfInstanceW(myInstanceI, out instanceNamePtrI); string instanceNameI = System.Runtime.InteropServices.Marshal.PtrToStringUni(instanceNamePtrI); length += 1.0; RDF.engine.SetDatatypeProperty(myInstanceII, propertyLength, ref length, 1); IntPtr instanceNamePtrII = IntPtr.Zero; RDF.engine.GetNameOfInstanceW(myInstanceII, out instanceNamePtrII); string instanceNameII = System.Runtime.InteropServices.Marshal.PtrToStringUni(instanceNamePtrII); RDF.engine.SetNameOfInstanceW(myInstanceI, System.Text.Encoding.Unicode.GetBytes("firstInstance")); RDF.engine.SetNameOfInstanceW(myInstanceII, (string) null); System.Diagnostics.Debug.Assert(RDF.engine.GetArea(myInstanceI, (IntPtr) 0, (IntPtr) 0) == 24.0); System.Diagnostics.Debug.Assert(RDF.engine.GetVolume(myInstanceII, (IntPtr) 0, (IntPtr) 0) == 27.0); IntPtr instanceNamePtrIII = IntPtr.Zero; RDF.engine.GetNameOfInstanceW(myInstanceI, out instanceNamePtrIII); string instanceNameIII = System.Runtime.InteropServices.Marshal.PtrToStringUni(instanceNamePtrIII); IntPtr instanceNamePtrIV = IntPtr.Zero; RDF.engine.GetNameOfInstanceW(myInstanceII, out instanceNamePtrIV); string instanceNameIV = System.Runtime.InteropServices.Marshal.PtrToStringUni(instanceNamePtrIV); // // The retrieved instance names have the following values // instanceNameI : '' // instanceNameII : 'secondInstance' // instanceNameIII : 'firstInstance' // instanceNameIV : null // // // 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); } }