Exemple #1
0
# assign inputs
_name_, _testPoints, ptsVectors_, wGroups_ = IN
analysisGrid = None

try:
    from honeybee.radiance.analysisgrid import AnalysisGrid
except ImportError as e:
    raise ImportError('\nFailed to import honeybee:\n\t{}'.format(e))

if _testPoints:
    analysisGrid = AnalysisGrid.fromPointsAndVectors(_testPoints, ptsVectors_,
                                                     _name_, wGroups_)

# assign outputs to OUT
OUT = (analysisGrid, )
ghenv.Component.AdditionalHelpFromDocStrings = "2"

try:
    from honeybee.radiance.analysisgrid import AnalysisGrid
except ImportError as e:
    msg = '\nFailed to import honeybee. Did you install honeybee on your machine?' + \
            '\nYou can download the installer file from github: ' + \
            'https://github.com/ladybug-analysis-tools/honeybee-plus/tree/master/plugin/grasshopper/samplefiles' + \
            '\nOpen an issue on github if you think this is a bug:' + \
            ' https://github.com/ladybug-analysis-tools/honeybee-plus/issues'
        
    raise ImportError('{}\n\t{}'.format(msg, e))


if _testPoints:
    # match points and vectors
    try:
        from honeybee_grasshopper import datatree
        _testPoints = tuple(i.list for i in datatree.dataTreeToList(_testPoints))
        ptsVectors_ = tuple(i.list for i in datatree.dataTreeToList(ptsVectors_))
    except ImportError:
        # Dynamo
        pass
    else:
        ptsVectors_ = ptsVectors_ or ((),)
        
        ptsVectors_ = tuple(ptsVectors_[i]
                       if i < len(ptsVectors_) else ptsVectors_[-1]
                       for i in range(len(_testPoints)))
        analysisGrid = (AnalysisGrid.fromPointsAndVectors(pts, vectors)
                        for pts, vectors in zip(_testPoints, ptsVectors_))