treble_tsdk.core.model_obj¶
Model objects and geometry-related helpers.
Includes model metadata, material assignment, mesh sizing and geometry checking utilities used by simulations.
Classes
Settings for geometry validation and processing. |
|
Custom mesh sizing for a specific geometry layer. |
|
Material assignment for a geometry layer. |
|
3D geometry model for acoustic simulations. |
|
Information for uploading a new model. |
- class treble_tsdk.core.model_obj.MaterialAssignment¶
Material assignment for a geometry layer.
Associates a material with a specific layer and optionally overrides scattering coefficients.
- __init__(layer_name: str, material: Material, scattering_coefficient: list[float] | float | None = None)¶
Represents a layer material assignment.
- Parameters:
selected material is used. If set it can either be a single value or a list of 8 values, one per octave band. If this is a single value then the value will be used to calculate scattering for all octave bands.
- property layer_name: str¶
Name of the model layer this material is assigned to.
- Returns str:
Layer name.
- set_material(value: Material)¶
Update the assigned material.
- Parameters:
value (Material) – New material to assign.
- property scattering_coefficient: list[float] | float | None¶
Scattering coefficient. Can be a single value or a list of 8 values, one per octave band.
- Returns list[float] | float | None:
Scattering coefficient per octave band or single value.
- static assign_multiple(layer_names: list[str], material: Material) list[MaterialAssignment]¶
Assigns the same material to multiple layers. :param list[str] layer_names: List of layer names to assign material to. :param Material material: Material to assign to layers. :returns list[MaterialAssignment]: List of material assignments.
- class treble_tsdk.core.model_obj.LocalMeshSizing¶
Custom mesh sizing for a specific geometry layer.
Controls mesh quality and edge preservation for individual elements in a simulation.
- __init__(layer_name: str, mesh_sizing_m: float, keep_exterior_edges: bool = False)¶
Represents a custom local mesh sizing assignment. Makes it possible to control the mesh quality of individual elements in a simulation.
- Parameters:
- class treble_tsdk.core.model_obj.GeometryCheckerSettings¶
Settings for geometry validation and processing.
Controls simplification thresholds, animation handling, and solver-specific processing.
- __init__(simplification_threshold: float = 0.005, animation_timecode: float | None = None, ga_only: bool = False, **kwargs)¶
Advanced settings for geometry processing.
- Parameters:
simplification_threshold (float) – Simplification threshold in meters.
animation_timecode (float) – Animation timecode for USD processing.
ga_only (bool) – If True, the geometry is considered non-watertight and advanced geometry analysis is skipped. This can help when uploading very large models that will only be used with GA simulations.
- property simplification_threshold: float¶
Geometry simplification threshold in meters.
- Returns float:
Simplification threshold in meters.
- class treble_tsdk.core.model_obj.ModelObj¶
3D geometry model for acoustic simulations.
Provides methods for model processing, validation, layer management, and visualization.
- property status: str¶
Current processing status of the model.
- Returns str:
Status value (Valid, Processing, NotValid, Error).
- property is_watertight: str¶
Whether the model geometry is watertight.
- Returns str:
Watertight status.
- property layer_names: list[str] | None¶
Names of all layers in the model.
- Returns list[str] | None:
List of layer names or None if not yet available.
- wait_for_model_processing(max_retries=1000) str | None¶
Waits until model has been processed and then returns the model status.
- Parameters:
max_retries (int) – Maximum number of retries before stopping, each retry waits 3 seconds.
- Returns:
Model status, “Valid”, “NotValid”, “Error” or “Processing” in case of timeout.
- wait_for_layer_names(max_retries=1000) list[str] | None¶
Wait for model processing to complete and return layer names.
- Parameters:
max_retries (int) – Maximum number of retries before stopping.
- Returns list[str] | None:
List of layer names once processing is complete.
- get_geometry_processing_feedback_png(destination_file: str) bool¶
Get model feedback image from geometry processing.
- Parameters:
destination_file (str) – Path to download feedback image file to. F.ex. ‘/home/user/feedback.png’
- Returns bool:
True if it was able to download the file.
- get_geometry_processing_feedback_json(destination_file: str) bool¶
Download result json from Geometry Checking Service.
- Parameters:
destination_file (str) – Filepath to download to.
- Returns bool:
True if it was able to download the file.
- clone_model(new_project: ProjectDto | 'Project' | str, new_name: str = None) 'ModelObj' | None¶
Create a clone of the model in a different project.
- Return ModelObj | None:
New model object
- get_surface_area_of_layers_m2() dict[str, float]¶
Get the surface area of the layers in the model.
- Returns dict[str, float]:
Dictionary with layer names as keys and surface area in m^2 as values.
- calculate_sabine_estimate(material_assignments: list[MaterialAssignment | MaterialAssignmentDto], model_volume: float | None = None) list[float]¶
Calculates the sabine estimate of the reverberation time based on layer material assignment.
- Parameters:
material_assignment (list[MaterialAssignment|MaterialAssignmentDto]) – Layer material assignment for model to calculate the estimate on.
model_volume (float) – Optional, If no model volume is input the model volume will be computed from the input objects. If a geometry without a closed shell is input the model_volume has to be specified.
- Returns list[float]:
List of the sabine estimated RT for each frequency range valid for materials (63, 125, 250, 500, 1k, 2k, 4k, 8k).
- rename(model_name: str)¶
Rename the model.
- Parameters:
model_name (str) – New name for the model.
- Returns bool:
True if rename succeeded, False otherwise.
- get_bounding_box() BoundingBox | None¶
Get the bounding box of the model. :returns BoundingBox | None: Bounding box of the model or None if unable to get bounding box.
- plot(view_2d: View2d | None = None, _debug: DebugOptions = {})¶
Uses the plot module to plot the model. :param view_2d: Show a 2d view, choose between None, View2d.xy, View2d.xz, View2d.yz. Optional, defaults to false.
- plot_geometry_feedback()¶
Uses the plot module to plot the geometry feedback.
- as_tree()¶
Uses the display_data module to model object info as tree.
- as_live_model_status()¶
Uses the display_data module to show model status automatically updated until model has been processed
- class treble_tsdk.core.model_obj.ModelUploadInfo¶
Information for uploading a new model.
Contains model metadata including name, file path, and processing settings.