Skip to main content


The following documentation is presented as Python code running inside a Jupyter Notebook. To run it yourself you can copy/type each individual cell or directly download the full notebook, including all required files.

Acoustic wave propagation simulations are mainly governed by their media (geometries) and the boundaries of the media (materials - covered in the next tutorial).

The SDK offers a variety of ways to work with geometries, such as:

  1. Using a model from our extensive geometry library
  2. Uploading custom geometries in multiple formats (f.ex. 3dm, obj)
  3. Generating rooms by describing a 2D surface and extruding it along the 3rd dimension

We'll first fetch our project from before and then look at geometries.

from pathlib import Path
from treble_tsdk.tsdk import TSDK
from treble_tsdk import tsdk_namespace as treble
from treble_tsdk import display_data as dd

tsdk = TSDK()
project_name = "Tutorial"
p = tsdk.get_or_create_project(name=project_name)

The Geometry Library

The SDK comes with a library of geometries which contain metadata on boundary layers and tags which can be used to query certain subsets of the geometry library. We aim to continuously expand the geometry library and welcome requests on types of geometries to include.

The geometry library is accessed on a dataset level. Here we will, for example, get the "MeetingRoom" dataset and continue working with it.

from pathlib import Path
from treble_tsdk.tsdk import TSDK, TSDKCredentials
from treble_tsdk import tsdk_namespace as treble
from treble_tsdk import display_data as dd

tsdk = TSDK(TSDKCredentials.from_file('/home/nonni/.config/treble/tsdk_local.cred'))
p = tsdk.get_or_create_project('hello')
meeting_rooms = tsdk.geometry_library.get_dataset(treble.GeometryLibraryDataset.meeting_room)

The display_data module can be used to get information on geometries. Either in table view or in tree view. First, we'll display information on the first 5 rooms in a table,


and then we can decide to request further details on a certain room in tree view.


we can also visualize the geometry and it's geometry by using the plot function.


Custom Geometry Generation

There are a selection of geometry generation functions which can be used to generate custom geometries with code. These are all relatively simplistic and we aim to keep expanding on this functionality, for example, by adding optional inclusion of furnishing and source/receiver suggestions.

The simplest option is the shoebox room generation where width, depth, and height are imported in the unit of meters.

room = treble.GeometryGenerator.create_shoebox_room(

We can also create more complex rooms, such as L-shaped rooms where we input lengths of four sides in meters and then the height.

room = treble.GeometryGenerator.create_l_shaped_room(

Finally, we can create a room where we simply provide a vector of X,Y coordinates to define the edge points of the room and then the walls will be interpolated between these points and they can then be extruded to some fixed height.

Here we create a polygon room:

edge_points_hexagon = [[6.4, 2.2],[4.2, 4.4],[2.8, 6.6],[0.2, 4],[0, 3.4],[0.7, 1.9],[2.4, 0.6]]
room = treble.GeometryGenerator.create_polygon_room(

geometries generated this way also have a plot() function.


Custom Geometry Upload

Users can upload their own geometries into the SDK.

room = p.add_model(model_name="Uploaded Model", model_file_path='/home/nonni/tmp/tsdk/boundary_source/input/model_1_0.3dm')

The model is inspected by our geometry checking service in the cloud and thus needs a few seconds before it will be usable in the project. The progress can be be followed using the display_data module.


If your model is valid (Status: Valid) then it's compatible with our simulation engine.

Get Models in Project

After a model has been created, it does not need to be created again and can be accessed in case it needs to be used/inspected again.

It can be beneficial to use a model again as every time a model is used in a simulation, a mesh is generated (which takes time depending on transition frequency), but if the model has been used previously with the same transition frequency, the mesh gets re-used.

Retrieving models can be done using the project.get_models() / project.get_model() / project.get_model_by_name() methods.

The get_models() method returns all models that belongs to the project in question.

models = p.get_models()

We can fetch single models using a few different methods shown in the code example below.

# Fetch model by index from the array received from p.get_models()
room = models[0]

# Fetch model by Id where Id is the unique identifier generated by the SDK for the model.
room = p.get_model(models[0].id)

# Fetch model by name.
room = p.get_model_by_name(models[0].name)

Now we know how to add geometries into an SDK project and retrieve them for later usage.

In the next tutorial we will show how materials can be attached to the boundaries of our models to prepare them for running simulations.