ImportModel

This function imports a design tree on location file name.
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: 64 bit / 8 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 (based on pure API calls)

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

using RDF;      //  include at least engine.cs within your solution

    ...

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

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

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

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

                RDF.engine.CloseModel(model);
            }
            else
            {
                System.Diagnostics.Debug.Assert(false);
            }
        }
    }

    ...