Skip to content

Commit 52dc079

Browse files
committed
Fixes roof leader line issues
1 parent 0d99847 commit 52dc079

File tree

2 files changed

+21
-10
lines changed

2 files changed

+21
-10
lines changed

src/osut/osut.py

Lines changed: 12 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -5315,8 +5315,8 @@ def genAnchors(s=None, sset=[], tag="box") -> int:
53155315
mth = "osut.genAnchors"
53165316
n = 0
53175317
ide = "%s " % s.nameString() if hasattr(s, "nameString") else ""
5318-
pts = poly(s)
53195318
ids = id(s)
5319+
pts = poly(s)
53205320

53215321
if not pts:
53225322
return oslg.invalid("%s polygon" % ide, mth, 1, CN.DBG, n)
@@ -5361,7 +5361,7 @@ def genAnchors(s=None, sset=[], tag="box") -> int:
53615361
if not isinstance(st["ld"], dict):
53625362
return oslg.invalid("%s leaders" % str1, mth, 0, CN.DBG, n)
53635363

5364-
st["ld"] = dict(st["ld"].items(), key=lambda k: k[0] != ids)
5364+
if ids in st["ld"]: st["ld"].pop(ids)
53655365
else:
53665366
st["ld"] = {}
53675367

@@ -5496,8 +5496,8 @@ def genExtendedVertices(s=None, sset=[], tag="vtx") -> openstudio.Point3dVector:
54965496
mth = "osut.genExtendedVertices"
54975497
ide = "%s " % s.nameString() if hasattr(s, "nameString") else ""
54985498
f = False
5499-
pts = poly(s)
55005499
ids = id(s)
5500+
pts = poly(s)
55015501
cl = openstudio.Point3d
55025502
a = openstudio.Point3dVector()
55035503
v = []
@@ -5590,6 +5590,7 @@ def genInserts(s=None, sset=[]) -> openstudio.Point3dVector:
55905590
"""
55915591
mth = "osut.genInserts"
55925592
ide = "%s:" % s.nameString() if hasattr(s, "nameString") else ""
5593+
ids = id(s)
55935594
pts = poly(s)
55945595
cl = openstudio.Point3d
55955596
a = openstudio.Point3dVector()
@@ -5622,10 +5623,10 @@ def genInserts(s=None, sset=[]) -> openstudio.Point3dVector:
56225623

56235624
if not isinstance(ld, dict):
56245625
return oslg.mismatch(str2, "ld", dict, mth, CN.DBG, a)
5625-
if id(s) not in ld:
5626-
return oslg.hashkey(str2, ld, s, mth, CN.DBG, a)
5627-
if not isinstance(ld[id(s)], cl):
5628-
return oslg.mismatch(str2, ld[id(s)], cl, mth, CN.DBG, a)
5626+
if ids not in ld:
5627+
return oslg.hashkey(str2, ld, ide, mth, CN.DBG, a)
5628+
if not isinstance(ld[ids], cl):
5629+
return oslg.mismatch(str2, ld[ids], cl, mth, CN.DBG, a)
56295630

56305631
# Ensure each subset bounding box is safely within larger polygon
56315632
# boundaries.
@@ -5709,7 +5710,7 @@ def genInserts(s=None, sset=[]) -> openstudio.Point3dVector:
57095710

57105711
for j, other in enumerate(sset):
57115712
if i == j: continue
5712-
bx2 = other["box"]
5713+
bx2 = other["box"]
57135714

57145715
if overlapping(bx, bx2):
57155716
str4 = ide + "subset boxes #%d:#%d" % (i+1, j+1)
@@ -5811,7 +5812,7 @@ def genInserts(s=None, sset=[]) -> openstudio.Point3dVector:
58115812

58125813
# Add reverse vertices, circumscribing each insert.
58135814
vec.reverse()
5814-
if iX == cols - 1: vec.pop
5815+
if iX == cols - 1: vec.pop()
58155816

58165817
vtx += vec
58175818
if iX != cols - 1: xC -= gX + x
@@ -5824,7 +5825,7 @@ def genInserts(s=None, sset=[]) -> openstudio.Point3dVector:
58245825
st["vtx"] = p3Dv(t * (o["r"] * (o["t"] * vtx)))
58255826

58265827
# Extended vertex sequence of the larger polygon.
5827-
genExtendedVertices(s, sset)
5828+
return genExtendedVertices(s, sset)
58285829

58295830

58305831
def facets(spaces=[], boundary="all", type="all", sides=[]) -> list:
@@ -8522,6 +8523,7 @@ def addSkyLights(spaces=[], opts=dict) -> float:
85228523

85238524
sts = [st for st in sts if st[k ] == grenier["space"]]
85248525
sts = [st for st in sts if st["roof"] == roof]
8526+
85258527
if not sts: continue
85268528

85278529
# If successful, 'genInserts' returns extended ROOF surface

tests/test_osut.py

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5001,6 +5001,15 @@ def test34_generated_skylight_wells(self):
50015001
ratio = sky_area1 / rm2
50025002
self.assertAlmostEqual(round(ratio, 2), srr)
50035003

5004+
# Reset attic default construction set for insulated interzone walls.
5005+
opts = dict(type="partition", uo=0.3)
5006+
construction = osut.genConstruction(model, opts)
5007+
self.assertAlmostEqual(osut.rsi(construction, 0.150), 1/0.3, places=2)
5008+
self.assertTrue(ia_set.setWallConstruction(construction))
5009+
if o.logs(): print(o.logs())
5010+
5011+
model.save("./tests/files/osms/out/office_attic.osm", True)
5012+
50045013
self.assertEqual(o.status(), 0)
50055014
del model
50065015

0 commit comments

Comments
 (0)