RemoveInstanceRecursively
In case checkInverseRelations is non-zero only instances that are not referenced
by other existing instances.
Return value is total number of removed instances
Syntax
public const string EngineDLL = @"engine.dll";[DllImport(EngineDLL, EntryPoint = "RemoveInstanceRecursively")] public static extern Int64 RemoveInstanceRecursively(Int64 owlInstance);
Property owlInstance
Size: 64 bit / 8 byte (value)
Example
Here you can find code snippits that show how the API call RemoveInstanceRecursively 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"), classCylinder = Engine.x86_64.GetClassByName(model, "Cylinder"), classMatrix = Engine.x86_64.GetClassByName(model, "Matrix"), classTransformation = Engine.x86_64.GetClassByName(model, "Transformation"); // // Object Properties (relations) // Int64 propertyMatrix = Engine.x86_64.GetPropertyByName(model, "matrix"), propertyObject = Engine.x86_64.GetPropertyByName(model, "object"); // // Datatype Properties (attributes) // Int64 property_42 = Engine.x86_64.GetPropertyByName(model, "_42"), propertyLength = Engine.x86_64.GetPropertyByName(model, "length"), propertyRadius = Engine.x86_64.GetPropertyByName(model, "radius"); // // Instances (creating) // Int64 instanceCube = Engine.x86_64.CreateInstance(classCube, (string) null), instanceCylinder = Engine.x86_64.CreateInstance(classCylinder, (string) null), instanceMatrix = Engine.x86_64.CreateInstance(classMatrix, (string) null), instanceTransformation = Engine.x86_64.CreateInstance(classTransformation, (string) null); Engine.x86_64.SetObjectProperty(instanceTransformation, propertyObject, ref instanceCylinder, 1); Engine.x86_64.SetObjectProperty(instanceTransformation, propertyMatrix, ref instanceMatrix, 1); double lengthCube = 2.1, lengthCyl = 2.8, radiusCyl = 1.3, offsetY = -1.2; Engine.x86_64.SetDatatypeProperty(instanceCube, propertyLength, ref lengthCube, 1); Engine.x86_64.SetDatatypeProperty(instanceCylinder, propertyLength, ref lengthCyl, 1); Engine.x86_64.SetDatatypeProperty(instanceCylinder, propertyRadius, ref radiusCyl, 1); Engine.x86_64.SetDatatypeProperty(instanceMatrix, property_42, ref offsetY, 1); Int64 instanceCnt = 0; Engine.x86_64.OrderedHandles(model, (IntPtr) 0, (IntPtr) 0, out instanceCnt, 0, 0); System.Diagnostics.Debug.Assert(instanceCnt == 4); Engine.x86_64.RemoveInstanceRecursively(instanceCylinder); // this will not remove the Cylinder instance as it is referenced Engine.x86_64.OrderedHandles(model, (IntPtr) 0, (IntPtr) 0, out instanceCnt, 0, 0); System.Diagnostics.Debug.Assert(instanceCnt == 4); Engine.x86_64.RemoveInstanceRecursively(instanceTransformation); Engine.x86_64.OrderedHandles(model, (IntPtr) 0, (IntPtr) 0, out instanceCnt, 0, 0); System.Diagnostics.Debug.Assert(instanceCnt == 1); // // The resulting model can be viewed in 3D-Editor.exe // Engine.x86_64.SaveModel(model, "c:\\created\\myFile.bin"); Engine.x86_64.CloseModel(model); } }