sdaiSaveModelAsXmlBN

This call can be used to save a model in XML Format, this XML serialization is advised for ifcXML files of schema IFC2x3 TC1 and before. The file name can be any ASCII filename with a character length of 8 bits.

Syntax

public const string IFCEngineDLL = @"IFCEngine.dll";

[DllImport(IFCEngineDLL, EntryPoint = "sdaiSaveModelAsXmlBN")]
public static extern void sdaiSaveModelAsXmlBN(Int64 model, string fileName);

[DllImport(IFCEngineDLL, EntryPoint = "sdaiSaveModelAsXmlBN")]
public static extern void sdaiSaveModelAsXmlBN(Int64 model, byte[] fileName);    

Property model

Size: 64 bit / 8 byte (value)
Handle of the model containing the IFC file, this handle is needed in many other calls and given when the model is created.

Property fileName

Size: 64 bit / 8 byte (reference)
Address of string containing the path of the IFC file, for example 'C:\myPath\myFile.ifc' or 'C:\myPath\myFile.ifcXML'.

Examples

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

string ifcFileName = "myFile.ifc";

//
//  In case input strings are already UTF8, the following line 
//
Int64 model = IfcEngine.x64.sdaiOpenModelBN(0, ifcFileName, "IFC2X3_TC1.exp");     //  The schema file is expected to be IFC2X3_TC1.exp as this XML format is typically used for IFC 2x3 (TC1)

//
//  In case it is not sure each element with the string is UTF8, the following line is save
//    (will convert some of the characters, use of sdaiOpenModelBNUnicode is prefered)
//
Int64 model = IfcEngine.x64.sdaiOpenModelBN(0, System.Text.Encoding.UTF8.GetBytes(ifcFileName), System.Text.Encoding.UTF8.GetBytes("IFC2X3_TC1.exp"));

if (model != 0)
{
    ...         //  Use the open model to read/write/edit the content
    ...         //  or to create geometry

    string ifcFileNameSaving = "mySavedFile.ifc";            //  The file name is expected to end at .ifx or .ifcXML, this is of course totally free from technical Point-Of-View
    ...

    //
    //  In case input strings are already UTF8, the following line
    //
    IfcEngine.x64.sdaiSaveModelAsXmlBN(model, ifcFileNameSaving);

    //
    //  In case it is not sure each element with the string is UTF8, the following line is save
    //    (will convert some of the characters, use of sdaiSaveModelAsXmlBNUnicode is prefered)
    //
    IfcEngine.x64.sdaiSaveModelAsXmlBN(model, System.Text.Encoding.UTF8.GetBytes(ifcFileNameSaving));

    IfcEngine.x64.sdaiCloseModel(model);
    model = 0;  //  Not required of course
}