ghenv.Component.AdditionalHelpFromDocStrings = '0' try: from ladybug.legend import LegendParametersCategorized except ImportError as e: raise ImportError('\nFailed to import ladybug:\n\t{}'.format(e)) try: from ladybug_rhino.togeometry import to_plane from ladybug_rhino.grasshopper import all_required_inputs except ImportError as e: raise ImportError('\nFailed to import ladybug_rhino:\n\t{}'.format(e)) if all_required_inputs(ghenv.Component): if base_plane_: base_plane_ = to_plane(base_plane_) if len(categories_) == 0: categories_ = None leg_par = LegendParametersCategorized(domain=_domain, colors=_colors, category_names=categories_, base_plane=base_plane_) leg_par.continuous_colors = continuous_cols_ leg_par.continuous_legend = continuous_leg_ leg_par.decimal_count = num_decimals_ leg_par.include_larger_smaller = larger_smaller_ leg_par.vertical = vert_or_horiz_ leg_par.segment_height = seg_height_ leg_par.segment_width = seg_width_
will remain the same. Default: None. Returns: hb_objs: The input _hb_objs that has been mirrored across the input plane. """ ghenv.Component.Name = "HB Mirror" ghenv.Component.NickName = 'Mirror' ghenv.Component.Message = '1.2.0' ghenv.Component.Category = 'Honeybee' ghenv.Component.SubCategory = '0 :: Create' ghenv.Component.AdditionalHelpFromDocStrings = "6" try: # import the ladybug_rhino dependencies from ladybug_rhino.togeometry import to_plane from ladybug_rhino.grasshopper import all_required_inputs except ImportError as e: raise ImportError('\nFailed to import ladybug_rhino:\n\t{}'.format(e)) if all_required_inputs(ghenv.Component): hb_objs = [obj.duplicate() for obj in _hb_objs] # duplicate the initial objects plane = to_plane(_plane) # translate the plane to ladybug_geometry # mirror all of the objects for obj in hb_objs: obj.reflect(plane) # add the prefix if specified if prefix_ is not None: for obj in hb_objs: obj.add_prefix(prefix_)
try: mask_mesh = base_mask.remove_faces_only(mask_pattern) except AssertionError: # all mesh faces have been removed return None mask_mesh.colors = [color] * len(mask_mesh.faces) return from_mesh3d(mask_mesh) # process the inputs and set defaults for global variables _scale_ = 1 if _scale_ is None else _scale_ radius = (100 * _scale_) / conversion_to_meters() if _center_ is not None: # process the center point into a Point2D try: # assume that it is a point center_pt3d, direction = to_point3d(_center_), None except AttributeError: plane, is_orient = to_plane(_center_), True center_pt3d, direction = plane.o, plane.n else: center_pt3d, direction = Point3D(), None az_count, alt_count = 72, 18 if _density_: az_count = az_count * _density_ alt_count = alt_count * _density_ if orientation_ is not None: # process the orientation to a number ori_dict = {'north': 0, 'east': 90, 'south': 180, 'west': 270} try: # first check if it's text for the direction orientation_ = ori_dict[orientation_.lower()] except KeyError: # it's a number for the orientation orientation_ = float(orientation_) direction = Vector3D(0, 1, 0).rotate_xy(-math.radians(orientation_))
except ImportError as e: raise ImportError('\nFailed to import ladybug:\n\t{}'.format(e)) try: from ladybug_rhino.togeometry import to_plane from ladybug_rhino.fromobjects import legend_objects from ladybug_rhino.color import color_to_color from ladybug_rhino.grasshopper import all_required_inputs except ImportError as e: raise ImportError('\nFailed to import ladybug_rhino:\n\t{}'.format(e)) if all_required_inputs(ghenv.Component): # set default values legend_par_ = legend_par_.duplicate() if legend_par_ is not None else \ LegendParameters() if _base_plane_: legend_par_.base_plane = to_plane(_base_plane_) legend_par_.title = title_ # create the legend legend = Legend(_values, legend_par_) # separate all of the outputs from this component rhino_objs = legend_objects(legend) mesh = rhino_objs[0] title_obj = rhino_objs[1] label_objs = rhino_objs[2:] label_text = legend.segment_text colors = [color_to_color(col) for col in legend.value_colors]