Skip to content

Commit df38912

Browse files
committed
fix(extra): Add support for previewing legend in multiple viewports
Resolves #388
1 parent 39d52c7 commit df38912

File tree

4 files changed

+7
-8
lines changed

4 files changed

+7
-8
lines changed
-14 Bytes
Loading

ladybug_grasshopper/json/LB_Preview_VisualizationSet.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
{
2-
"version": "1.9.0",
2+
"version": "1.9.1",
33
"nickname": "VisSet",
44
"outputs": [
55
[
@@ -42,7 +42,7 @@
4242
"default": null
4343
},
4444
{
45-
"access": "item",
45+
"access": "list",
4646
"name": "viewport_",
4747
"description": "Text for the name of the Rhino viewport to which the 2D screen-oriented\nlegend will be rendered. If unspecified, the 2D legend will be rendered\nin all viewports. Acceptable inputs include:\n-\nPerspective\nTop\nBottom\nLeft\nRight\nFront\nBack\nany view name that has been saved within the Rhino file",
4848
"type": "string",

ladybug_grasshopper/src/LB Preview VisualizationSet.py

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -68,12 +68,12 @@ def __init__(self):
6868
super(MyComponent,self).__init__()
6969
self.vis_con = None
7070
self.vs_goo = None
71-
self.viewport = None
71+
self.viewport = ()
7272

7373
def RunScript(self, _vis_set, legend_par_, leg_par2d_, data_set_, viewport_):
7474
ghenv.Component.Name = 'LB Preview VisualizationSet'
7575
ghenv.Component.NickName = 'VisSet'
76-
ghenv.Component.Message = '1.9.0'
76+
ghenv.Component.Message = '1.9.1'
7777
ghenv.Component.Category = 'Ladybug'
7878
ghenv.Component.SubCategory = '4 :: Extra'
7979
ghenv.Component.AdditionalHelpFromDocStrings = '1'
@@ -179,11 +179,11 @@ def RunScript(self, _vis_set, legend_par_, leg_par2d_, data_set_, viewport_):
179179
geo.active_data = i
180180
self.vis_con = VisualizationSetConverter(vis_set_obj, leg3d, leg2d)
181181
self.vs_goo = VisSetGoo(vis_set_obj)
182-
self.viewport = viewport_
182+
self.viewport = tuple(vp.lower() for vp in viewport_)
183183
else:
184184
self.vis_con = None
185185
self.vs_goo = None
186-
self.viewport = None
186+
self.viewport = ()
187187

188188
# return the bake-able version of the visualization set
189189
return self.vs_goo
@@ -225,8 +225,7 @@ def DrawViewportWires(self, args):
225225
display.DrawCone(*draw_args)
226226
for draw_args in self.vis_con.draw_cylinder:
227227
display.DrawCylinder(*draw_args)
228-
if self.viewport is None or \
229-
self.viewport.lower() == args.Viewport.Name.lower():
228+
if len(self.viewport)== 0 or args.Viewport.Name.lower() in self.viewport:
230229
for draw_args in self.vis_con.draw_2d_text:
231230
display.Draw2dText(*draw_args)
232231
for draw_args in self.vis_con.draw_sprite:
Binary file not shown.

0 commit comments

Comments
 (0)