This function imports a design tree via a stream.
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().


public const string enginedll = @"engine.dll";

[DllImport(enginedll, EntryPoint = "ImportModelS")]
public static extern Int64 ImportModelS(Int64 model, [MarshalAs(UnmanagedType.FunctionPtr)] ReadCallBackFunction callback);    

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 callback

Size: 32 bit / 4 byte (reference)
The pointer to the function that will be called within this function. Please look at the examples how to create the callback function and how it will be called. In case this is not possible or complex there is an array call, technically the same call, however the callback function is embedded within the library.

Example (based on pure API calls)

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

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


    public class IN
        public const int BLOCK_LENGTH_READ = 65535; //  MAX: 65535

        public FileStream fs;

        public IN(Int64 model)

            // define a progress callback delegate
            RDF.engine.ReadCallBackFunction callback =
                (value) =>
                    byte[] buffer = new byte[BLOCK_LENGTH_READ]; 

                    int size = fs.Read(buffer, 0, BLOCK_LENGTH_READ);

                    Marshal.Copy(buffer, 0, value, size);

                    return (Int64) size;

            fs = File.Open("exampleFile.bin", FileMode.Open);
            myModel = RDF.engine.ImportModelS(model, callback);