Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(model): Ensure that model comparison converts to the same units #47

Merged
merged 1 commit into from
Nov 18, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 9 additions & 0 deletions honeybee_display/model.py
Original file line number Diff line number Diff line change
Expand Up @@ -480,6 +480,12 @@ def model_comparison_to_vis_set(
incoming_color: An optional ladybug Color to set the color of the incoming model.
If None, a default red color will be used. (Default: None).
"""
# make sure that both models have the same units system
original_units = None
if base_model.units != incoming_model.units:
original_units = incoming_model.units
incoming_model.convert_to_units(base_model.units)

# set the default colors if not provided
if base_color is None:
base_color = Color(98, 190, 190, 128)
Expand Down Expand Up @@ -535,6 +541,9 @@ def model_comparison_to_vis_set(
incoming_windows.display_name = 'Incoming Windows'
vis_set.add_geometry(incoming_windows)

# put back the original units if different
if original_units is not None:
incoming_model.convert_to_units(original_units)
return vis_set


Expand Down
Loading