Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/workflows/pull_request.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ jobs:
runs-on: ubuntu-latest
strategy:
matrix:
python-version: ["3.9", "3.10"]
python-version: ["3.9", "3.10", "3.11"]

steps:
- name: Check out repository
Expand Down
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[project]
name = "osut"
version = "0.8.1"
version = "0.8.2"
description = "OpenStudio SDK utilities for Python"
readme = "README.md"
requires-python = ">=3.2"
Expand Down
2 changes: 1 addition & 1 deletion src/osut/osut.py
Original file line number Diff line number Diff line change
Expand Up @@ -5554,7 +5554,7 @@ def spaceWidth(space=None) -> float:
polyg = list(polyg)
polyg.reverse()

res = realignedFace(polyg)
res = realignedFace(polyg, True)
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

A gross omission, inserted more than 12 months ago. Forcing realignFace to rotate so a polygon bounded box is wider than deeper (vs X-axis).

if not res["box"]: return 0

# A bounded box's 'height', at its narrowest, is its 'width'.
Expand Down
27 changes: 27 additions & 0 deletions tests/test_osut.py
Original file line number Diff line number Diff line change
Expand Up @@ -5944,6 +5944,33 @@ def test38_space_height_width(self):
self.assertEqual(o.level(), DBG)
translator = openstudio.osversion.VersionTranslator()

# Basic test: 'deep' space (vs X-axis).
vtx = openstudio.Point3dVector()
vtx.append(openstudio.Point3d(2,9,1))
vtx.append(openstudio.Point3d(2,1,1))
vtx.append(openstudio.Point3d(1,1,1))
vtx.append(openstudio.Point3d(1,9,1))

model = openstudio.model.Model()
space = openstudio.model.Space(model)
floor = openstudio.model.Surface(vtx, model)
floor.setSpace(space)
self.assertAlmostEqual(osut.spaceWidth(space),1,3)

# Basic test: 'narrow' space (vs X-axis).
vtx = openstudio.Point3dVector()
vtx.append(openstudio.Point3d(9,2,1))
vtx.append(openstudio.Point3d(9,1,1))
vtx.append(openstudio.Point3d(1,1,1))
vtx.append(openstudio.Point3d(1,2,1))

model = openstudio.model.Model()
space = openstudio.model.Space(model)
floor = openstudio.model.Surface(vtx, model)
floor.setSpace(space)
self.assertAlmostEqual(osut.spaceWidth(space),1,3)
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Basic tests demonstrating that spaceWidth (now) always returns the narrower dimension of a space's bounded box.


# --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- #
path = openstudio.path("./tests/files/osms/in/warehouse.osm")
model = translator.loadModel(path)
self.assertTrue(model)
Expand Down