GetParentsByIterator
If input parent is zero, the handle will point to the first relevant parent.
If all parent are past (or no relevant parent are found), the function will return 0.
Syntax
public const string EngineDLL = @"engine.dll";[DllImport(EngineDLL, EntryPoint = "GetParentsByIterator")] public static extern Int64 GetParentsByIterator(Int64 owlClass, Int64 parentOwlClass);
Property owlClass
Size: 64 bit / 8 byte (value)Property parentOwlClass
Size: 64 bit / 8 byte (value)
Example
Here you can find code snippits that show how the API call GetParentsByIterator can be used.
using Engine; public bool ClassHasClassAsParent(Int64 childClass, Int64 parentClass) { // // This function checks recursively if a child class has a parent class as parent // if (childClass == parentClass) { return true; } Int64 directParentClass = Engine.x86_64.GetParentsByIterator(childClass, 0); while (directParentClass != 0) { if (ClassHasClassAsParent(directParentClass, parentClass)) { return true; } directParentClass = Engine.x86_64.GetParentsByIterator(childClass, directParentClass); } return false; } public void Example() { Int64 model = Engine.x86_64.CreateModel(); if (model != 0) { // // Classes // Int64 classGeometricItem = Engine.x86_64.GetClassByName(model, "GeometricItem"), classMaterial = Engine.x86_64.GetClassByName(model, "Material"), classSurface = Engine.x86_64.GetClassByName(model, "Surface"), classNURBSSurface = Engine.x86_64.GetClassByName(model, "NURBSSurface"); bool NURBSSurface_is_A_Surface = ClassHasClassAsParent(classNURBSSurface, classSurface), NURBSSurface_is_A_Material = ClassHasClassAsParent(classNURBSSurface, classMaterial), Surface_is_A_GeometricItem = ClassHasClassAsParent(classSurface, classGeometricItem), NURBSSurface_is_A_GeometricItem = ClassHasClassAsParent(classNURBSSurface, classGeometricItem), Surface_is_A_NURBSSurface = ClassHasClassAsParent(classSurface, classNURBSSurface), GeometricItem_is_A_Surface = ClassHasClassAsParent(classGeometricItem, classSurface); System.Diagnostics.Debug.Assert(NURBSSurface_is_A_Surface == true); System.Diagnostics.Debug.Assert(NURBSSurface_is_A_Material == false); System.Diagnostics.Debug.Assert(Surface_is_A_GeometricItem == true); System.Diagnostics.Debug.Assert(NURBSSurface_is_A_GeometricItem == true); System.Diagnostics.Debug.Assert(Surface_is_A_NURBSSurface == false); System.Diagnostics.Debug.Assert(GeometricItem_is_A_Surface == false); Int64 myOwnClass = Engine.x86_64.CreateClass(model, "MyOwnClass"); System.Diagnostics.Debug.Assert(ClassHasClassAsParent(myOwnClass, classNURBSSurface) == false); System.Diagnostics.Debug.Assert(ClassHasClassAsParent(myOwnClass, classGeometricItem) == false); Engine.x86_64.SetClassParent(myOwnClass, classSurface, 1); System.Diagnostics.Debug.Assert(ClassHasClassAsParent(myOwnClass, classNURBSSurface) == false); System.Diagnostics.Debug.Assert(ClassHasClassAsParent(myOwnClass, classGeometricItem) == true); Engine.x86_64.CloseModel(model); } }