Support site for Simplebim® users
In This Topic
    Automate with Scripts
    In This Topic

    With Simplebim you have 3 options for performing operations on models

    1. Manually from the user interface
    2. Automated from the user interface
    3. Automated using scripts

    All automation is based on templates and tools. When you automate operations from the user interface you are working in the context of a single model, the model you have imported into Simplebim. With scripts you can also handle multiple models within the same script. Scripts are run with a minimal user interface, which makes them more efficient because there is no need to load the 3D geometry and other resources.

    The work flow for defining Simplebim automation is usually as follows:

    1. You use the Simplebim user interface to figure out which operations are necessary in your scenario. This is a good way of working initially, because you get a design echo from the 3D window and other palettes.
    2. You encode the operations from step 1 as templates and test the templates in the user interface.
    3. Once you are satisfied with the results you apply your templates from step 2 unattended using a script.

    Step-by-Step Instructions

    The following instructions are for a very simple script that imports our Getting Started model, runs the Calculate Basic Quantities tool, applies a template that includes only objects on the Ground Floor and finally exports the result into a new IFC file.

    You can download all the files needed by the script here.

    Simply unzip the package you downloaded into any folder on your own computer. Please note that you must have a licensed copy of Simplebim version 9 installed on your computer to run this sample.

    Step 1 - Create Template

    The package you downloaded contains the template "Sample-Template.xlsx". This is a very simple template that excludes all objects, except the one's located on the Ground Floor.

    You can of course use templates with any complexity and if you are not yet familiar with templates, you can find more information about templates in our comprehensive Template Guide.

    Step 2 - Create Script

    The package you downloaded contains the script file "Sample-Script.sbs". The file extension sbs stands for Simplebim Script. Script files are simple text files with a set of instructions that are performed in the order they appear in the script. Our sample script looks like this:

    Import=%SCRIPT_PATH%\GettingStarted.ifc
    Run=Calculate Basic Quantities|SHADOW_AREAS=OFF
    Apply=%SCRIPT_PATH%\Sample-Template.xlsx
    Export=%SCRIPT_PATH%\GettingStarted (Ground Floor only).ifc
    Close

    The first command imports the specified IFC model from the same folder where the script is located. The second command runs the Calculate Basic Quantities tool with the Shadow Areas option off. The third command applies the template from Step 1 and the fourth command exports the result into a new IFC file. The last command (Close) tells Simplebim to run with a minimal user interface and to close when the script completes.

    You can find the full documentation for scripts with a more extensive example here.

    Step 3 - Create Batch file (optional)

    You can run the script file from Step 2 by opening it in Simplebim. You can do this by dragging&dropping the script file on top of the Simplebim application icon, or by clicking on the script file with the right muse button and selecting Open With > Simplebim. However, it is often convenient to create a batch file (.bat) that opens the script file in Simplebim.

    "C:\Program Files\Datacubist\Simplebim 9\Simplebim9.exe" "Sample-Script.sbs"
    pause

    This batch file has two rows. The first one starts Simplebim with the script file as a startup parameter. For this to work the batch file and the script file must be located in the same folder. The last row pauses the command prompt, allowing you to see when the script has completed.

    Step 4 - Try it!

    Double click on the Sample-Script.bat file. This opens a new Command Prompt, starts Simplebim, runs the script and exports the new IFC file "GettingStarted (Ground Floor only).ifc" into the same folder with the script file. Simple!

    Now that you know how to automate operations with scripts you can start experimenting with your own models and templates. It's actually really simple once you know the basics.