ladybug_rhino.fromobjects module

Functions to translate entire Ladybug core objects to Rhino geometries.

The methods here are intended to help translate groups of geometry that are commonly generated by several objects in Ladybug core (ie. legends, compasses, etc.)

ladybug_rhino.fromobjects.compass_objects(compass, z=0, custom_angles=None, projection=None, font='Arial')[source]

Translate a Ladybug Compass object into Grasshopper geometry.

Parameters:
  • compass – A Ladybug Compass object to be converted to Rhino geometry.

  • z – A number for the Z-coordinate to be used in translation. (Default: 0)

  • custom_angles – An array of numbers between 0 and 360 to be used to generate custom angle labels around the compass.

  • projection

    Text for the name of the projection to use from the sky dome hemisphere to the 2D plane. If None, no altitude circles o labels will be drawn (Default: None). Choose from the following:

    • Orthographic

    • Stereographic

  • font – Optional text for the font to be used in creating the text. (Default: ‘Arial’)

Returns:

A list of Rhino geometries in the following order.

  • all_boundary_circles – Three Circle objects for the compass boundary.

  • major_azimuth_ticks – Line objects for the major azimuth labels.

  • major_azimuth_text – Bake-able text objects for the major azimuth labels.

  • minor_azimuth_ticks – Line objects for the minor azimuth labels

    (if applicable).

  • minor_azimuth_text – Bake-able text objects for the minor azimuth

    labels (if applicable).

  • altitude_circles – Circle objects for the altitude labels.

  • altitude_text – Bake-able text objects for the altitude labels.

ladybug_rhino.fromobjects.create_luminaire_axes(luminaire)[source]

Draw the C0-G0 axes for a Luminaire according to IES LM-63.

Parameters:

luminaire – A Honeybee Luminaire.

Returns:

[C0 axis, G0 axis]

ladybug_rhino.fromobjects.create_luminaire_brep(luminaire)[source]

Create geometric representation of the luminous opening of a Luminaire.

Parameters:

luminaire – A Honeybee Luminaire.

Returns:

List[Rhino.Geometry.Brep]

ladybug_rhino.fromobjects.from_geometry(geometry)[source]

Generic geometry translation function that works for any ladybug-geometry object.

This is only recommended for cases where an input geometry stream can contain a variety of different objects. When the geometry type is know, it can be significantly faster to use the dedicated geometry translator.

Parameters:

geometry – Any 2D or 3D ladybug-geometry object.

ladybug_rhino.fromobjects.label_countours(contours, thresholds, legend_parameters=None)[source]

Create text labels for contours.

Parameters:
  • contours – A list of lists where each sub-list represents contours associated with a specific threshold. Sub-lists contain Rhino Polyline objects.

  • thresholds – list of numbers for the threshold value associated with each contour. The length of this list matches the contours.

  • legend_parameters – Ladybug LegendParameters to be used to customize the text height and decimal count of the contours. If None, default legend parameters will be used. (DefaultL None).

Returns:

A list of Rhino geometries in the following order.

  • updated_contours – A list of Polylines for contours.

  • labels – list of text labels (if text_labels is set to True).

ladybug_rhino.fromobjects.legend_objects(legend)[source]

Translate a Ladybug Legend object into Grasshopper geometry.

Parameters:

legend – A Ladybug Legend object to be converted to Rhino geometry.

Returns:

A list of Rhino geometries in the following order.

  • legend_mesh – A colored mesh for the legend.

  • legend_title – A bake-able text object for the legend title.

  • legend_text – Bake-able text objects for the rest of the legend text.

ladybug_rhino.fromobjects.luminaire_objects(luminaire, scale=1)[source]

Translate a Honeybee Luminaire object into Rhino geometry.

Parameters:
  • luminaire – A Honeybee Luminaire object to be converted to Rhino geometry.

  • scale – A number for the scale factor to be used in translation. (Default: 1)

Returns:

A list of Rhino geometries in the following order.

  • lum_web – Rhino geometry representing the candela distribution.

  • lum_poly – Rhino geometry representing the luminaire opening.

  • lum_axes – Line objects for the C0 and G0 axes of the luminaire.

ladybug_rhino.fromobjects.luminaire_web_to_rhino_breps(luminaire, normalize=True)[source]

Generate geometric representation of the candela distribution of a luminaire.

Parameters:
  • luminaire – A Honeybee Luminaire.

  • normalize – Set to True to Normalize candela values.

Returns:

List[Rhino.Geometry.Brep]

ladybug_rhino.fromobjects.mesh_to_contours(mesh, values, legend_parameters=None, smooth_iterations=1, smooth_strength=1, as_lb_geo=False)[source]

Get Polylines for contours from a Rhino Mesh and associated values.

Parameters:
  • mesh – A Rhino Mesh for which contours will be derived.

  • values – A list of numerical values to define how the mesh is contoured. The number of values must match the number of faces or vertices in the mesh.

  • legend_parameters – Ladybug LegendParameters to be used to customize the number and min/max of the contours. If None, default legend parameters will be used. (DefaultL None).

  • smooth_iterations – The number of times that the contours will be smoothed. (Default: 1).

  • smooth_strength – A number between 0 and 1 to denote controls how much control points move towards the average of the neighboring control points. (Default: 1).

  • as_lb_geo – Boolean to note wether the result shall be returned as ladybug geometry Polyline3D and LineSegment3D (true) or as Rhino Polyline and Line objects (False). (Default: False).

Returns:

A list of Rhino geometries in the following order.

  • contours – A list of lists where each sub-list represents contours associated with a specific threshold. Contours are composed of Rhino Polyline and Line objects.

  • thresholds – list of numbers for the threshold value associated with each contour. The length of this list matches the contours.

ladybug_rhino.fromobjects.place_luminaire_from_object(luminaire, luminaire_web, scale)[source]

Take a Luminaire object, place its geometry at all points in its LuminaireZone, applying spin, tilt, and rotation.

Parameters:
  • luminaire – A Honeybee Luminaire.

  • luminaire_web – Geometric representation of the candela distribution of of the luminaire.

  • scale – Scalar value to scale the geometry.

Returns:

List[Rhino.Geometry.Brep]

ladybug_rhino.fromobjects.transform_geometry(geometry, spin=0, tilt=0, rotation=0, translation=None, scale=1.0)[source]

Transform a geometry or list of geometries based on spin, tilt, rotation, translation, scale.

Parameters:
  • geometry – Rhino geometry to transform.

  • spin – Number for the spin (Z-axis) in degrees.

  • tilt – Number for the tilt (Y-axis) in degrees.

  • rotation – Number for the rotation (Z-axis) in degrees.

  • translation – A Ladybug Vector3D or Point3D, or a tuple of three numbers for the translation in the X, Y, and Z directions. If None, no translation is applied.

  • scale – Number for the scale factor.

Returns:

Transformed geometry or list of geometries.