|
14 | 14 |
|
15 | 15 | Args: |
16 | 16 | _model: A Honeybee Model for which grids and views will be output. |
| 17 | + view_filter_: Text for a view identifer or a pattern to filter the views of the |
| 18 | + model that are output. For instance, `first_floor_*` will simulate |
| 19 | + only the views that have an identifier that starts with `first_floor_`. |
| 20 | + By default, all views in the model will be output. |
| 21 | + grid_filter_: Text for a grid identifer or a pattern to filter the sensor grids of |
| 22 | + the model that are output. For instance, first_floor_* will simulate |
| 23 | + only the sensor grids that have an identifier that starts with |
| 24 | + first_floor_. By default, all grids in the model will be output. |
17 | 25 |
|
18 | 26 | Returns: |
19 | 27 | views: A list of Honeybee-Radiance Views that are assigned to the |
|
27 | 35 |
|
28 | 36 | ghenv.Component.Name = 'HB Get Grids and Views' |
29 | 37 | ghenv.Component.NickName = 'GetGridsViews' |
30 | | -ghenv.Component.Message = '1.8.0' |
| 38 | +ghenv.Component.Message = '1.8.1' |
31 | 39 | ghenv.Component.Category = 'HB-Radiance' |
32 | 40 | ghenv.Component.SubCategory = '0 :: Basic Properties' |
33 | 41 | ghenv.Component.AdditionalHelpFromDocStrings = '5' |
|
42 | 50 | except ImportError as e: |
43 | 51 | raise ImportError('\nFailed to import honeybee:\n\t{}'.format(e)) |
44 | 52 |
|
| 53 | +try: # import honeybee_radiance dependencies |
| 54 | + from honeybee_radiance.writer import _filter_by_pattern |
| 55 | +except ImportError as e: |
| 56 | + raise ImportError('\nFailed to import honeybee_radiance:\n\t{}'.format(e)) |
| 57 | + |
45 | 58 | try: # import ladybug_rhino dependencies |
46 | 59 | from ladybug_rhino.fromgeometry import from_point3d, from_mesh3d |
47 | 60 | from ladybug_rhino.grasshopper import all_required_inputs, list_to_data_tree |
|
54 | 67 | 'Expected Honeybee Model. Got {}.'.format(type(_model)) |
55 | 68 | # get the honeybee-radiance objects |
56 | 69 | views = _model.properties.radiance.views |
| 70 | + if view_filter_ is not None: |
| 71 | + views = _filter_by_pattern(views, view_filter_) |
57 | 72 | grids = _model.properties.radiance.sensor_grids |
| 73 | + if grid_filter_ is not None: |
| 74 | + grids = _filter_by_pattern(grids, grid_filter_) |
58 | 75 |
|
59 | 76 | # get the visualizable attributes |
60 | 77 | points = [[from_point3d(Point3D.from_array(s.pos)) for s in sg] for sg in grids] |
|
0 commit comments