Skip to content

Commit

Permalink
fix(spaces): Fix floor-segment to_dict
Browse files Browse the repository at this point in the history
- Pass include-mesh down to Floor Segments
- move mesh onto geometry
  • Loading branch information
ed-p-may committed May 27, 2024
1 parent 375285f commit ee852d5
Showing 1 changed file with 14 additions and 8 deletions.
22 changes: 14 additions & 8 deletions honeybee_ph/space.py
Original file line number Diff line number Diff line change
Expand Up @@ -67,15 +67,18 @@ def to_dict(self, include_mesh=False, *args, **kwargs):
d["identifier"] = self.identifier
d["display_name"] = self.display_name
d["user_data"] = copy(self.user_data)

d["weighting_factor"] = self.weighting_factor
if self.geometry:
d["geometry"] = self.geometry.to_dict()

if self.reference_point:
d["reference_point"] = self.reference_point.to_dict()

d["geometry"] = None
if include_mesh and self.geometry:
d["mesh"] = self.geometry.triangulated_mesh3d.to_dict()
geom_dict = self.geometry.to_dict() # type: dict[str, Any]
geom_dict["mesh"] = self.geometry.triangulated_mesh3d.to_dict()
d["geometry"] = geom_dict
elif self.geometry:
d["geometry"] = self.geometry.to_dict()

return d

Expand Down Expand Up @@ -323,12 +326,15 @@ def to_dict(self, include_mesh=False, *args, **kwargs):
d["identifier"] = self.identifier
d["display_name"] = self.display_name
d["user_data"] = copy(self.user_data)
d["floor_segments"] = [seg.to_dict(include_mesh) for seg in self.floor_segments]

d["floor_segments"] = [seg.to_dict() for seg in self.floor_segments]
d["geometry"] = self.geometry.to_dict() if self.geometry else None

d["geometry"] = None
if include_mesh and self.geometry:
d["mesh"] = self.geometry.triangulated_mesh3d.to_dict()
geom_dict = self.geometry.to_dict() # type: dict[str, Any]
geom_dict["mesh"] = self.geometry.triangulated_mesh3d.to_dict()
d["geometry"] = geom_dict
elif self.geometry:
d["geometry"] = self.geometry.to_dict()

return d

Expand Down

0 comments on commit ee852d5

Please sign in to comment.