OpenModelW

This function opens the model on location fileName.
References inside to other ontologies will be included.
A handle to the model will be returned, or 0 in case something went wrong.

Syntax

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

[DllImport(EngineDLL, EntryPoint = "OpenModelW")]
public static extern Int64 OpenModelW(byte[] fileName);    

Property fileName

Size: 64 bit / 8 byte (reference)
The file name of the file as available in the file system in Unicode (wchar_t *). The given wchar_t array will not be adjusted. The size of each wchar_t element is depending on the OS, both 16 bit / 2 bytes wchar_t elements as well as 32 bit / 4 byte wchar_t elements are recognized and supported.

Example

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

using Engine;

...

Int64 GetFileInstanceCount(string fileName)
{
    Int64   instanceCount = 0,
            model = Engine.x86_64.OpenModelW(System.Text.Encoding.Unicode.GetBytes(fileName));
    
    if (model)
    {
        Int64   myInstance = Engine.x86_64.GetInstancesByIterator(model, 0);

        while (myInstance != 0)
        {
            instanceCount++;
            myInstance = Engine.x86_64.GetInstancesByIterator(model, myInstance);
        }

        Engine.x86_64.CloseModel(model);
    }

    return  instanceCount;
}

int main()
{
    Int64   noInstances = GetFileInstanceCount("c:\\created\\myFile.bin");
}