Jump to content

Simplebim Command Line API

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

Simplebim10.exe ImportFile

Simplebim9.exe ImportFile

Simplebim8.exe ImportFile

Simplebim7.exe ImportFile

Simplebim6.exe ImportFile 

Simplebim5.exe ImportFile 

Parameters

ImportFileThe IFC file (with full path) to import.

Example

Simplebim10.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

Simplebim10.exe ImportFile TemplateFile

Simplebim9.exe ImportFile TemplateFile

Simplebim8.exe ImportFile TemplateFile

Simplebim7.exe ImportFile TemplateFile

Simplebim6.exe ImportFile TemplateFile 

Simplebim5.exe ImportFile TemplateFile 

Parameters

ImportFileThe IFC file (with full path) to import.
TemplateFileThe Simplebim® template to apply.

Example

Simplebim10.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    

Simplebim10.exe ImportFile TemplateFile ExportFile

Simplebim9.exe ImportFile TemplateFile ExportFile

Simplebim8.exe ImportFile TemplateFile ExportFile

Simplebim7.exe ImportFile TemplateFile ExportFile

Simplebim6.exe ImportFile TemplateFile ExportFile 

Simplebim5.exe ImportFile TemplateFile ExportFile 

Parameters

ImportFileThe IFC file (with full path) to import.
TemplateFileThe Simplebim® template (with full path) to apply to the imported IFC model
ExportFileThe file (with full path) of the exported IFC file.

Example

Simplebim10.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    

Simplebim10.exe ImportFile TemplateFile ExportFile Close

Simplebim9.exe ImportFile TemplateFile ExportFile Close

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

ImportFileThe IFC file (with full path) to import.
TemplateFileThe Simplebim® template (with full path) to apply to the imported IFC model
ExportFileThe file (with full path) of the exported IFC file.
CloseIncluding the keyword Close as the last parameter instructs Simplebim to run minimized and close itself once the operation is completed.

Example

Simplebim10.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).

If you run your script from a batch file (.bat) and any of your  folder or file names contain non-ANSI characters, such as ä, å or ü, you need to define the correct code page as the first row of your batch file using the CHCP command. For example…

CHCP 1252

…will set the code page to the Latin alphabet used e.g. for English, Irish, Italian, Norwegian, Portuguese, Spanish, Swedish, German, Finnish and French.

Syntax

Simplebim10.exe ScriptFile ModelFile

Simplebim9.exe ScriptFile ModelFile

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.

Simplebim 8.0 SR6 and later.  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_FILEThe ModelFile parameter you passed to SimplebimC:\MyFiles\Scripts\Sample.ifc
MODEL_PATHThe folder of the model file without the trailing backslashC:\MyFiles\Scripts
MODEL_NAMEThe name of the model file without the path and without the file extensionSample
MODEL_EXTThe file extension of the model file without the preceding dotifc

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=valueThe 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 settingsTempFolder=<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 modelNOTE: You may apply several templates in sequence to the same modelYou 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:

KeyValue(s)Description
MERGE_TYPEFULL (default)
CREATELOCATIONPRISMS
READLOCATIONPRISMS
Merge the full model, create 3D location prisms from footprints or read only 3D location prisms from the model.
MERGE_SITESn/aMerge sites
MERGE_SITES_BY_NAMEON
OFF (default)
Merge sites by their name
The resulting model has only one site
MERGE_BUILDINGSn/aMerge buildings
MERGE_BUILDINGS_BY_NAMEON
OFF (Default)
Merge buildings within each site by the building name.
The resulting model has only one building on each site.
MERGE_BUILDING_STOREYS_BY_NAMEn/aMerge 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_ELEVATIONn/aMerge building storeys by elevation. Can only be used with MERGE_BUILDINGS. Can be used together with MERGE_BUILDING_STOREYS_BY_NAME
BY_BUILDINGSTOREYSON
OFF (default)
Only relevant with CREATELOCATIONPRISMS. Create a separate location prism for each building storey.
EXTEND_LOWEST_BUILDINGSTOREYON (default)
OFF
Only relevant with CREATELOCATIONPRISMS. Extends the bottommost location prism down to the bottom elevation of the lowest building element.

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 fileStartLog 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)