Skip to content

Commit

Permalink
fix(window): glazing system thickness not account gap
Browse files Browse the repository at this point in the history
  • Loading branch information
taoning committed Sep 26, 2024
1 parent 51a028d commit 24875e8
Showing 1 changed file with 23 additions and 0 deletions.
23 changes: 23 additions & 0 deletions frads/window.py
Original file line number Diff line number Diff line change
Expand Up @@ -208,6 +208,26 @@ def get_brtdfunc(self) -> pr.Primitive:
return get_glazing_primitive(self.name, rgb)


def load_glazing_system(path: Union[str, Path]):
"""Load a glazing system from a JSON file."""
with open(path, "r") as f:
data = json.load(f)
layers = data.pop("layers")
layer_instances = []
for layer in layers:
rgb = layer.pop("rgb")
layer_instances.append(Layer(rgb=PaneRGB(**rgb), **layer))
gaps = data.pop("gaps")
gap_instances = []
for gap in gaps:
gas_instances = []
gases = gap.pop("gas")
for gs in gases:
gas_instances.append(Gas(**gs))
gap_instances.append(Gap(gas=gas_instances, **gap))
return GlazingSystem(layers=layer_instances, gaps=gap_instances, **data)


def get_layers(input: List[pwc.ProductData]) -> List[Layer]:
"""Create a list of layers from a list of pwc.ProductData."""
layers = []
Expand Down Expand Up @@ -297,6 +317,9 @@ def create_glazing_system(
product_data.thickness = product_data.thickness / 1000.0 or 0 # mm to m
thickness += product_data.thickness

for gap in gaps:
thickness += gap.thickness

glzsys = pwc.GlazingSystem(
solid_layers=layer_data,
gap_layers=create_pwc_gaps(gaps),
Expand Down

0 comments on commit 24875e8

Please sign in to comment.