sdaiOpenModelBN

This call is used to open a model with normal ASCII character namings. The property repository is expected to be 0 in all cases, however will be ignored. The property fileName is optional and can be 0 or an empty string, i.e. ""; in both cases an empty model against the defined schema is created. The property schemaName is non optional and has to link to an existing valid schema.

Syntax

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

[DllImport(IFCEngineDLL, EntryPoint = "sdaiOpenModelBN")]
public static extern Int32 sdaiOpenModelBN(Int32 repository, string fileName, string schemaName);

[DllImport(IFCEngineDLL, EntryPoint = "sdaiOpenModelBN")]
public static extern Int32 sdaiOpenModelBN(Int32 repository, byte[] fileName, byte[] schemaName);    

Property repository

Size: 32 bit / 4 byte (value)
Not relevant within the IFC Engine DLL, although several models can be loaded at once, they will always be in separate models.

Property fileName

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

Property schemaName

Size: 32 bit / 4 byte (reference)
Address of string containing the path of the IFC schema, for example 'C:\myPath\IFC4.exp'.

Examples

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

string ifcFileName = "myFile.ifc";

//
//  In case input strings are already UTF8, the following line 
//
Int32 model = IfcEngine.x86.sdaiOpenModelBN(0, ifcFileName, "IFC2X3_TC1.exp");

//
//  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)
//
Int32 model = IfcEngine.x86.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";

    //
    //  In case input strings are already UTF8, the following line
    //
    IfcEngine.x86.sdaiSaveModelBN(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 sdaiSaveModelBNUnicode is prefered)
    //
    IfcEngine.x86.sdaiSaveModelBN(model, System.Text.Encoding.UTF8.GetBytes(ifcFileNameSaving));

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