honeybee-core 1.64.0__py3-none-any.whl → 1.64.1__py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
honeybee/model.py CHANGED
@@ -1559,6 +1559,25 @@ class Model(_Base):
1559
1559
  for shade_mesh in self._shade_meshes:
1560
1560
  shade_mesh.add_prefix(prefix)
1561
1561
 
1562
+ def reset_room_ids(self):
1563
+ """Reset the identifiers of the Model Rooms to be derived from display_names.
1564
+
1565
+ In the event that duplicate Room identifiers are found, an integer will
1566
+ be automatically appended to the new Room ID to make it unique.
1567
+
1568
+ Returns:
1569
+ A dictionary that relates the old identifiers (keys) to the new
1570
+ identifiers (values). This can be used to map between old and new
1571
+ objects and update things like Surface boundary conditions.
1572
+ """
1573
+ room_dict, room_map = {}, {}
1574
+ for room in self.rooms:
1575
+ new_id = clean_and_number_string(
1576
+ room.display_name, room_dict, 'Room identifier')
1577
+ room_map[room.identifier] = new_id
1578
+ room.identifier = new_id
1579
+ return room_map
1580
+
1562
1581
  def reset_ids(self, repair_surface_bcs=True):
1563
1582
  """Reset the identifiers of all Model objects to be derived from display_names.
1564
1583
 
@@ -1613,39 +1632,7 @@ class Model(_Base):
1613
1632
  shade_mesh.display_name, sm_dict, 'ShadeMesh identifier')
1614
1633
  # reset all of the Surface boundary conditions if requested
1615
1634
  if repair_surface_bcs:
1616
- for room in self.rooms:
1617
- for face in room.faces:
1618
- if isinstance(face.boundary_condition, Surface):
1619
- old_objs = face.boundary_condition.boundary_condition_objects
1620
- try:
1621
- new_objs = (face_map[old_objs[0]], room_map[old_objs[1]])
1622
- except KeyError: # missing adjacency
1623
- try: # see if maybe the room reference is still there
1624
- new_objs = (old_objs[0], room_map[old_objs[1]])
1625
- except KeyError: # just let the invalid adjacency pass
1626
- continue
1627
- new_bc = Surface(new_objs)
1628
- face.boundary_condition = new_bc
1629
- for ap in face.apertures:
1630
- old_objs = ap.boundary_condition.boundary_condition_objects
1631
- try:
1632
- new_objs = (ap_map[old_objs[0]], face_map[old_objs[1]],
1633
- room_map[old_objs[2]])
1634
- except KeyError: # missing adjacency
1635
- new_objs = (old_objs[0], old_objs[1],
1636
- room_map[old_objs[2]])
1637
- new_bc = Surface(new_objs, True)
1638
- ap.boundary_condition = new_bc
1639
- for dr in face.doors:
1640
- old_objs = dr.boundary_condition.boundary_condition_objects
1641
- try:
1642
- new_objs = (dr_map[old_objs[0]], face_map[old_objs[1]],
1643
- room_map[old_objs[2]])
1644
- except KeyError: # missing adjacency
1645
- new_objs = (old_objs[0], old_objs[1],
1646
- room_map[old_objs[2]])
1647
- new_bc = Surface(new_objs, True)
1648
- dr.boundary_condition = new_bc
1635
+ self._repair_surface_bcs(room_map, face_map, ap_map, dr_map)
1649
1636
  # return a dictionary that maps between old and new IDs
1650
1637
  return {
1651
1638
  'rooms': room_map,
@@ -1654,24 +1641,90 @@ class Model(_Base):
1654
1641
  'doors': dr_map
1655
1642
  }
1656
1643
 
1657
- def reset_room_ids(self):
1658
- """Reset the identifiers of the Model Rooms to be derived from display_names.
1644
+ def reset_ids_to_integers(self, start_integer=0, repair_surface_bcs=True):
1645
+ """Reset the identifiers of all Model geometry objects to be a unique integer.
1659
1646
 
1660
- In the event that duplicate Room identifiers are found, an integer will
1661
- be automatically appended to the new Room ID to make it unique.
1647
+ Integers are simply incremented from the start_integer, assigning integers
1648
+ first to Rooms, then to Faces, then to Apertures/Doors and lastly to
1649
+ Shades/ShadeMeshes.
1650
+
1651
+ Args:
1652
+ start_integer: The starting integer that will be used to set a lower
1653
+ limit on the
1654
+ repair_surface_bcs: A Boolean to note whether all Surface boundary
1655
+ conditions across the model should be updated with the new
1656
+ identifiers that were generated from the display names. (Default: True).
1662
1657
 
1663
1658
  Returns:
1664
- A dictionary that relates the old identifiers (keys) to the new
1665
- identifiers (values). This can be used to map between old and new
1666
- objects and update things like Surface boundary conditions.
1659
+ An integer for the last value assigned to the model geometry objects.
1660
+ This can be used to ensure that any future IDs assigned after running
1661
+ this method do not have IDs that collide with the model objects.
1667
1662
  """
1668
- room_dict, room_map = {}, {}
1663
+ # set up dictionaries to hold various pieces of information
1664
+ room_map, face_map, ap_map, dr_map = {}, {}, {}, {}
1665
+ # loop through the objects and change their identifiers
1669
1666
  for room in self.rooms:
1670
- new_id = clean_and_number_string(
1671
- room.display_name, room_dict, 'Room identifier')
1672
- room_map[room.identifier] = new_id
1673
- room.identifier = new_id
1674
- return room_map
1667
+ room_map[room.identifier] = str(start_integer)
1668
+ room.identifier = str(start_integer)
1669
+ start_integer += 1
1670
+ for face in self.faces:
1671
+ face_map[face.identifier] = str(start_integer)
1672
+ face.identifier = str(start_integer)
1673
+ start_integer += 1
1674
+ for ap in self.apertures:
1675
+ ap_map[ap.identifier] = str(start_integer)
1676
+ ap.identifier = str(start_integer)
1677
+ start_integer += 1
1678
+ for dr in self.doors:
1679
+ dr_map[dr.identifier] = str(start_integer)
1680
+ dr.identifier = str(start_integer)
1681
+ start_integer += 1
1682
+ for shade in self.shades:
1683
+ shade.identifier = str(start_integer)
1684
+ start_integer += 1
1685
+ for shade_mesh in self.shade_meshes:
1686
+ shade_mesh.identifier = str(start_integer)
1687
+ start_integer += 1
1688
+ # reset all of the Surface boundary conditions if requested
1689
+ if repair_surface_bcs:
1690
+ self._repair_surface_bcs(room_map, face_map, ap_map, dr_map)
1691
+ return start_integer
1692
+
1693
+ def _repair_surface_bcs(self, room_map, face_map, ap_map, dr_map):
1694
+ """Repair Surface boundary conditions across the model using dict maps."""
1695
+ for room in self.rooms:
1696
+ for face in room.faces:
1697
+ if isinstance(face.boundary_condition, Surface):
1698
+ old_objs = face.boundary_condition.boundary_condition_objects
1699
+ try:
1700
+ new_objs = (face_map[old_objs[0]], room_map[old_objs[1]])
1701
+ except KeyError: # missing adjacency
1702
+ try: # see if maybe the room reference is still there
1703
+ new_objs = (old_objs[0], room_map[old_objs[1]])
1704
+ except KeyError: # just let the invalid adjacency pass
1705
+ continue
1706
+ new_bc = Surface(new_objs)
1707
+ face.boundary_condition = new_bc
1708
+ for ap in face.apertures:
1709
+ old_objs = ap.boundary_condition.boundary_condition_objects
1710
+ try:
1711
+ new_objs = (ap_map[old_objs[0]], face_map[old_objs[1]],
1712
+ room_map[old_objs[2]])
1713
+ except KeyError: # missing adjacency
1714
+ new_objs = (old_objs[0], old_objs[1],
1715
+ room_map[old_objs[2]])
1716
+ new_bc = Surface(new_objs, True)
1717
+ ap.boundary_condition = new_bc
1718
+ for dr in face.doors:
1719
+ old_objs = dr.boundary_condition.boundary_condition_objects
1720
+ try:
1721
+ new_objs = (dr_map[old_objs[0]], face_map[old_objs[1]],
1722
+ room_map[old_objs[2]])
1723
+ except KeyError: # missing adjacency
1724
+ new_objs = (old_objs[0], old_objs[1],
1725
+ room_map[old_objs[2]])
1726
+ new_bc = Surface(new_objs, True)
1727
+ dr.boundary_condition = new_bc
1675
1728
 
1676
1729
  def solve_adjacency(
1677
1730
  self, merge_coplanar=False, intersect=False, overwrite=False,
@@ -2181,6 +2234,18 @@ class Model(_Base):
2181
2234
  extrusion_rooms.append(room.to_extrusion(tol, a_tol))
2182
2235
  self._rooms = extrusion_rooms
2183
2236
 
2237
+ def shade_meshes_to_shades(self):
2238
+ """Convert all ShadeMesh objects on the Model to planar Shades."""
2239
+ new_shades = []
2240
+ for shade_mesh in self.shade_meshes:
2241
+ try:
2242
+ shade_mesh.triangulate_and_remove_degenerate_faces(self.tolerance)
2243
+ new_shades.extend(shade_mesh.to_shades())
2244
+ except AssertionError:
2245
+ pass # completely degenerate ShadeMesh to ignore
2246
+ self._orphaned_shades.extend(new_shades)
2247
+ self._shade_meshes = []
2248
+
2184
2249
  def convert_to_units(self, units='Meters'):
2185
2250
  """Convert all of the geometry in this model to certain units.
2186
2251
 
honeybee/shademesh.py CHANGED
@@ -324,6 +324,23 @@ class ShadeMesh(_Base):
324
324
  base['user_data'] = self.user_data
325
325
  return base
326
326
 
327
+ def to_shades(self):
328
+ """Return a list of Honeybee Shade objects derived from this ShadeMesh.
329
+
330
+ Note that the resulting Shades may be degenerate or non-planar so it
331
+ may be useful to call triangulate_and_remove_degenerate_faces on this
332
+ object before converting to Shades.
333
+ """
334
+ from honeybee.shade import Shade # imported here to avoid circular import
335
+ shades = []
336
+ for i, shade_geo in enumerate(self.geometry.face_vertices):
337
+ shade_id = '{}_{}'.format(self.identifier, i)
338
+ shade = Shade(shade_id, Face3D(shade_geo), self.is_detached)
339
+ if self._display_name is not None:
340
+ shade.display_name = '{} {}'.format(self.display_name, i)
341
+ shades.append(shade)
342
+ return shades
343
+
327
344
  @staticmethod
328
345
  def _display_mesh(mesh3d, color):
329
346
  """Create a DisplayMesh3D dictionary from a Mesh3D and color."""
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: honeybee-core
3
- Version: 1.64.0
3
+ Version: 1.64.1
4
4
  Summary: A library to create 3D building geometry for various types of environmental simulation.
5
5
  Home-page: https://github.com/ladybug-tools/honeybee-core
6
6
  Author: Ladybug Tools
@@ -16,13 +16,13 @@ honeybee/extensionutil.py,sha256=DDQYhM7tFD3avRSCOjwTzLqX9ldUxl5GzY79V3_sATE,964
16
16
  honeybee/face.py,sha256=BOL2tlFLErxY27euixVWFzL1z-xtABtzvMmLIpzMqcE,111961
17
17
  honeybee/facetype.py,sha256=vCtWZKHp21RH-Yzs8zsHJHuFhJvczNh0yFl8wDe_RWY,4489
18
18
  honeybee/logutil.py,sha256=2gn-6RcWqFLvwdFzBHPqUwFqTj_R3iwHKALrl-2eL7M,2564
19
- honeybee/model.py,sha256=RgD5JsxESt1JjmFanJZ4Vu5gQAHTXLMmtP5R0M9vL2Q,195385
19
+ honeybee/model.py,sha256=ajsXa4uAwU7Srml4QJ_aKcf-_hPSaQ2wx7_3U5HBJp0,198311
20
20
  honeybee/orientation.py,sha256=GogGblASW9OU-fobfDaQ7w5yRbEAFdJJuHwg2fadhKI,5046
21
21
  honeybee/properties.py,sha256=ok976fbUdXzLDR2XiPNf8Q5ejfOM-PArqm5CVUbFiCc,34316
22
22
  honeybee/room.py,sha256=ZrjABLErBTdTHcDRvPdt4W8-0REyPjQLtnu0rnrML0U,168284
23
23
  honeybee/search.py,sha256=KOIeQjYdj0yhRWPmF5kiFiH8Ei0WbzuiU-capnwYVeM,5060
24
24
  honeybee/shade.py,sha256=2zuW1lR5wfe-UyAosuCX-3tII6CKONq7wt8Ac_jXU6c,20698
25
- honeybee/shademesh.py,sha256=oldugnwhu-ibX9f0hfxpO-DvgM8U7S-dYwUjBSVzo4g,13273
25
+ honeybee/shademesh.py,sha256=WnpYkt04zuB8w-6OETNP7ZfzJarykEkQig6YdNkuVOw,14069
26
26
  honeybee/typing.py,sha256=E8-HrCB9cSoqhFR6zcFXhrAlQRAFw_sxHGdobB8Lre8,20051
27
27
  honeybee/units.py,sha256=_qG_G5b9hdqjpyVOpGdIYCB6k8VKYjcxSJn1St-7Xjc,3204
28
28
  honeybee/cli/__init__.py,sha256=nYyTV_HapGo-a1XZLZps9__Bqp50YJYzHZ1LzHp4TJU,3675
@@ -40,9 +40,9 @@ honeybee/writer/model.py,sha256=N7F_jksf-5TrdVecuxTaFWxnPVFLmQs7k8g27TsdB7Q,177
40
40
  honeybee/writer/room.py,sha256=kFghgStTU1SEJSLigXB0VjOWhZtgs4uXuAqdwd4yRQo,174
41
41
  honeybee/writer/shade.py,sha256=EpgX-vMc-s21TnMvNWvWTKyT8iAnxu1nFVXzjY1oyF8,177
42
42
  honeybee/writer/shademesh.py,sha256=Y41bLogJ7dwpvMe5cAWVRDRVqJEwo9e5hFJQjlt6UX8,189
43
- honeybee_core-1.64.0.dist-info/licenses/LICENSE,sha256=hIahDEOTzuHCU5J2nd07LWwkLW7Hko4UFO__ffsvB-8,34523
44
- honeybee_core-1.64.0.dist-info/METADATA,sha256=RlL15eO292imJELxLIkC81hR94wrn3_qeGxIxqEGGiM,3729
45
- honeybee_core-1.64.0.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
46
- honeybee_core-1.64.0.dist-info/entry_points.txt,sha256=r3YqOm40goBroH3ccUhpwQjvTwu10JWLd0HIRHI1J8E,47
47
- honeybee_core-1.64.0.dist-info/top_level.txt,sha256=8ve7puCRLUA9XDEGc1Mcs-UX9sFjpPV8MeTaIMwQ_Tg,9
48
- honeybee_core-1.64.0.dist-info/RECORD,,
43
+ honeybee_core-1.64.1.dist-info/licenses/LICENSE,sha256=hIahDEOTzuHCU5J2nd07LWwkLW7Hko4UFO__ffsvB-8,34523
44
+ honeybee_core-1.64.1.dist-info/METADATA,sha256=iLC7XbnZvDuIgb927jQbB2jHpv6_jBuN8SiCeeYVXsI,3729
45
+ honeybee_core-1.64.1.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
46
+ honeybee_core-1.64.1.dist-info/entry_points.txt,sha256=r3YqOm40goBroH3ccUhpwQjvTwu10JWLd0HIRHI1J8E,47
47
+ honeybee_core-1.64.1.dist-info/top_level.txt,sha256=8ve7puCRLUA9XDEGc1Mcs-UX9sFjpPV8MeTaIMwQ_Tg,9
48
+ honeybee_core-1.64.1.dist-info/RECORD,,