Spaces:
Sleeping
Sleeping
Update app/materials_library.py
Browse files- app/materials_library.py +25 -12
app/materials_library.py
CHANGED
@@ -255,18 +255,31 @@ def display_materials_page():
|
|
255 |
for k, f in st.session_state.project_data["fenestrations"]["library"].items():
|
256 |
try:
|
257 |
category = "Window/Skylight" if f["type"] == "window" else "Door"
|
258 |
-
|
259 |
-
|
260 |
-
|
261 |
-
|
262 |
-
|
263 |
-
|
264 |
-
|
265 |
-
|
266 |
-
|
267 |
-
|
268 |
-
|
269 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
270 |
|
271 |
with tab1:
|
272 |
display_materials_tab(material_library)
|
|
|
255 |
for k, f in st.session_state.project_data["fenestrations"]["library"].items():
|
256 |
try:
|
257 |
category = "Window/Skylight" if f["type"] == "window" else "Door"
|
258 |
+
try:
|
259 |
+
if f["type"] == "window":
|
260 |
+
material_library.library_glazing_materials[k] = GlazingMaterial(
|
261 |
+
name=k,
|
262 |
+
shgc=f["performance"]["shgc"],
|
263 |
+
u_value=f["performance"]["u_value"],
|
264 |
+
h_o=f.get("h_o", DEFAULT_WINDOW_PROPERTIES["h_o"]),
|
265 |
+
category="Window/Skylight",
|
266 |
+
is_library=True
|
267 |
+
)
|
268 |
+
elif f["type"] == "door":
|
269 |
+
# Assign SHGC = 0.0 for doors (or use np.nan if you prefer to exclude it)
|
270 |
+
material_library.library_glazing_materials[k] = GlazingMaterial(
|
271 |
+
name=k,
|
272 |
+
shgc=0.0,
|
273 |
+
u_value=f["performance"]["u_value"],
|
274 |
+
h_o=f.get("h_o", DEFAULT_WINDOW_PROPERTIES["h_o"]),
|
275 |
+
category="Door",
|
276 |
+
is_library=True
|
277 |
+
)
|
278 |
+
logger.debug(f"Loaded fenestration: {k}, Type: {f['type']}, Category: {category}")
|
279 |
+
except KeyError as e:
|
280 |
+
logger.error(f"Error processing fenestration {k}: Missing key {e}")
|
281 |
+
continue
|
282 |
+
|
283 |
|
284 |
with tab1:
|
285 |
display_materials_tab(material_library)
|