GetGeometryClass

Returns non-zero if the owlClass is a geometry type. This call will return the input class for all classes initially available. It will return as well non-for all classes created by the user or loaded / imported through a model that (indirectly) inherit one of the original classes available. in this case it returns the original available class it inherits the behavior from.

Syntax

public const string EngineDLL = @"engine.dll";[DllImport(EngineDLL, EntryPoint = "GetGeometryClass")]
public static extern Int64 GetGeometryClass(Int64 owlClass);    

Property owlClass

Size: 64 bit / 8 byte (value)
This attribute represents a handle to the class. The term owl is comming from W3C, the classes follow the expression power of Semantic Web concepts, therefore classes support multiple inheritance. Technically classes can also be distributed over different resources, however for this the parametric library is required as an extension on the basic Geometry Kernel API.

Example

Here you can find code snippits that show how the API call GetGeometryClass can be used.

using Engine;

static void Main(string[] args)
{
    Int64 model = Engine.x86_64.CreateModel();

    if (model != 0)
    {
        //
        //  The following class will be created on-the-fly if the name is not used already
        //  for a class or property (attribute / relation).
        //
        //  note: calling GetClassByName with a name not yet existing will do the same trick)
        //
        Int64   classMyOwnCylinderClass = Engine.x86_64.CreateClass(model, "MyOwnCylinderClass");

        //
        //  Specific for C#, note that the following call is also allowed,
        //  they should give the same result as we expect to use only ASCII characters in the context of this call
        //
        Int64   classMyOwnSecondClass = Engine.x86_64.CreateClass(model, System.Text.Encoding.ASCII.GetBytes("MyOwnSecondClass"));
    

        //
        //  Classes
        //
        Int64   classCylinder = Engine.x86_64.GetClassByName(model, "Cylinder");

        //
        //  Datatype Properties (attributes)
        //
        Int64   propertyLength = Engine.x86_64.GetPropertyByName(model, "length"),
                propertyRadius = Engine.x86_64.GetPropertyByName(model, "radius"),
                propertySegmentationParts = Engine.x86_64.GetPropertyByName(model, "segmentationParts");

        //
        //  Instances
        //
        Int64   instanceMyOwnCylinderClass = Engine.x86_64.CreateInstance(classMyOwnCylinderClass, (string) null);

        //
        //  At this moment our new class is unrelated to other classes and instances of it not generating any geometry
        //
        System.Diagnostics.Debug.Assert(Engine.x86_64.GetGeometryClass(classMyOwnCylinderClass) == 0);

        Engine.x86_64.SetClassParent(classMyOwnCylinderClass, classCylinder, 1);

        //
        //  Now each instance of MyOwnCylinderClass is inheriting the behavior and knowledge of a Cylinder
        //
        System.Diagnostics.Debug.Assert(Engine.x86_64.GetGeometryClass(classMyOwnCylinderClass) == classCylinder);

        double  length = 1.8,
                radius = 1.3;
        Int64   segmentationParts = 36;
        
        Engine.x86_64.SetDatatypeProperty(instanceMyOwnCylinderClass, propertyLength, ref length, 1);
        Engine.x86_64.SetDatatypeProperty(instanceMyOwnCylinderClass, propertyRadius, ref radius, 1);
        Engine.x86_64.SetDatatypeProperty(instanceMyOwnCylinderClass, propertySegmentationParts, ref segmentationParts, 1);

        double  volume = Engine.x86_64.GetVolume(instanceMyOwnCylinderClass, (IntPtr) 0, (IntPtr) 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);
    }
}