Skip to content

Commit

Permalink
fix(phpp_variants): Update Variants PHPP Sheet
Browse files Browse the repository at this point in the history
extend the search functions for PHPP's Variants worksheet
  • Loading branch information
ed-p-may committed Jul 16, 2024
1 parent c968515 commit f6960da
Show file tree
Hide file tree
Showing 10 changed files with 20,167 additions and 10,929 deletions.
16 changes: 10 additions & 6 deletions PHX/PHPP/sheet_io/io_variants.py
Original file line number Diff line number Diff line change
Expand Up @@ -48,24 +48,28 @@ def __init__(self, _xl: xl_app.XLConnection, _shape: shape_model.Variants):
self.start_window_types: Optional[int] = None
self.start_ventilation: Optional[int] = None

def get_user_input_section_start(self, _row_start=1, _rows=500) -> int:
def get_user_input_section_start(self, _start_row: int = 1, _read_length: int = 500) -> int:
"""Return the row number of the user-input section header."""
# -- Get the data from Excel in one operation
end_row = _start_row + _read_length
col_data = self.xl.get_single_column_data(
_sheet_name=self.shape.name,
_col=self.shape.input_header.locator_col_header,
_row_start=_row_start,
_row_end=_row_start + _rows,
_row_start=_start_row,
_row_end=end_row,
)

for i, column_val in enumerate(col_data, start=_row_start):
for i, column_val in enumerate(col_data, start=_start_row):
if column_val == self.shape.input_header.locator_string_header:
return i

if end_row < 10_000:
return self.get_user_input_section_start(_start_row=end_row, _read_length=500)

raise Exception(
f'Error: Unable to locate the "{self.shape.input_header.locator_string_header}" '
f'section of the "{self.shape.name}" worksheet in column '
f'"{self.shape.input_header.locator_col_header}"?'
f'section of the "{self.shape.name}" worksheet in '
f"{self.shape.input_header.locator_col_header}{_start_row}:{self.shape.input_header.locator_col_header}{end_row}?"
)

def get_assembly_layers_start(self, _row_start: Optional[int] = None, _rows: int = 100) -> int:
Expand Down
1 change: 1 addition & 0 deletions PHX/from_HBJSON/read_HBJSON_file.py
Original file line number Diff line number Diff line change
Expand Up @@ -80,5 +80,6 @@ def convert_hbjson_dict_to_hb_model(_data: Dict) -> model.Model:
model.Model: A Honeybee Model, rebuilt from the HBJSON file.
"""
hb_model: model.Model = model.Model.from_dict(_data)
logger.info(f"Converting HB-Model from {hb_model.units} to Meters.")
hb_model.convert_to_units("Meters")
return hb_model
Loading

0 comments on commit f6960da

Please sign in to comment.