From ee852d5c170915dc91bf2c6c2139eb9fd2f3517a Mon Sep 17 00:00:00 2001 From: PH Tools Date: Mon, 27 May 2024 12:13:54 -0400 Subject: [PATCH] fix(spaces): Fix floor-segment to_dict - Pass include-mesh down to Floor Segments - move mesh onto geometry --- honeybee_ph/space.py | 22 ++++++++++++++-------- 1 file changed, 14 insertions(+), 8 deletions(-) diff --git a/honeybee_ph/space.py b/honeybee_ph/space.py index ba47cde..86b6029 100644 --- a/honeybee_ph/space.py +++ b/honeybee_ph/space.py @@ -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 @@ -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