SetNameOfClassWEx
In case class does not exist it returns 1, when name cannot be updated 2.
This call has the same behavior as SetNameOfClassW, however needs to be
used in case classes are exchanged as a successive series of integers.
Syntax
public const string EngineDLL = @"engine.dll";[DllImport(EngineDLL, EntryPoint = "SetNameOfClassWEx")] public static extern Int64 SetNameOfClassWEx(Int64 model, Int64 owlClass, string name); [DllImport(EngineDLL, EntryPoint = "SetNameOfClassWEx")] public static extern Int64 SetNameOfClassWEx(Int64 model, Int64 owlClass, byte[] name);
Property model
Size: 64 bit / 8 byte (value)Property owlClass
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 SetNameOfClassWEx can be used.
using Engine; static void Main(string[] args) { Int64 model = Engine.x86_64.CreateModel(); if (model != 0) { // // The following setting makes sure all class handled 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 classCnt = 0; Engine.x86_64.OrderedHandles(model, out classCnt, (IntPtr) null, (IntPtr) null, 1, 1); // // Classes // Int64 myClass = Engine.x86_64.CreateClassW(model, System.Text.Encoding.Unicode.GetBytes("MyCreatedClass")); // // Datatype Properties (attributes) // Int64 propertyLength = Engine.x86_64.GetPropertyByNameW(model, System.Text.Encoding.Unicode.GetBytes("length")); // // Instances (creating) // Int64 myInstance = Engine.x86_64.CreateInstanceWEx(model, myClass, (string) null); double length = 2.0; Engine.x86_64.SetDatatypeProperty(myInstance, propertyLength, ref length, 1); System.Diagnostics.Debug.Assert(Engine.x86_64.GetVolume(myInstance, (IntPtr) 0, (IntPtr) 0) == 0.0); IntPtr classNamePtrI = IntPtr.Zero; Engine.x86_64.GetNameOfClassWEx(model, myClass, out classNamePtrI); string classNameI = System.Runtime.InteropServices.Marshal.PtrToStringUni(classNamePtrI); Engine.x86_64.SetNameOfClassWEx(model, myClass, System.Text.Encoding.Unicode.GetBytes("OtherClassName")); IntPtr classNamePtrII = IntPtr.Zero; Engine.x86_64.GetNameOfClassWEx(model, myClass, out classNamePtrII); string classNameII = System.Runtime.InteropServices.Marshal.PtrToStringUni(classNamePtrII); Engine.x86_64.SetClassParentEx(model, myClass, Engine.x86_64.GetClassByNameW(model, System.Text.Encoding.Unicode.GetBytes("Cube")), 1); System.Diagnostics.Debug.Assert(Engine.x86_64.GetVolume(myInstance, (IntPtr) 0, (IntPtr) 0) == 8.0); Engine.x86_64.SetNameOfClassWEx(model, myClass, System.Text.Encoding.Unicode.GetBytes("OutOfIdeasForClassName")); IntPtr classNamePtrIII = IntPtr.Zero; Engine.x86_64.GetNameOfClassWEx(model, 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 // Engine.x86_64.SaveModelW(model, System.Text.Encoding.Unicode.GetBytes("c:\\created\\myFile.bin")); Engine.x86_64.CloseModel(model); } }