Skip to content

Commit

Permalink
Showing 3 changed files with 19 additions and 12 deletions.
9 changes: 8 additions & 1 deletion PHX/model/constructions.py
Original file line number Diff line number Diff line change
@@ -29,7 +29,12 @@ class PhxLayer:
@property
def material(self) -> PhxMaterial:
"""Return the first PhxMaterial from the self.materials collection."""
return self.materials[0]
if not self.materials:
# -- Return a default PhxMaterial if no materials are set.
return PhxMaterial()
else:
# -- Otherwise return the first material in the collection.
return self.materials[0]

def add_material(self, _material: PhxMaterial) -> None:
self.materials.append(_material)
@@ -39,6 +44,7 @@ def thickness_mm(self):
"""Returns the thickness of the layer in MM"""
return self.thickness_m * 1000


@dataclass
class PhxConstructionOpaque:
_count: ClassVar[int] = 0
@@ -68,6 +74,7 @@ def identifier(self, _in: str):
def __hash__(self):
return hash(self.identifier)


# ------------------------------------------------------------
# Windows

4 changes: 2 additions & 2 deletions tests/_reference_xml/Default_Model_Single_Zone.xml
Original file line number Diff line number Diff line change
@@ -191,7 +191,7 @@
<Components count="3">
<Component index="0">
<IdentNr>5</IdentNr>
<Name>Room_1_60a6ffd6..Face4</Name>
<Name>Room_1_d5f95662..Face4</Name>
<Visual>true</Visual>
<Type>1</Type>
<IdentNrColorI>12</IdentNrColorI>
@@ -207,7 +207,7 @@
</Component>
<Component index="1">
<IdentNr>6</IdentNr>
<Name>Room_1_60a6ffd6..Face5</Name>
<Name>Room_1_d5f95662..Face5</Name>
<Visual>true</Visual>
<Type>1</Type>
<IdentNrColorI>7</IdentNrColorI>
18 changes: 9 additions & 9 deletions tests/_reference_xml/Multi_Room_Complete.xml
Original file line number Diff line number Diff line change
@@ -574,7 +574,7 @@
<Building>
<Components count="6">
<Component index="0">
<IdentNr>33</IdentNr>
<IdentNr>41</IdentNr>
<Name>Merged_Component</Name>
<Visual>true</Visual>
<Type>1</Type>
@@ -595,7 +595,7 @@
</IdentNrPolygons>
</Component>
<Component index="1">
<IdentNr>34</IdentNr>
<IdentNr>42</IdentNr>
<Name>Merged_Component</Name>
<Visual>true</Visual>
<Type>1</Type>
@@ -612,7 +612,7 @@
</IdentNrPolygons>
</Component>
<Component index="2">
<IdentNr>35</IdentNr>
<IdentNr>43</IdentNr>
<Name>Merged_Component</Name>
<Visual>true</Visual>
<Type>1</Type>
@@ -629,7 +629,7 @@
</IdentNrPolygons>
</Component>
<Component index="3">
<IdentNr>40</IdentNr>
<IdentNr>48</IdentNr>
<Name>Merged_Component</Name>
<Visual>true</Visual>
<Type>2</Type>
@@ -650,8 +650,8 @@
</IdentNrPolygons>
</Component>
<Component index="4">
<IdentNr>41</IdentNr>
<Name>Shade_1386f05d</Name>
<IdentNr>49</IdentNr>
<Name>Shade_f8b0153c</Name>
<Visual>true</Visual>
<Type>1</Type>
<IdentNrColorI>1</IdentNrColorI>
@@ -666,8 +666,8 @@
</IdentNrPolygons>
</Component>
<Component index="5">
<IdentNr>42</IdentNr>
<Name>Shade_cf60eb9b</Name>
<IdentNr>50</IdentNr>
<Name>Shade_2b23ce42</Name>
<Visual>true</Visual>
<Type>1</Type>
<IdentNrColorI>1</IdentNrColorI>
@@ -1070,7 +1070,7 @@
</PH_Parameters>
</Device>
<Device index="1">
<Name>d66e39ba-fe39-4388-ad97-bbde1d23da47</Name>
<Name>e7244824-5229-41bb-b4dc-3c03e5995a3f</Name>
<IdentNr>1</IdentNr>
<SystemType>5</SystemType>
<TypeDevice>5</TypeDevice>

0 comments on commit 539500d

Please sign in to comment.