Skip to main content

Importing a local room geometry in to the Treble SDK

The treble SDK currently supports room geometry import in three file formats .3dm, .obj, and .dxf. You can import rooms in these formats into the Treble SDK to be used for your simulations. The simplest way of doing so is by specifying the model name and the path to your local drive where the file is located, for example:

model_name = "my-room-model"
imported_model = project.add_model(
model_name=model_name,
model_file_path="path/to/your/file.3dm"
)

When the room is uploaded it is sent to our geometry checking service and is then meshed. Meshing is required to run the wave-based algorithms on a room, and some downstream methods only work after the mesh has been generated. In these cases, it can be advantageous to wait with proceeding before the rooms is fully uploaded.

There are two methods related to the model processing time: imported_model.as_live_model_status() writes the current status for the model upload into the output cell. imported_model.wait_for_model_processing() delays the cell's runtime until the mesh has been fully processed. This ensures that all downstream methods work correctly.

model_name = "my-room-model"
imported_model = project.add_model(
model_name=model_name,
model_file_path="path/to/your/file.3dm"
)
imported_model.wait_for_model_processing()
imported_model.plot()

The Treble SDK requires unique model names. The following example demonstrates how to check if the model name has already been used before uploading the model.

model_name = "my-room-model"
imported_model = project.get_model_by_name(model_name)

if not imported_model:
print("Room model not found. Uploading model.")
imported_model = project.add_model(
model_name=model_name,
model_file_path="path/to/your/file.3dm"
)
imported_model.as_live_model_status()

imported_model.wait_for_model_processing()
if imported_model.status == "Valid":
imported_model.plot()

The SDK Fundamentals notebook contains a working example of importing a .3dm file.

Importing a room without meshing it

If a room will only be used for GA simulations, you can import the model and bypass the meshing step. This will save time while uploading the model to the SDK.

    imported_model = project.add_model(
model_name=model_name,
model_file_path="path/to/your/file.3dm",
geometry_checker_settings=treble.GeometryCheckerSettings(ga_only=True),
)