ImportModel

This function imports a design tree on location fileName.
The design tree will be added to the given existing model.
The return value contains the first instance not referenced by any other instance or zero if it does not exist. In case the imported model is created with SaveInstanceTree() this instance is unique and equal to the instance used within the call SaveInstanceTree().

Syntax

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

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

Property model

Size: 64 bit / 8 byte (value)
The handle to the model. The model handle is static during its existance. Several models can be opened simultaniously within one session. Different models are always independent, threads are allowed to be running on different models simultaniously.

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 ImportModel can be used.

using Engine;

    ...

    public class OUT
    {
        public void MergeModel(Int64 model, string fileNameIN, string fileNameOUT)
        {
            //
            //  Add content from file into current model 
            //
            Engine.x86_64.ImportModel(model, System.Text.Encoding.ASCII.GetBytes(fileNameIN));

            //
            //  Save original and added content into a new file
            //
            Engine.x86_64.SaveModel(model, System.Text.Encoding.ASCII.GetBytes(fileNameOUT));
        }

        public void main()
        {
            Int64 model = Engine.x86_64.OpenModel(System.Text.Encoding.ASCII.GetBytes("c:\\created\\myFileFirstPart.bin"));

            if (model != 0)
            {
                MergeModel(model, "c:\\created\\myFileSecondPart.bin", "c:\\created\\myMergedFile.bin");

                Engine.x86_64.CloseModel(model);
            }
            else
            {
                System.Diagnostics.Debug.Assert(false);
            }
        }
    }

    ...