Skip to content

Commit 2223fba

Browse files
authored
Merge pull request #9 from rd2/width
Fixes spaceWidth
2 parents 1f255ba + c205edd commit 2223fba

4 files changed

Lines changed: 30 additions & 3 deletions

File tree

.github/workflows/pull_request.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ jobs:
99
runs-on: ubuntu-latest
1010
strategy:
1111
matrix:
12-
python-version: ["3.9", "3.10"]
12+
python-version: ["3.9", "3.10", "3.11"]
1313

1414
steps:
1515
- name: Check out repository

pyproject.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[project]
22
name = "osut"
3-
version = "0.8.1"
3+
version = "0.8.2"
44
description = "OpenStudio SDK utilities for Python"
55
readme = "README.md"
66
requires-python = ">=3.2"

src/osut/osut.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5554,7 +5554,7 @@ def spaceWidth(space=None) -> float:
55545554
polyg = list(polyg)
55555555
polyg.reverse()
55565556

5557-
res = realignedFace(polyg)
5557+
res = realignedFace(polyg, True)
55585558
if not res["box"]: return 0
55595559

55605560
# A bounded box's 'height', at its narrowest, is its 'width'.

tests/test_osut.py

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5944,6 +5944,33 @@ def test38_space_height_width(self):
59445944
self.assertEqual(o.level(), DBG)
59455945
translator = openstudio.osversion.VersionTranslator()
59465946

5947+
# Basic test: 'deep' space (vs X-axis).
5948+
vtx = openstudio.Point3dVector()
5949+
vtx.append(openstudio.Point3d(2,9,1))
5950+
vtx.append(openstudio.Point3d(2,1,1))
5951+
vtx.append(openstudio.Point3d(1,1,1))
5952+
vtx.append(openstudio.Point3d(1,9,1))
5953+
5954+
model = openstudio.model.Model()
5955+
space = openstudio.model.Space(model)
5956+
floor = openstudio.model.Surface(vtx, model)
5957+
floor.setSpace(space)
5958+
self.assertAlmostEqual(osut.spaceWidth(space),1,3)
5959+
5960+
# Basic test: 'narrow' space (vs X-axis).
5961+
vtx = openstudio.Point3dVector()
5962+
vtx.append(openstudio.Point3d(9,2,1))
5963+
vtx.append(openstudio.Point3d(9,1,1))
5964+
vtx.append(openstudio.Point3d(1,1,1))
5965+
vtx.append(openstudio.Point3d(1,2,1))
5966+
5967+
model = openstudio.model.Model()
5968+
space = openstudio.model.Space(model)
5969+
floor = openstudio.model.Surface(vtx, model)
5970+
floor.setSpace(space)
5971+
self.assertAlmostEqual(osut.spaceWidth(space),1,3)
5972+
5973+
# --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- #
59475974
path = openstudio.path("./tests/files/osms/in/warehouse.osm")
59485975
model = translator.loadModel(path)
59495976
self.assertTrue(model)

0 commit comments

Comments
 (0)