UpdateInstance
This function will also set the 'derived' values for the instance passed as argument.
For example the coordinates values of a MultiplicationMatrix will be set if the array is
defined.
Syntax
public const string EngineDLL = @"engine.dll";[DllImport(EngineDLL, EntryPoint = "UpdateInstance")] public static extern Int64 UpdateInstance(Int64 owlInstance);
Property owlInstance
Size: 64 bit / 8 byte (value)
Example
Here you can find code snippits that show how the API call UpdateInstance can be used.
using Engine; static void Main(string[] args) { Int64 model = Engine.x86_64.CreateModel(); if (model != 0) { Int64 classInverseMatrix = Engine.x86_64.GetClassByName(model, "InverseMatrix"), classMatrix = Engine.x86_64.GetClassByName(model, "Matrix"); // // Object Properties (relations) // Int64 propertyMatrix = Engine.x86_64.GetPropertyByName(model, "matrix"); // // Datatype Properties (attributes) // Int64 property_21 = Engine.x86_64.GetPropertyByName(model, "_21"), property_33 = Engine.x86_64.GetPropertyByName(model, "_33"), property_42 = Engine.x86_64.GetPropertyByName(model, "_42"); // // Instances (creating) // Int64 instanceInverseMatrix = Engine.x86_64.CreateInstance(classInverseMatrix, (string) null), instanceMatrix = Engine.x86_64.CreateInstance(classMatrix, (string) null); Engine.x86_64.SetObjectProperty(instanceInverseMatrix, propertyMatrix, ref instanceMatrix, 1); double translationY = 2.8; Engine.x86_64.SetDatatypeProperty(instanceMatrix, property_42, ref translationY, 1); Int64 card = 0; IntPtr valuesPtr = IntPtr.Zero; Engine.x86_64.GetDatatypeProperty(instanceMatrix, property_21, out valuesPtr, out card); System.Diagnostics.Debug.Assert(card == 0); Engine.x86_64.GetDatatypeProperty(instanceMatrix, property_33, out valuesPtr, out card); System.Diagnostics.Debug.Assert(card == 0); Engine.x86_64.GetDatatypeProperty(instanceInverseMatrix, property_42, out valuesPtr, out card); System.Diagnostics.Debug.Assert(card == 0); Engine.x86_64.GetDatatypeProperty(instanceInverseMatrix, property_33, out valuesPtr, out card); System.Diagnostics.Debug.Assert(card == 0); // // Force to apply a calculation of the tree, // CalculateInstance without further non-zero arguments has the same effect. // Engine.x86_64.UpdateInstance(instanceInverseMatrix); // // Assign all implicitely known values // Engine.x86_64.InferenceInstance(instanceInverseMatrix); Engine.x86_64.GetDatatypeProperty(instanceMatrix, property_21, out valuesPtr, out card); System.Diagnostics.Debug.Assert(card == 1); if (card > 0) { double[] values = new double[card]; System.Runtime.InteropServices.Marshal.Copy(valuesPtr, values, 0, (int) card); System.Diagnostics.Debug.Assert(values[0] == 0.0); } Engine.x86_64.GetDatatypeProperty(instanceMatrix, property_33, out valuesPtr, out card); System.Diagnostics.Debug.Assert(card == 1); if (card > 0) { double[] values = new double[card]; System.Runtime.InteropServices.Marshal.Copy(valuesPtr, values, 0, (int) card); System.Diagnostics.Debug.Assert(values[0] == 1.0); } Engine.x86_64.GetDatatypeProperty(instanceInverseMatrix, property_42, out valuesPtr, out card); System.Diagnostics.Debug.Assert(card == 1); if (card > 0) { double[] values = new double[card]; System.Runtime.InteropServices.Marshal.Copy(valuesPtr, values, 0, (int) card); System.Diagnostics.Debug.Assert(values[0] == -translationY); } Engine.x86_64.GetDatatypeProperty(instanceInverseMatrix, property_33, out valuesPtr, out card); System.Diagnostics.Debug.Assert(card == 1); if (card > 0) { double[] values = new double[card]; System.Runtime.InteropServices.Marshal.Copy(valuesPtr, values, 0, (int) card); System.Diagnostics.Debug.Assert(values[0] == 1.0); } // // The resulting model can be viewed in 3D-Editor.exe // Engine.x86_64.SaveModel(model, "c:\\created\\myFile.bin"); Engine.x86_64.CloseModel(model); } }