Welcome to our Script Samples page! Here, you'll find a growing collection of Lua script examples that unlock the full potential of Sustainable Building Modeler (SBM). These scripts allow you to perform custom calculations, run structural or energy analyses, and generate detailed reports tailored to your specific building designs.
All examples are ready to use and can serve as inspiration or templates for your own modeling workflows. You can browse, copy, and adapt these samples to automate tasks and customize your project logic.
👉 Check out our curated library of script samples right here on this page.
📂 Looking for more? Visit our public GitHub repository for an extended collection of SBM script samples:
➡️ SBM-Scripts/Samples on GitHub
There, you’ll find additional scripts organized by category, covering a wider range of use cases including geometry, automation, structural analysis, and data reporting.
SBM includes a built-in Lua scripting engine for fast customization and automation. You have two easy options to run scripts:
Go to the Scripting tab inside the SBM app.
Type or paste your Lua code into the editor.
Click Run to execute the script in the context of your open project.
Prefer to work in Visual Studio Code or another code editor?
Write your Lua scripts externally with your preferred editor.
Then copy and paste them into SBM’s script editor to run.
To make external scripting even easier, we’ve published an API definition file that provides full IntelliSense support for SBM in Visual Studio Code using the sumneko Lua Language Server.
With this setup, you get:
🧠 Autocomplete suggestions for SBM’s API functions
📝 Parameter hints and hover documentation
✅ Syntax validation and static analysis for SBM-specific scripts
You can get started by downloading the definition file and following the instructions in our README.md on GitHub.
Ready to start scripting? Scroll down to explore example scripts or visit our GitHub repository for even more resources.
✨ Happy modeling!
This sample programmatically generates a polygon building.
This snippet generates an array of cylindrical tanks in a spiral formation.
This script displays a gas properties data vs temperature & pressure, given its material tag.
This script iterates through a multi-layered bode layers and displays each layers info.
This example illustrates how use unit functions.
Edit layers, materials and thickness of insulations.
This script generates humid air properties tables vs temperature & relative humidity.
This script creates a new EPANET project (or opens an EPANET .inp file from working folder), adds links and nodes from SBM model, runs hydraulic analysis, displays results and saves the final .inp file.
This sample Converts model elements to a DXF drawing.
This sample converts current project to a Modelica model, using Modelica.Fluid standard library components.
Generated model might need additional modifications before simulating.