This function saves the selected instance and its dependancies in an array.


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

[DllImport(enginedll, EntryPoint = "SaveInstanceTreeA")]
public static extern Int64 SaveInstanceTreeA(Int64 owlInstance, byte[] content, out Int64 size);    

Property owlInstance

Size: 64 bit / 8 byte (value)
The handle to the specific instance in the design tree. The instance handle is static within one open model but is most probably different when the same instance is opened in another model. The instance is always exactly of one unique class.

Property content

Size: 32 bit / 4 byte (reference)
The content of this IO call, the size of the content is defined by attribute size.

Property size

Size: 32 bit / 4 byte (reference)
The size of the content as defined in number of bytes.

Example (based on pure API calls)

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

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


    public class OUT
        public OUT(Int64 myInstance)
            FileStream fs = File.Open("exportedFile.bin", FileMode.Create);

            Int64 size = 0;
            RDF.engine.SaveInstanceTreeA(myModel, 0, out size);

            byte[] buffer = new byte[size];
            RDF.engine.SaveInstanceTreeA(myModel, buffer, out size);

            fs.Write(buffer, 0, (int) size);