Skip to content

Commit

Permalink
fix(octree): Add separate static octree
Browse files Browse the repository at this point in the history
  • Loading branch information
mikkelkp committed Mar 17, 2023
1 parent 8ff571f commit b76458f
Show file tree
Hide file tree
Showing 2 changed files with 54 additions and 1 deletion.
26 changes: 26 additions & 0 deletions pollination/honeybee_radiance/octree.py
Original file line number Diff line number Diff line change
Expand Up @@ -143,3 +143,29 @@ def create_octree(self):
scene_info = Outputs.list(
description='Output octree files list.', path='octree/trans_info.json'
)


@dataclass
class CreateOctreeStatic(Function):
"""Generate an octree from a Radiance folder."""

# inputs
model = Inputs.folder(description='Path to Radiance model folder.', path='model')

@command
def create_octree(self):
return 'honeybee-radiance octree from-folder-static model ' \
'--output scene.oct'


@dataclass
class CreateOctreeWithSkyStatic(CreateOctreeStatic):
"""Generate an octree from a Radiance folder and a sky."""

# inputs
sky = Inputs.file(description='Path to sky file.', path='sky.sky')

@command
def create_octree(self):
return 'honeybee-radiance octree from-folder-static model ' \
'--output scene.oct --add-before sky.sky'
29 changes: 28 additions & 1 deletion tests/octree_test.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,7 @@
from pollination.honeybee_radiance.octree import CreateOctree, CreateOctreeWithSky
from pollination.honeybee_radiance.octree import CreateOctree, \
CreateOctreeWithSky, CreateOctreeAbstractedGroups, \
CreateOctreeShadeTransmittance, CreateOctreeStatic, \
CreateOctreeWithSkyStatic
from queenbee.plugin.function import Function


Expand All @@ -12,3 +15,27 @@ def test_create_octree_with_sky():
function = CreateOctreeWithSky().queenbee
assert function.name == 'create-octree-with-sky'
assert isinstance(function, Function)


def test_create_octree_abstracted_groups():
function = CreateOctreeAbstractedGroups().queenbee
assert function.name == 'create-octree-abstracted-groups'
assert isinstance(function, Function)


def test_create_octree_shade_transmittance():
function = CreateOctreeShadeTransmittance().queenbee
assert function.name == 'create-octree-shade-transmittance'
assert isinstance(function, Function)


def test_create_octree_static():
function = CreateOctreeStatic().queenbee
assert function.name == 'create-octree-static'
assert isinstance(function, Function)


def test_create_octree_with_sky_static():
function = CreateOctreeWithSkyStatic().queenbee
assert function.name == 'create-octree-with-sky-static'
assert isinstance(function, Function)

0 comments on commit b76458f

Please sign in to comment.