Support site for Simplebim users
In This Topic
    Simplebim Command Line API
    In This Topic

    The Simplebim® command line API can be used for importing IFC, applying a template and exporting IFC. The number and order of the command line parameters is significant. If folder or file names contain spaces the name must be enclosed in quotes. 

     

    Importing IFC

    Importing IFC with template

    Exporting IFC

    Exporting IFC silent

    Batch Processing with a Script File

     


    Importing IFC

    Starts Simplebim® and imports the specified file into the Editor model view using the full IFC import.

    Syntax

    Simplebim8.exe ImportFile

    Simplebim7.exe ImportFile

    Simplebim6.exe ImportFile 

    Simplebim5.exe ImportFile 

    Parameters

    ImportFile The IFC file (with full path) to import.

    Example

    Simplebim7.exe "C:\My Files\In.ifc" 


    Importing IFC with template

    Starts Simplebim®, imports the specified file into the Editor model view using the full IFC import and applies the specified template.

    Syntax

    Simplebim8.exe ImportFile TemplateFile

    Simplebim7.exe ImportFile TemplateFile

    Simplebim6.exe ImportFile TemplateFile 

    Simplebim5.exe ImportFile TemplateFile 

    Parameters

    ImportFile The IFC file (with full path) to import.
    TemplateFile The Simplebim® template to apply.

    Example

    Simplebim8.exe "C:\My Files\In.ifc" "C:\My Files\Template.xls" 


    Exporting IFC

    Starts Simplebim®, imports the specified file into the Editor model view using the full IFC import, applies the specified template and exports the result to the specified IFC file. 

    Syntax    

    Simplebim8.exe ImportFile TemplateFile ExportFile

    Simplebim7.exe ImportFile TemplateFile ExportFile

    Simplebim6.exe ImportFile TemplateFile ExportFile 

    Simplebim5.exe ImportFile TemplateFile ExportFile 

    Parameters

    ImportFile The IFC file (with full path) to import.
    TemplateFile The Simplebim® template (with full path) to apply to the imported IFC model
    ExportFile The file (with full path) of the exported IFC file.

    Example

    Simplebim8.exe "C:\My Files\In.ifc" "C:\My Files\Template.xls" "C:\My Files\Out.ifc" 


    Exporting IFC silent

    Starts Simplebim®, imports the specified file into the Editor model view using the full IFC import, applies the specified template, exports the result to the specified IFC file and closes Simplebim. During the operation Simplebim®  runs minimized. 

    Syntax    

    Simplebim8.exe ImportFile TemplateFile ExportFile Close

    Simplebim7.exe ImportFile TemplateFile ExportFile Close

    Simplebim6.exe ImportFile TemplateFile ExportFile Close 

    Simplebim5.exe ImportFile TemplateFile ExportFile Close 

    Parameters

    ImportFile The IFC file (with full path) to import.
    TemplateFile The Simplebim® template (with full path) to apply to the imported IFC model
    ExportFile The file (with full path) of the exported IFC file.
    Close Including the keyword Close as the last parameter instructs Simplebim to run minimized and close itself once the operation is completed.

    Example

    Simplebim8.exe "C:\My Files\In.ifc" "C:\My Files\Template.xls" "C:\My Files\Out.ifc" Close 


    Batch processing with a script file

    Processing of models can be further automated with a script file that is passed to Simplebim as a parameter

    If your script contains non-ANSI characters, such as ä, å or ü, your script file must be saved using UTF8 encoding. The UTF8 encoding can be with or without BOM (Byte Order Mark).

    Syntax

    Simplebim8.exe ScriptFile ModelFile

    Simplebim7.exe ScriptFile

    Simplebim6.exe ScriptFile

    Simplebim5.exe ScriptFile

    The file extension of the script file is .sbs (Simplebim script). The file is a simple ASCII file with one command on each line. The commands are processed in the order they appear in the file. In order to run silently the script file must end with a Close command. The # character at the start of a line denotes a comment.

     

    New in Simplebim 8.0 SR6.  In addition to the script file you can optionally also pass a model file to Simplebim. The model file is parsed into the following variables that you can use in your script just like any other variables. The documentation below shows the values for each variable when ModelFile is:  C:\MyFiles\Scripts\Sample.ifc

    MODEL_FILE The ModelFile parameter you passed to Simplebim C:\MyFiles\Scripts\Sample.ifc
    MODEL_PATH The folder of the model file without the trailing backslash C:\MyFiles\Scripts
    MODEL_NAME The name of the model file without the path and without the file extension Sample
    MODEL_EXT

    The file extension of the model file without the preceding dot

    ifc

    With this feature you can for example create an entry for your script in the  Windows Send To -list. First you create a shortcut to the Simplebim EXE file and add your script as a parameter to the shortcut. Then you register your shortcut in the Send To -list. When you now right click on any IFC file and select your script from Send To list, Simplebim will start and process your script. When you use the variables above in your script you can for example automate applying a template to the selected IFC file and export the result to another IFC file. Your script could look for example like this:

    Import=%MODEL_FILE%
    Apply=%SCRIPT_PATH%\MyTemplate.xlsm
    Export=%MODEL_PATH%\%MODEL_NAME% (EDITED).%MODEL_EXT%
    Close

    Commands

    Variable=

    You can define any number of variables that consist of a variable name and value. When the script is parsed and the variable name in the format %NAME% is found anywhere in the script, it is replaced with the value you have defined. Variable names are case sensitive. Using variables makes it easier to adapt your script to new situations for example a new project.

    Variable=NAME=value

    The variable %SCRIPT_PATH% is always defined automatically and has the full path of the script file you are running as the value.

    Setting=

    You can set the following pre-defined settings

    TempFolder=<folder>

    Redirect temporary files into another folder than the default temporary folder. This can be useful with large models if the size of the default temporary folder is limited.

    Example: Setting=TempFolder=C:\Temp

    Import=

    The IFC file (with full path) to import

    Open=

    The Cube file (with full path) to open

    Apply=

    The Simplebim template (with full path) to apply to the imported IFC model

    NOTE: You may apply several templates in sequence to the same model

    You can define variables that are passed to the template you apply using the same syntax as when you run tools. In the template, use the syntax %NAME% anywhere and the name of the parameter is replaced with the value of the parameter. This reduces the number of template files you have to create because you can make a generic template that you configure with parameters.

    Run=

    The GUID or name of the tool that should be run. The tool can optionally be configured using the following syntax   

    Run=ToolNameOrGuid|key1|key2=value2|key3=value

    Merge=

    The IFC file (with full path) to merge to the already imported or opened model. Merge can optionally be configured using the following syntax

    Merge=File|key1|key2=value2|key3=value3

    You can use wildcards in the File parameter. For example C:\Script Files\*.ifc When the script is parsed the directory specified in the File parameter is scanned for files that match the pattern and a separate command is automatically created for each file. This makes it easier to re-use script files with different combinations of file that need to be merged.

    The supported configurations are

    Key

    Value(s)

    Description

    MERGE_TYPE

    FULL

    CREATELOCATIONPRISMS

    READLOCATIONPRISMS

    Default

    Creates 3D location prisms from footprints

    Reads 3D location prisms

    MERGE_SITES

    n/a

    The resulting model should have only one site

    MERGE_BUILDINGS

    n/a

    The resulting model should have only one building. Can only be used with MERGE_SITES

    MERGE_BUILDING_STOREYS_BY_NAME

    n/a

    Merge building storeys by name. Can only be used with MERGE_BUILDINGS. Can be used together with MERGE_BUILDING_STOREYS_BY_ELEVATION

    MERGE_BUILDING_STOREYS_BY_ELEVATION

    n/a

    Merge building storeys by elevation. Can only be used with MERGE_BUILDINGS. Can be used together with MERGE_BUILDING_STOREYS_BY_NAME

    BY_BUILDINGSTOREYS

    ON

    OFF

     

    Default

    EXTENT_LOWEST_BUILDINGSTOREY

    ON

    OFF

     

                           

    Export=

    The file (with full path) of the exported IFC file.

    Save=

    The file (with full path) of the saved Cube file

    Delete=

    The file (with full path) of the file to delete. The user will not be prompted to confirm the delete operation.

    StartLog=

    The file (with full path) of the log file

    StartLog may appear anywhere after the first Import and the final Close. You can write a separate log for each operation, one log for the whole script or for any sequence of operations in between.

    SaveLog

    Saves the log into the log file specified in StartLog

    Close=

    The file (with full path) of the log file for  the event of an application crash. If the application does not crash the log file is not written. Close can also be used without  a value

    Example Script

    # This is a comment
    Variable=PATH=C:\My Files
    Import=%PATH%\test1.ifc
    Merge=%PATH%\location_prisms.ifc|MERGE_TYPE=READLOCATIONPRISMS
    Run=Split Geometries|SPLIT_TYPE=ALL|SMART_SPLIT=OFF
    Save=%PATH%\test1.cube
    StartLog=%PATH%\test1_out1.log
    Apply=%PATH%\test1.xlsx
    Run=Basic Quantities
    SaveLog Export=%PATH%\test1_out1.ifc
    Open=%PATH%\test1.cube
    StartLog=%PATH%\test1_out2.log
    Apply=%PATH%\test2.xlsx
    Apply=%PATH%\test3.xlsx
    SaveLog
    Export=%PATH%\test1_out2.ifc
    Delete=%PATH%\test1.cube
    Close=%PATH%\test1_fail.log/p>

     

    The example script above does the following.

    • Comment line that does nothing
    • Defines the variable PATH with the value C:\MyFiles
    • Imports a model from a IFC file (test1.ifc)
    • Merges location prisms from another IFC file (location_prisms.ifc)
    • Resolves the locations and splits objects if needed by running the Split Geometries tool
    • Saves the imported model to a binary file (test1.cube). This is done because it is later faster to open the binary file than to re-import the IFC file
    • Starts writing the log for applying a template (test1_out1.log)
    • Applies a template (test1.xlsx)
    • Saves the log for applying the template (into test1_out1.log)
    • Exports the modified model into a new IFC file (test1_out1.ifc)
    • Opens the model from the binary file (test1.cube) saved in step 2. This is done in order to get a clean model for applying the next templates.
    • Starts writing the log for applying  the next templates (test1_out2.log)
    • Applies the first template (test2.xlsx)
    • Applies the second template (test3.xlsx)
    • Saves the log for applying the first and second template (into test1_out2.log)
    • Exports the modified model into a new IFC file (test1_out2.ifc)
    • Deletes the binary file (test1.cube)
    • Closes the application. If the application crashes during any of the steps above the reason for the crash will be written into the specified file (test1_fail.log)