honeybee_vtk.model module

A VTK representation of HBModel.

class honeybee_vtk.model.Model(hb_model: honeybee.model.Model, grid_options: honeybee_vtk.vtkjs.schema.SensorGridOptions = <SensorGridOptions.Ignore: 0>, radial_sensor: honeybee_vtk.types.RadialSensor = <honeybee_vtk.types.RadialSensor object>)[source]

Bases: object

A honeybee-vtk model.

The model objects are accessible based on their types:

  • apertures

  • doors

  • shades

  • walls

  • floors

  • roof_ceilings

  • air_boundaries

  • sensor_grids

You can control the style for each type separately.

actors() → List[honeybee_vtk.actor.Actor][source]

Create a list of vtk actors from a honeybee-vtk model.

Parameters

model – A honeybee-vtk model.

Returns

A list of vtk actors.

classmethod from_hbjson(hbjson: str, load_grids: honeybee_vtk.vtkjs.schema.SensorGridOptions = <SensorGridOptions.Ignore: 0>, radial_sensor: honeybee_vtk.types.RadialSensor = <honeybee_vtk.types.RadialSensor object>)honeybee_vtk.model.Model[source]

Translate hbjson to a honeybee-vtk model.

Parameters
  • model – A text string representing the path to the hbjson file.

  • load_grids – A SensorGridOptions object. Defaults to SensorGridOptions.Ignore which will ignore the grids in hbjson and will not load them in the honeybee-vtk model.

  • radial_sensor – A RadialSensor object to customize the triangles to be created in the radial sensor grid in case the radial grid is selected from the sensor grid options.

Returns

A honeybee-vtk model object.

static get_default_color(face_type: face_types) → Color[source]

Get the default color based of face type.

Use these colors to generate visualizations that are familiar for Ladybug Tools users. User can overwrite these colors as needed. This method converts decimal RGBA to integer RGBA values.

get_modeldataset(dataset: honeybee_vtk.types.DataSetNames)honeybee_vtk.types.ModelDataSet[source]

Get a ModelDataSet object from a model.

Parameters

dataset – A DataSetNames object.

Returns

A ModelDataSet object.

load_config(json_path: str, scene: Optional[honeybee_vtk.scene.Scene] = None, validation: bool = False, legend: bool = False) → List[honeybee_vtk.config.DataConfig][source]

Mount data on model from config json.

Parameters
  • json_path – File path to the config json file.

  • scene – A honeybee-vtk scene object. Defaults to None.

  • validation – A boolean indicating whether to validate the data before loading.

  • legend – A boolean indicating whether to load legend parameters.

Returns

A list of parsed DataConfig objects.

static separate_by_type(data: List[honeybee_vtk.types.PolyData]) → Dict[source]

Separate PolyData objects by type.

to_files(*, folder: str = '.', name: Optional[str] = None, writer: honeybee_vtk.types.VTKWriters = <VTKWriters.binary: 'vtp'>, config: Optional[str] = None, validation: bool = False, model_display_mode: honeybee_vtk.vtkjs.schema.DisplayMode = <DisplayMode.Shaded: 2>, grid_display_mode: honeybee_vtk.vtkjs.schema.DisplayMode = <DisplayMode.Shaded: 2>) → str[source]

Write a .zip of VTK/VTP files.

Parameters
  • folder – File path to the output folder. The file will be written to the current folder if not provided.

  • name – A text string for the name of the .zip file to be written. If no text string is provided, the name of the HBJSON file will be used as a file name for the .zip file.

  • writer – A VTkWriters object. Default is binary which will write .vtp files.

  • config – Path to the config file in JSON format. Defaults to None.

  • validation – Boolean to indicate whether to validate the data before loading.

  • model_display_mode – Display mode for the model. Defaults to shaded.

  • grid_display_mode – Display mode for the Grids. Defaults to shaded.

Returns

A text string containing the path to the .zip file with VTK/VTP files.

to_grid_images(config: str, *, folder: str = '.', grid_filter: Union[str, List[str]] = '*', full_match: bool = False, grid_display_mode: DisplayMode = <DisplayMode.SurfaceWithEdges: 3>, background_color: Tuple[int, int, int] = None, image_type: ImageTypes = <ImageTypes.png: 'png'>, image_width: int = 0, image_height: int = 0, image_name: str = '', image_scale: int = 1, text_actor: TextActor = None, grid_camera_dict: Dict[str, vtk.vtkCamera] = None, extract_camera: bool = False, grid_colors: List[Color] = None, sub_folder_name: str = None) → Union[Dict[str, Camera], List[str]][source]

Export am image for each grid in the model.

Use the config file to specify which grids with which data to export. For instance, if the config file has DataConfig objects for ‘DA’ and ‘UDI’, and ‘DA’ is kept hidden, then all grids with ‘UDI’ data will be exported. Additionally, images from a selected number of grids can be exported by using the by specifying the identifiers of the grids to export in the grid_filter object in the config file.

Note that the parameters grid_camera_dict and extract_camera are mutually exclusive. If both are provided, the extract_camera will be used and the grid_camera_dict will be ignored.

Parameters
  • config – Path to the config file in JSON format.

  • folder – Path to the folder where you’d like to export the images. Defaults to the current working directory.

  • grid_filter – A list of grid identifiers or a regex pattern as a string to filter the grids. Defaults to None.

  • full_match – A boolean to filter grids by their identifiers as full matches. Defaults to False.

  • display_mode – Display mode for the grid. Defaults to surface with edges.

  • background_color – Background color of the image. Defaults to white.

  • image_type – Image type to be exported. Defaults to png.

  • image_width – Image width in pixels. Defaults to 0. Which will use the default radiance view’s horizontal angle to derive the width.

  • image_height – Image height in pixels. Defaults to 0. Which will use the default radiance view’s vertical angle to derive the height.

  • image_name – A text string that sets the name of the image. Defaults to ‘’.

  • image_scale – An integer value as a scale factor. Defaults to 1.

  • text_actor – A TextActor object that defines the properties of the text to be added to the image. Defaults to None.

  • grid_camera_dict – A dictionary of grid identifiers and vtkCamera objects. If provided, the camera objects specified in the dict will be used to export the images. This is useful when a camera from another run is to be used in this run to export an image. Defaults to None.

  • extract_camera – Boolean to indicate whether to extract the camera from the for this run to use for the next run. Defaults to False.

  • sub_folder_name – A text string that sets the name of the subfolder where the images will be exported. This is useful when the images are to be exported for multiple time periods such as whole day of June 21, and the whole day of March, 21. Defaults to None.

Returns

Path to the folder where the images are exported for each grid. Or a dictionary of grid identifiers and camera objects.

to_html(*, folder: str = '.', name: Optional[str] = None, show: bool = False, config: Optional[str] = None, validation: bool = False, model_display_mode: honeybee_vtk.vtkjs.schema.DisplayMode = <DisplayMode.Shaded: 2>, grid_display_mode: honeybee_vtk.vtkjs.schema.DisplayMode = <DisplayMode.Shaded: 2>) → str[source]

Write the model to an HTML file.

Write your honeybee-vtk model to an HTML file that you can open in any modern browser and can also share with other.

Parameters
  • folder – A valid text string representing the location of folder where you’d want to write the HTML file. Defaults to current working directory.

  • name – Name for the HTML file. File name will be Model.html if not provided.

  • show – A boolean value. If set to True, the HTML file will be opened in the default browser. Defaults to False

  • config – Path to the config file in JSON format. Defaults to None.

  • validation – Boolean to indicate whether to validate the data before loading.

  • model_display_mode – Display mode for the model. Defaults to shaded.

  • grid_display_mode – Display mode for the Grids. Defaults to shaded.

Returns

A text string representing the file path to the HTML file.

to_images(*, folder: str = '.', config: Optional[str] = None, validation: bool = False, model_display_mode: honeybee_vtk.vtkjs.schema.DisplayMode = <DisplayMode.Shaded: 2>, grid_display_mode: honeybee_vtk.vtkjs.schema.DisplayMode = <DisplayMode.Shaded: 2>, background_color: Optional[Tuple[int, int, int]] = None, view: Optional[List[str]] = None, image_type: honeybee_vtk.types.ImageTypes = <ImageTypes.png: 'png'>, image_width: int = 0, image_height: int = 0, image_scale: int = 1) → List[str][source]

Export images from model.

Parameters
  • folder – A valid text string representing the location of folder where you’d want to write the images. Defaults to current working directory.

  • config – Path to the config file in JSON format. Defaults to None.

  • validation – Boolean to indicate whether to validate the data before loading.

  • model_display_mode – Display mode for the model. Defaults to shaded.

  • grid_display_mode – Display mode for the grid. Defaults to shaded.

  • background_color – Background color of the image. Defaults to white.

  • view – A list of paths to radiance view files. Defaults to None.

  • image_type – Image type to be exported. Defaults to png.

  • image_width – Image width. Defaults to 0. Which will use the default radiance view’s horizontal angle.

  • image_height – Image height. Defaults to 0. Which will use the default radiance view’s vertical angle.

  • image_scale – An integer value as a scale factor. Defaults to 1.

Returns

A list of text strings representing the file paths to the images.

to_vtkjs(*, folder: str = '.', name: Optional[str] = None, config: Optional[str] = None, validation: bool = False, model_display_mode: honeybee_vtk.vtkjs.schema.DisplayMode = <DisplayMode.Shaded: 2>, grid_display_mode: honeybee_vtk.vtkjs.schema.DisplayMode = <DisplayMode.Shaded: 2>) → str[source]

Write the model to a vtkjs file.

Write your honeybee-vtk model to a vtkjs file that you can open in Paraview-Glance or the Pollination Viewer.

Parameters
  • folder – A valid text string representing the location of folder where you’d want to write the vtkjs file. Defaults to current working directory.

  • name – Name for the vtkjs file. File name will be Model.vtkjs if not provided.

  • config – Path to the config file in JSON format. Defaults to None.

  • validation – Boolean to indicate whether to validate the data before loading. Defaults to False.

  • model_display_mode – Display mode for the model. Defaults to shaded.

  • grid_display_mode – Display mode for the Grids. Defaults to shaded.

Returns

A text string representing the file path to the vtkjs file.

update_display_mode(value: honeybee_vtk.vtkjs.schema.DisplayMode) → None[source]

Change display mode for all the object types in the model.

Sensor grids display model will not be affected. For changing the display model for a single object type, change the display_mode property separately.

model.sensor_grids.display_mode = DisplayMode.Wireframe
property air_boundaries

Air boundaries.

property apertures

Model aperture.

property cameras

List of Camera objects attached to this Model object.

property doors

Model doors.

property floors

Model floors.

property roof_ceilings

Roof and ceilings.

property sensor_grids

Sensor grids.

property shades

Model shades.

property walls

Model walls.