ladybug_rhino.preview module

Classes to preview things in the Rhino Display Pipeline.

class ladybug_rhino.preview.RhinoPointConduit(*args: Any, **kwargs: Any)[source]

Bases: DisplayConduit

An optimized class to preview Rhino Point3d in the Rhino Display pipeline.

Parameters:

points – A list of Rhino Point3d to be displayed in the pipeline.

CalculateBoundingBox(calculateBoundingBoxEventArgs)[source]

Overwrite the method that passes the bounding box to the display.

PostDrawObjects(drawEventArgs)[source]

Overwrite the method that draws the objects in the display.

class ladybug_rhino.preview.VisualizationSetConduit(*args: Any, **kwargs: Any)[source]

Bases: DisplayConduit

Class to preview VisualizationSet in the Rhino Display pipeline.

Parameters:
  • visualization_set – A Ladybug Display VisualizationSet object to be translated into arguments for the Rhino display pipeline.

  • render_3d_legend – A Boolean to note whether the VisualizationSet should be rendered with 3D legends for any AnalysisGeometries it includes. (Default: False).

  • render_2d_legend – A Boolean to note whether the VisualizationSet should be rendered with 2D screen-oriented legends for any AnalysisGeometries it includes. (Default: False).

CalculateBoundingBox(calculateBoundingBoxEventArgs)[source]

Overwrite the method that passes the bounding box to the display.

DrawForeground(drawEventArgs)[source]

Overwrite the method that draws the objects in the display.

PostDrawObjects(drawEventArgs)[source]

Overwrite the method that draws the objects in the display.

PreDrawObjects(drawEventArgs)[source]

Overwrite the method that draws the objects in the display.

class ladybug_rhino.preview.VisualizationSetConverter(visualization_set, render_3d_legend=False, render_2d_legend=False)[source]

Bases: object

Class to translate VisualizationSets to arguments for the Rhino display pipeline.

Parameters:
  • visualization_set – A Ladybug Display VisualizationSet object to be translated into arguments for the Rhino display pipeline.

  • render_3d_legend – A Boolean to note whether the VisualizationSet should be rendered with 3D legends for any AnalysisGeometries it includes. (Default: False).

  • render_2d_legend – A Boolean to note whether the VisualizationSet should be rendered with 2D screen-oriented legends for any AnalysisGeometries it includes. (Default: False).

Properties:
  • vis_set

  • render_3d_legend

  • render_2d_legend

  • min_pt

  • max_pt

  • bbox

  • draw_sprite

  • draw_2d_text

  • draw_3d_text

  • draw_mesh_false_colors

  • draw_mesh_shaded

  • draw_mesh_wires

  • draw_mesh_vertices

  • draw_brep_shaded

  • draw_brep_wires

  • draw_point

  • draw_arrow

  • draw_line

  • draw_patterned_line

  • draw_patterned_polyline

  • draw_curve

  • draw_circle

  • draw_arc

  • draw_sphere

  • draw_cone

  • draw_cylinder

ToString()[source]

Overwrite .NET ToString method.

static convert_legend2d(legend, vw=None, vh=None)[source]

Convert a ladybug Legend into arguments for drawing in 2D on the screen.

Parameters:
  • legend – A Ladybug Legend object to be converted to 2D screen-oriented geometry.

  • vw – An integer for the view width in pixels. If None, it will be obtained from the active viewport. (Default: None).

  • vh – An integer for the view height in pixels. If None, it will be obtained from the active viewport. (Default: None).

Returns:

  • legend_mesh – A colored mesh for the legend.

  • legend_title – A text object for the legend title.

Return type:

A tuple with two values needed to render the legend in the 2D scene

sort_shaded_objects()[source]

Sort shaded objects according to their transparency.

This ensures that the resulting display has visible objects behind any transparent objects.

translate_analysis_geometry(geo_obj, color, display_mode)[source]

Translate analysis geometry objects into arguments for drawing in the scene.

Parameters:
  • geo_obj – The Ladybug Geometry object to be translated.

  • color – The Ladybug Color object with which the object will be translated.

  • display_mode – Text for the display mode in which to translate the mesh.

translate_analysis_mesh(mesh, display_mode)[source]

Translate an analysis mesh into arguments for drawing in the scene.

Parameters:
  • mesh – The Ladybug Mesh3D or Mesh2D object to be translated.

  • display_mode – Text for the display mode in which to translate the mesh.

translate_context_geometry(dis_obj)[source]

Translate a display geometry object into arguments for drawing in the scene.

Parameters:

dis_obj – The Ladybug Display geometry object to be translated.

translate_display_text3d(text_obj)[source]

Translate ladybug DisplayText3D into arguments for drawing in the scene.

Parameters:

text_obj – The ladybug DisplayText3D to be translated.

translate_legend2d(legend)[source]

Translate a ladybug Legend into arguments for drawing in the scene.

Parameters:

legend – A Ladybug Legend object to be converted to 2D screen-oriented geometry.

translate_legend3d(legend)[source]

Translate a ladybug Legend into arguments for drawing in the scene.

Parameters:

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

translate_objects()[source]

Translate all of the objects in the VisualizationSet into a Rhino equivalent.

This is a necessary pre-step before frames of the visualization set can be rendered in the display pipeline.

LINE_TYPE = {'DashDot': 2036209, 'Dashed': 455, 'Dotted': 4369}
TEXT_HORIZ = {'Center': Rhino.DocObjects.TextHorizontalAlignment.Center, 'Left': Rhino.DocObjects.TextHorizontalAlignment.Left, 'Right': Rhino.DocObjects.TextHorizontalAlignment.Right}
TEXT_VERT = {'Bottom': Rhino.DocObjects.TextVerticalAlignment.Bottom, 'Middle': Rhino.DocObjects.TextVerticalAlignment.Middle, 'Top': Rhino.DocObjects.TextVerticalAlignment.Top}