OpenModel

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 = "OpenModel")]
public static extern Int64 OpenModel(string fileName);

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

Property fileName

Size: 32 bit / 4 byte (reference)
The file name of the file as available in the file system in ASCII (char *). The given char array will not be adjusted, on each OS the size of a char element is 8 bit / 1 byte.

Example

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

using Engine;

...

static Int64 GetFileInstanceCount(string fileName)
{
    Int64   instanceCount = 0,
            model = Engine.x86_64.OpenModel(System.Text.Encoding.ASCII.GetBytes(fileName));
    
    if (model != 0)
    {
        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;
}

static void Main(string[] args)
{
    Int64   noInstances = GetFileInstanceCount("c:\\created\\myFile.bin");
}