SetNameOfInstanceEx
In case instance does not exist it returns 1, when name cannot be updated 2.
Syntax
public const string EngineDLL = @"engine.dll";[DllImport(EngineDLL, EntryPoint = "SetNameOfInstanceEx")] public static extern Int64 SetNameOfInstanceEx(Int64 model, Int64 owlInstance, string name); [DllImport(EngineDLL, EntryPoint = "SetNameOfInstanceEx")] public static extern Int64 SetNameOfInstanceEx(Int64 model, Int64 owlInstance, byte[] name);
Property model
Size: 64 bit / 8 byte (value)Property owlInstance
Size: 64 bit / 8 byte (value)Property name
Size: 64 bit / 8 byte (reference)
Example
Here you can find code snippits that show how the API call SetNameOfInstanceEx can be used.
using Engine; static void Main(string[] args) { Int64 model = Engine.x86_64.CreateModel(); if (model != 0) { // // Classes // Int64 classCube = Engine.x86_64.GetClassByName(model, "Cube"); Engine.x86_64.CreateInstance(classCube, (string) null); Engine.x86_64.CreateInstance(classCube, (string) null); Engine.x86_64.CreateInstance(classCube, (string) null); // // The following setting makes sure all instance handles are in an ordered list // In certain cases where several models are open or in case of conversion // between formats this can be handy and / or time efficient. // Int64 instanceCnt = 0; Engine.x86_64.OrderedHandles(model, (IntPtr) 0, (IntPtr) 0, out instanceCnt, 4, 4); System.Diagnostics.Debug.Assert(instanceCnt == 3); // // Datatype Properties (attributes) // Int64 propertyLength = Engine.x86_64.GetPropertyByName(model, "length"); // // Instances (creating) // Int64 myInstanceI = Engine.x86_64.CreateInstance(classCube, ""), myInstanceII = Engine.x86_64.CreateInstance(classCube, "secondInstance"); System.Diagnostics.Debug.Assert(myInstanceI == instanceCnt + 1); System.Diagnostics.Debug.Assert(myInstanceII == instanceCnt + 2); double length = 2.0; Engine.x86_64.SetDatatypePropertyEx(model, myInstanceI, propertyLength, ref length, 1); IntPtr instanceNamePtrI = IntPtr.Zero; Engine.x86_64.GetNameOfInstanceEx(model, myInstanceI, out instanceNamePtrI); string instanceNameI = System.Runtime.InteropServices.Marshal.PtrToStringAnsi(instanceNamePtrI); length += 1.0; Engine.x86_64.SetDatatypePropertyEx(model, myInstanceII, propertyLength, ref length, 1); IntPtr instanceNamePtrII = IntPtr.Zero; Engine.x86_64.GetNameOfInstanceEx(model, myInstanceII, out instanceNamePtrII); string instanceNameII = System.Runtime.InteropServices.Marshal.PtrToStringAnsi(instanceNamePtrII); Engine.x86_64.SetNameOfInstanceEx(model, myInstanceI, "firstInstance"); Engine.x86_64.SetNameOfInstanceEx(model, myInstanceII, (string) null); IntPtr instanceNamePtrIII = IntPtr.Zero; Engine.x86_64.GetNameOfInstanceEx(model, myInstanceI, out instanceNamePtrIII); string instanceNameIII = System.Runtime.InteropServices.Marshal.PtrToStringAnsi(instanceNamePtrIII); IntPtr instanceNamePtrIV = IntPtr.Zero; Engine.x86_64.GetNameOfInstanceEx(model, myInstanceII, out instanceNamePtrIV); string instanceNameIV = System.Runtime.InteropServices.Marshal.PtrToStringAnsi(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 // Engine.x86_64.SaveModel(model, "c:\\created\\myFile.bin"); Engine.x86_64.CloseModel(model); } }