Skip to content

Commit

Permalink
fix(extra): Update Preview Visualization Set to work with different VS
Browse files Browse the repository at this point in the history
This is coordinated with this PR:

ladybug-tools/ladybug-rhino#353
  • Loading branch information
chriswmackey committed Nov 12, 2024
1 parent 174151a commit 9fb9822
Show file tree
Hide file tree
Showing 7 changed files with 19 additions and 18 deletions.
Binary file modified ladybug_grasshopper/icon/LB Preview VisualizationSet.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
2 changes: 1 addition & 1 deletion ladybug_grasshopper/json/LB_Legacy_Updater.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"version": "1.8.0",
"version": "1.8.1",
"nickname": "Legacy",
"outputs": [
[]
Expand Down
2 changes: 1 addition & 1 deletion ladybug_grasshopper/json/LB_Preview_VisualizationSet.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"version": "1.8.2",
"version": "1.8.3",
"nickname": "VisSet",
"outputs": [
[
Expand Down
4 changes: 2 additions & 2 deletions ladybug_grasshopper/src/LB Legacy Updater.py
Original file line number Diff line number Diff line change
Expand Up @@ -36,10 +36,10 @@

ghenv.Component.Name = 'LB Legacy Updater'
ghenv.Component.NickName = 'Legacy'
ghenv.Component.Message = '1.8.0'
ghenv.Component.Message = '1.8.1'
ghenv.Component.Category = 'Ladybug'
ghenv.Component.SubCategory = '5 :: Version'
ghenv.Component.AdditionalHelpFromDocStrings = '0'
ghenv.Component.AdditionalHelpFromDocStrings = '1'

try:
from ladybug_rhino.versioning.gather import gather_canvas_components
Expand Down
29 changes: 15 additions & 14 deletions ladybug_grasshopper/src/LB Preview VisualizationSet.py
Original file line number Diff line number Diff line change
Expand Up @@ -73,13 +73,13 @@ def __init__(self):
def RunScript(self, _vis_set, legend_par_, leg_par2d_, data_set_, viewport_):
ghenv.Component.Name = 'LB Preview VisualizationSet'
ghenv.Component.NickName = 'VisSet'
ghenv.Component.Message = '1.8.2'
ghenv.Component.Message = '1.8.3'
ghenv.Component.Category = 'Ladybug'
ghenv.Component.SubCategory = '4 :: Extra'
ghenv.Component.AdditionalHelpFromDocStrings = '1'

try:
from ladybug_display.visualization import AnalysisGeometry
from ladybug_display.visualization import VisualizationSet, AnalysisGeometry
except ImportError as e:
raise ImportError('\nFailed to import ladybug_display:\n\t{}'.format(e))

Expand All @@ -96,18 +96,19 @@ def RunScript(self, _vis_set, legend_par_, leg_par2d_, data_set_, viewport_):
if len(_vis_set) == 1:
vis_set = _vis_set[0]
else:
if hasattr(_vis_set[0], 'data'):
arr_type = (list, tuple)
if isinstance(_vis_set[0].data, arr_type) and \
isinstance(_vis_set[0].data[0], arr_type):
vis_set = objectify_output(
'Multiple Vis Set Args', [obj.data[0] for obj in _vis_set])
else:
vis_set = objectify_output(
'Multiple Vis Set Args', [obj.data for obj in _vis_set])
else:
vis_set = objectify_output(
'Multiple Vis Sets', [[obj] for obj in _vis_set])
vis_objs = []
for vis_obj in _vis_set:
if isinstance(vis_obj, VisualizationSet):
vis_objs.append([vis_obj])
elif hasattr(vis_obj, 'data'):
arr_type = (list, tuple)
if isinstance(vis_obj.data, arr_type) and \
isinstance(vis_obj.data[0], arr_type):
for v_obj in vis_obj.data:
vis_objs.append(v_obj)
else:
vis_objs.append(vis_obj.data)
vis_set = objectify_output('Multiple Vis Sets', vis_objs)
vis_set_obj = process_vis_set(vis_set)

# process the connected legend parameters
Expand Down
Binary file modified ladybug_grasshopper/user_objects/LB Legacy Updater.ghuser
Binary file not shown.
Binary file not shown.

0 comments on commit 9fb9822

Please sign in to comment.